[core] named constant for nice urls
This commit is contained in:
parent
937cef38db
commit
4e362d816f
6 changed files with 9 additions and 8 deletions
|
@ -405,7 +405,7 @@ class Image implements \ArrayAccess
|
|||
$image_link = make_link($image_link);
|
||||
}
|
||||
$chosen = $image_link;
|
||||
} elseif ($config->get_bool('nice_urls', false)) {
|
||||
} elseif ($config->get_bool(SetupConfig::NICE_URLS, false)) {
|
||||
$chosen = make_link($nice);
|
||||
} else {
|
||||
$chosen = make_link($plain);
|
||||
|
|
|
@ -33,7 +33,7 @@ class UrlsTest extends TestCase
|
|||
|
||||
global $config;
|
||||
foreach([true, false] as $nice_urls) {
|
||||
$config->set_bool('nice_urls', $nice_urls);
|
||||
$config->set_bool(SetupConfig::NICE_URLS, $nice_urls);
|
||||
|
||||
$this->assertEquals(
|
||||
["bar", "foo"],
|
||||
|
@ -55,7 +55,7 @@ class UrlsTest extends TestCase
|
|||
{
|
||||
global $config;
|
||||
foreach([true, false] as $nice_urls) {
|
||||
$config->set_bool('nice_urls', $nice_urls);
|
||||
$config->set_bool(SetupConfig::NICE_URLS, $nice_urls);
|
||||
|
||||
// basic
|
||||
$this->assertEquals(
|
||||
|
@ -94,7 +94,7 @@ class UrlsTest extends TestCase
|
|||
{
|
||||
global $config;
|
||||
foreach([true, false] as $nice_urls) {
|
||||
$config->set_bool('nice_urls', $nice_urls);
|
||||
$config->set_bool(SetupConfig::NICE_URLS, $nice_urls);
|
||||
|
||||
$this->assertEquals(
|
||||
$nice_urls ? "/test/post/list/bar%20foo/1" : "/test/index.php?q=post/list/bar%20foo/1",
|
||||
|
@ -267,7 +267,7 @@ class UrlsTest extends TestCase
|
|||
public function tearDown(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_bool('nice_urls', true);
|
||||
$config->set_bool(SetupConfig::NICE_URLS, true);
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ function make_link(?string $page = null, ?string $query = null, ?string $fragmen
|
|||
|
||||
$parts = [];
|
||||
$install_dir = get_base_href();
|
||||
if (SPEED_HAX || $config->get_bool('nice_urls', false)) {
|
||||
if (SPEED_HAX || $config->get_bool(SetupConfig::NICE_URLS, false)) {
|
||||
$parts['path'] = "$install_dir/$page";
|
||||
} else {
|
||||
$parts['path'] = "$install_dir/index.php";
|
||||
|
|
|
@ -12,4 +12,5 @@ class SetupConfig
|
|||
public const THEME = "theme";
|
||||
public const WORD_WRAP = "word_wrap";
|
||||
public const COMMENT_CAPTCHA = "comment_captcha";
|
||||
public const NICE_URLS = "nice_urls";
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ class Setup extends Extension
|
|||
$sb->add_text_option("contact_link", "<br>Contact URL: ");
|
||||
$sb->add_choice_option(SetupConfig::THEME, $themes, "<br>Theme: ");
|
||||
//$sb->add_multichoice_option("testarray", array("a" => "b", "c" => "d"), "<br>Test Array: ");
|
||||
$sb->add_bool_option("nice_urls", "<br>Nice URLs: ");
|
||||
$sb->add_bool_option(SetupConfig::NICE_URLS, "<br>Nice URLs: ");
|
||||
$sb->add_label("<span id='nicetest'>(Javascript inactive, can't test!)</span>");
|
||||
|
||||
$sb = $event->panel->create_new_block("Remote API Integration");
|
||||
|
|
|
@ -161,7 +161,7 @@ class UploadTheme extends Themelet
|
|||
$title = $config->get_string(SetupConfig::TITLE);
|
||||
$max_size = $config->get_int(UploadConfig::SIZE);
|
||||
$max_kb = to_shorthand_int($max_size);
|
||||
$delimiter = $config->get_bool('nice_urls') ? '?' : '&';
|
||||
$delimiter = $config->get_bool(SetupConfig::NICE_URLS) ? '?' : '&';
|
||||
|
||||
$js = 'javascript:(
|
||||
function() {
|
||||
|
|
Reference in a new issue