Skip to content

Commit

Permalink
Added feed_url param in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
clash82 committed Nov 27, 2024
1 parent 32f4734 commit e2f9044
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
11 changes: 7 additions & 4 deletions config/general.ini.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; Main page/channel title
; main page/channel title
title=

; Main page/channel description
; main page/channel description
description=

; Link to the home page included in the RSS channel
; link to the home page included in the RSS channel
link=

; Copyright value used in RSS channel
; copyright value used in RSS channel
copyright=

; RSS channel/page language (eg. `pl`)
Expand All @@ -28,3 +28,6 @@ limit=

; prefix used when generating item GUID (eg. `guid-`)
guid_prefix=

; if set then overrides default feed URL displayed on the bottom of the page
feed_url=
3 changes: 2 additions & 1 deletion src/lib/Provider/GeneralConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function __construct(string $filename)
(int) $ini['icon_height'],
$ini['date_format'],
(int) $ini['limit'],
$ini['guid_prefix']
$ini['guid_prefix'],
$ini['feed_url']
);
}

Expand Down
11 changes: 10 additions & 1 deletion src/lib/Value/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class General
{
public function __construct(private readonly string $title, private readonly string $description, private readonly string $link, private readonly string $language, private readonly string $copyright, private readonly string $icon, private readonly int $iconWidth, private readonly int $iconHeight, private readonly string $dateFormat, private readonly int $limit, private readonly string $guidPrefix)
public function __construct(private readonly string $title, private readonly string $description, private readonly string $link, private readonly string $language, private readonly string $copyright, private readonly string $icon, private readonly int $iconWidth, private readonly int $iconHeight, private readonly string $dateFormat, private readonly int $limit, private readonly string $guidPrefix, private readonly string $feedUrl)
{
}

Expand Down Expand Up @@ -70,6 +70,15 @@ public function getGuidPrefix(): string
return $this->guidPrefix;
}

public function getFeedUrl(): string
{
if (!empty($this->feedUrl)) {
return $this->feedUrl;
}

return '/?xml';
}

public function getCurrentHostname(): string
{
return sprintf(
Expand Down
2 changes: 1 addition & 1 deletion src/templates/page.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<footer class="row">
<div class="col-md-12">
Click <a href="/?xml">here</a> to subscribe this RSS channel
Click <a href="<?= $configuration->getFeedUrl() ?>">here</a> to subscribe this RSS channel
</div>
</footer>
</main>
Expand Down

0 comments on commit e2f9044

Please sign in to comment.