get_self_url: strip all trailing slashes
This commit is contained in:
parent
52180c9f8f
commit
94c49399cc
|
@ -293,6 +293,7 @@ class Article extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param int $id article id
|
||||||
* @return array{'formatted': string, 'entries': array<int, array<string, mixed>>}
|
* @return array{'formatted': string, 'entries': array<int, array<string, mixed>>}
|
||||||
*/
|
*/
|
||||||
static function _format_enclosures(int $id, bool $always_display_enclosures, string $article_content, bool $hide_images = false): array {
|
static function _format_enclosures(int $id, bool $always_display_enclosures, string $article_content, bool $hide_images = false): array {
|
||||||
|
|
|
@ -448,13 +448,7 @@ class Config {
|
||||||
|
|
||||||
/** this returns Config::SELF_URL_PATH sans trailing slash */
|
/** this returns Config::SELF_URL_PATH sans trailing slash */
|
||||||
static function get_self_url() : string {
|
static function get_self_url() : string {
|
||||||
$self_url_path = self::get(Config::SELF_URL_PATH);
|
return preg_replace("#/*$#", "", self::get(Config::SELF_URL_PATH));
|
||||||
|
|
||||||
if (substr($self_url_path, -1) === "/") {
|
|
||||||
return substr($self_url_path, 0, -1);
|
|
||||||
} else {
|
|
||||||
return $self_url_path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function is_server_https() : bool {
|
static function is_server_https() : bool {
|
||||||
|
|
|
@ -482,7 +482,7 @@ abstract class Plugin {
|
||||||
|
|
||||||
/** Invoked for every enclosure entry as article is being rendered
|
/** Invoked for every enclosure entry as article is being rendered
|
||||||
* @param array<string,string> $entry
|
* @param array<string,string> $entry
|
||||||
* @param int $id
|
* @param int $id article id
|
||||||
* @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv
|
* @param array{'formatted': string, 'entries': array<int, array<string, mixed>>} $rv
|
||||||
* @return array<string,string> ($entry)
|
* @return array<string,string> ($entry)
|
||||||
* @see PluginHost::HOOK_ENCLOSURE_ENTRY
|
* @see PluginHost::HOOK_ENCLOSURE_ENTRY
|
||||||
|
|
Loading…
Reference in New Issue