TagCategories config constant
This commit is contained in:
parent
dd6c3b2321
commit
7d110f11b6
8
ext/tag_categories/config.php
Normal file
8
ext/tag_categories/config.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class TagCategoriesConfig
|
||||||
|
{
|
||||||
|
public const VERSION = "ext_tag_categories_version";
|
||||||
|
|
||||||
|
public const SPLIT_ON_VIEW = "tag_categories_split_on_view";
|
||||||
|
}
|
@ -6,6 +6,8 @@
|
|||||||
* Description: Let tags be split into 'categories', like Danbooru's tagging
|
* Description: Let tags be split into 'categories', like Danbooru's tagging
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once "config.php";
|
||||||
|
|
||||||
class TagCategories extends Extension
|
class TagCategories extends Extension
|
||||||
{
|
{
|
||||||
public function onInitExt(InitExtEvent $event)
|
public function onInitExt(InitExtEvent $event)
|
||||||
@ -14,9 +16,9 @@ class TagCategories extends Extension
|
|||||||
|
|
||||||
// whether we split out separate categories on post view by default
|
// whether we split out separate categories on post view by default
|
||||||
// note: only takes effect if /post/view shows the image's exact tags
|
// note: only takes effect if /post/view shows the image's exact tags
|
||||||
$config->set_default_bool("tag_categories_split_on_view", true);
|
$config->set_default_bool(TagCategoriesConfig::SPLIT_ON_VIEW, true);
|
||||||
|
|
||||||
if ($config->get_int("ext_tag_categories_version") < 1) {
|
if ($config->get_int(TagCategoriesConfig::VERSION) < 1) {
|
||||||
// primary extension database, holds all our stuff!
|
// primary extension database, holds all our stuff!
|
||||||
$database->create_table(
|
$database->create_table(
|
||||||
'image_tag_categories',
|
'image_tag_categories',
|
||||||
@ -26,7 +28,7 @@ class TagCategories extends Extension
|
|||||||
color VARCHAR(7)'
|
color VARCHAR(7)'
|
||||||
);
|
);
|
||||||
|
|
||||||
$config->set_int("ext_tag_categories_version", 1);
|
$config->set_int(TagCategoriesConfig::VERSION, 1);
|
||||||
|
|
||||||
log_info("tag_categories", "extension installed");
|
log_info("tag_categories", "extension installed");
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class TagList extends Extension
|
|||||||
if ($config->get_string('tag_list_image_type') == 'related') {
|
if ($config->get_string('tag_list_image_type') == 'related') {
|
||||||
$this->add_related_block($page, $event->image);
|
$this->add_related_block($page, $event->image);
|
||||||
} else {
|
} else {
|
||||||
if (class_exists("TagCategories") and $config->get_bool('tag_categories_split_on_view')) {
|
if (class_exists("TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
|
||||||
$this->add_split_tags_block($page, $event->image);
|
$this->add_split_tags_block($page, $event->image);
|
||||||
} else {
|
} else {
|
||||||
$this->add_tags_block($page, $event->image);
|
$this->add_tags_block($page, $event->image);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user