Skip to content

Commit

Permalink
[misc] use more config.php
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Jan 29, 2025
1 parent 45b9002 commit 70dd614
Show file tree
Hide file tree
Showing 22 changed files with 147 additions and 96 deletions.
12 changes: 12 additions & 0 deletions ext/approval/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class ApprovalConfig extends ConfigGroup
{
public const VERSION = "ext_approval_version";
public const IMAGES = "approve_images";
public const COMMENTS = "approve_comments";
}
7 changes: 0 additions & 7 deletions ext/approval/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

namespace Shimmie2;

abstract class ApprovalConfig
{
public const VERSION = "ext_approval_version";
public const IMAGES = "approve_images";
public const COMMENTS = "approve_comments";
}

class Approval extends Extension
{
/** @var ApprovalTheme */
Expand Down
13 changes: 13 additions & 0 deletions ext/handle_video/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class VideoFileHandlerConfig extends ConfigGroup
{
public const PLAYBACK_AUTOPLAY = "video_playback_autoplay";
public const PLAYBACK_LOOP = "video_playback_loop";
public const PLAYBACK_MUTE = "video_playback_mute";
public const ENABLED_FORMATS = "video_enabled_formats";
}
8 changes: 0 additions & 8 deletions ext/handle_video/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

namespace Shimmie2;

abstract class VideoFileHandlerConfig
{
public const PLAYBACK_AUTOPLAY = "video_playback_autoplay";
public const PLAYBACK_LOOP = "video_playback_loop";
public const PLAYBACK_MUTE = "video_playback_mute";
public const ENABLED_FORMATS = "video_enabled_formats";
}

class VideoFileHandler extends DataHandlerExtension
{
public const SUPPORTED_MIME = [
Expand Down
17 changes: 17 additions & 0 deletions ext/pools/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class PoolsConfig extends ConfigGroup
{
public const MAX_IMPORT_RESULTS = "poolsMaxImportResults";
public const IMAGES_PER_PAGE = "poolsImagesPerPage";
public const LISTS_PER_PAGE = "poolsListsPerPage";
public const UPDATED_PER_PAGE = "poolsUpdatedPerPage";
public const INFO_ON_VIEW_IMAGE = "poolsInfoOnViewImage";
public const ADDER_ON_VIEW_IMAGE = "poolsAdderOnViewImage";
public const SHOW_NAV_LINKS = "poolsShowNavLinks";
public const AUTO_INCREMENT_ORDER = "poolsAutoIncrementOrder";
}
16 changes: 2 additions & 14 deletions ext/pools/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@

use function MicroHTML\{INPUT};

abstract class PoolsConfig
{
public const MAX_IMPORT_RESULTS = "poolsMaxImportResults";
public const IMAGES_PER_PAGE = "poolsImagesPerPage";
public const LISTS_PER_PAGE = "poolsListsPerPage";
public const UPDATED_PER_PAGE = "poolsUpdatedPerPage";
public const INFO_ON_VIEW_IMAGE = "poolsInfoOnViewImage";
public const ADDER_ON_VIEW_IMAGE = "poolsAdderOnViewImage";
public const SHOW_NAV_LINKS = "poolsShowNavLinks";
public const AUTO_INCREMENT_ORDER = "poolsAutoIncrementOrder";
}

class PoolAddPostsEvent extends Event
{
public int $pool_id;
Expand Down Expand Up @@ -346,8 +334,8 @@ public function onPageRequest(PageRequestEvent $event): void
while ($row = $result->fetch()) {
$database->execute(
"
UPDATE pool_images
SET image_order=:ord
UPDATE pool_images
SET image_order=:ord
WHERE pool_id = :pid AND image_id = :iid",
["ord" => $image_order, "pid" => $pool_id, "iid" => (int) $row['image_id']]
);
Expand Down
12 changes: 12 additions & 0 deletions ext/private_image/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class PrivateImageConfig extends ConfigGroup
{
public const VERSION = "ext_private_image_version";
public const USER_SET_DEFAULT = "user_private_image_set_default";
public const USER_VIEW_DEFAULT = "user_private_image_view_default";
}
9 changes: 0 additions & 9 deletions ext/private_image/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

namespace Shimmie2;

use function MicroHTML\rawHTML;

abstract class PrivateImageConfig
{
public const VERSION = "ext_private_image_version";
public const USER_SET_DEFAULT = "user_private_image_set_default";
public const USER_VIEW_DEFAULT = "user_private_image_view_default";
}

class PrivateImage extends Extension
{
/** @var PrivateImageTheme */
Expand Down
11 changes: 11 additions & 0 deletions ext/rating/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class RatingsConfig extends ConfigGroup
{
public const VERSION = "ext_ratings2_version";
public const USER_DEFAULTS = "ratings_default";
}
6 changes: 0 additions & 6 deletions ext/rating/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ public function __construct(Image $image, string $rating)
}
}

abstract class RatingsConfig
{
public const VERSION = "ext_ratings2_version";
public const USER_DEFAULTS = "ratings_default";
}

class Ratings extends Extension
{
/** @var RatingsTheme */
Expand Down
14 changes: 14 additions & 0 deletions ext/ratings_blur/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class RatingsBlurConfig extends ConfigGroup
{
public const VERSION = "ext_ratings_blur_version";
public const GLOBAL_DEFAULTS = "ext_ratings_blur_defaults";
public const USER_DEFAULTS = "ratings_blur_default";
public const DEFAULT_OPTIONS = ["e"];
public const NULL_OPTION = "[none]";
}
9 changes: 0 additions & 9 deletions ext/ratings_blur/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

namespace Shimmie2;

abstract class RatingsBlurConfig
{
public const VERSION = "ext_ratings_blur_version";
public const GLOBAL_DEFAULTS = "ext_ratings_blur_defaults";
public const USER_DEFAULTS = "ratings_blur_default";
public const DEFAULT_OPTIONS = ["e"];
public const NULL_OPTION = "[none]";
}

class RatingsBlur extends Extension
{
public function onInitExt(InitExtEvent $event): void
Expand Down
15 changes: 15 additions & 0 deletions ext/resize/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class ResizeConfig extends ConfigGroup
{
public const ENABLED = 'resize_enabled';
public const UPLOAD = 'resize_upload';
public const ENGINE = 'resize_engine';
public const DEFAULT_WIDTH = 'resize_default_width';
public const DEFAULT_HEIGHT = 'resize_default_height';
public const GET_ENABLED = 'resize_get_enabled';
}
10 changes: 0 additions & 10 deletions ext/resize/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

use function MicroHTML\{rawHTML};

abstract class ResizeConfig
{
public const ENABLED = 'resize_enabled';
public const UPLOAD = 'resize_upload';
public const ENGINE = 'resize_engine';
public const DEFAULT_WIDTH = 'resize_default_width';
public const DEFAULT_HEIGHT = 'resize_default_height';
public const GET_ENABLED = 'resize_get_enabled';
}

class ImageResizeException extends ServerError
{
}
Expand Down
10 changes: 10 additions & 0 deletions ext/reverse_search_links/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class ReverseSearchLinksConfig extends ConfigGroup
{
public const ENABLED_SERVICES = "ext_reverse_search_links_enabled_services";
}
5 changes: 0 additions & 5 deletions ext/reverse_search_links/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

namespace Shimmie2;

abstract class ReverseSearchLinksConfig
{
public const ENABLED_SERVICES = "ext_reverse_search_links_enabled_services";
}

class ReverseSearchLinks extends Extension
{
/** @var ReverseSearchLinksTheme */
Expand Down
18 changes: 18 additions & 0 deletions ext/speed_hax/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class SpeedHaxConfig extends ConfigGroup
{
public const NO_AUTO_DB_UPGRADE = "speed_hax_no_auto_db_upgrade";
public const CACHE_EVENT_LISTENERS = "speed_hax_cache_listeners";
public const PURGE_COOKIE = "speed_hax_purge_cookie";
public const RECENT_COMMENTS = "speed_hax_recent_comments";
public const BIG_SEARCH = "speed_hax_big_search";
public const LIMIT_COMPLEX = "speed_hax_limit_complex";
public const FAST_PAGE_LIMIT = "speed_hax_fast_page_limit";
public const CACHE_FIRST_FEW = "speed_hax_cache_first_few";
public const RSS_LIMIT = "speed_hax_rss_limit";
}
13 changes: 0 additions & 13 deletions ext/speed_hax/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@

namespace Shimmie2;

abstract class SpeedHaxConfig
{
public const NO_AUTO_DB_UPGRADE = "speed_hax_no_auto_db_upgrade";
public const CACHE_EVENT_LISTENERS = "speed_hax_cache_listeners";
public const PURGE_COOKIE = "speed_hax_purge_cookie";
public const RECENT_COMMENTS = "speed_hax_recent_comments";
public const BIG_SEARCH = "speed_hax_big_search";
public const LIMIT_COMPLEX = "speed_hax_limit_complex";
public const FAST_PAGE_LIMIT = "speed_hax_fast_page_limit";
public const CACHE_FIRST_FEW = "speed_hax_cache_first_few";
public const RSS_LIMIT = "speed_hax_rss_limit";
}

class SpeedHax extends Extension
{
public function onInitExt(InitExtEvent $event): void
Expand Down
10 changes: 10 additions & 0 deletions ext/trash/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class TrashConfig extends ConfigGroup
{
public const VERSION = "ext_trash_version";
}
7 changes: 0 additions & 7 deletions ext/trash/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

namespace Shimmie2;

use function MicroHTML\rawHTML;

abstract class TrashConfig
{
public const VERSION = "ext_trash_version";
}

class Trash extends Extension
{
/** @var TrashTheme */
Expand Down
13 changes: 13 additions & 0 deletions ext/wiki/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Shimmie2;

class WikiConfig extends ConfigGroup
{
public const TAG_PAGE_TEMPLATE = "wiki_tag_page_template";
public const EMPTY_TAGINFO = "wiki_empty_taginfo";
public const TAG_SHORTWIKIS = "shortwikis_on_tags";
public const ENABLE_REVISIONS = "wiki_revisions";
}
8 changes: 0 additions & 8 deletions ext/wiki/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ public function exists(): bool
}
}

abstract class WikiConfig
{
public const TAG_PAGE_TEMPLATE = "wiki_tag_page_template";
public const EMPTY_TAGINFO = "wiki_empty_taginfo";
public const TAG_SHORTWIKIS = "shortwikis_on_tags";
public const ENABLE_REVISIONS = "wiki_revisions";
}

class Wiki extends Extension
{
/** @var WikiTheme */
Expand Down

0 comments on commit 70dd614

Please sign in to comment.