Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions xExtension-YouTube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ With activated Youtube extension:

## Changelog

1.4.0:
- Added an option to disable embedding videos, e.g. to only use the channel icons and URL conversion

1.3.2:
- Fixed PHP warnings about HTML5 tags (such as `<figure>`) when displaying the feed content

Expand Down
7 changes: 7 additions & 0 deletions xExtension-YouTube/configure.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ declare(strict_types=1);
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
<div class="form-group">

<div class="group-controls">
<label class="checkbox" for="yt_embed_videos">
<input type="checkbox" id="yt_embed_videos" name="yt_embed_videos" <?= $this->isEmbedVideos() ? 'checked="checked"' : '' ?> />
<?= _t('ext.yt_videos.embed_videos') ?>
</label>
</div>

<div class="group-controls">
<label class="checkbox" for="yt_autosize">
<input type="checkbox" id="yt_autosize" name="yt_autosize" <?= $this->isAutoSize() ? 'checked="checked"' : '' ?> />
Expand Down
22 changes: 22 additions & 0 deletions xExtension-YouTube/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
final class YouTubeExtension extends Minz_Extension
{
/**
* Whether videos should be embedded in the article content
*/
private bool $embedVideos = true;
/**
* Whether the video player should use responsive sizing
*/
Expand Down Expand Up @@ -317,6 +321,11 @@ public function loadConfigValues(): void {
return;
}

$embedVideos = FreshRSS_Context::userConf()->attributeBool('yt_embed_videos');
if ($embedVideos !== null) {
$this->embedVideos = $embedVideos;
}

$autoSize = FreshRSS_Context::userConf()->attributeBool('yt_player_autosize');
if ($autoSize !== null) {
$this->autoSize = $autoSize;
Expand Down Expand Up @@ -348,6 +357,14 @@ public function loadConfigValues(): void {
}
}

/**
* Returns whether videos are embedded in the article content.
* You have to call loadConfigValues() before this one, otherwise you get the default value.
*/
public function isEmbedVideos(): bool {
return $this->embedVideos;
}

/**
* Returns whether responsive sizing is enabled for the video player iframe.
* You have to call loadConfigValues() before this one, otherwise you get the default value.
Expand Down Expand Up @@ -413,6 +430,10 @@ public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry {

$this->loadConfigValues();

if (!$this->embedVideos) {
return $entry;
}

if (stripos($entry->content(), '<iframe class="youtube-plugin-video"') !== false) {
return $entry;
}
Expand Down Expand Up @@ -588,6 +609,7 @@ public function handleConfigureAction(): void {
$this->resetAllIcons();
break;
}
FreshRSS_Context::userConf()->_attribute('yt_embed_videos', Minz_Request::paramBoolean('yt_embed_videos'));
FreshRSS_Context::userConf()->_attribute('yt_player_autosize', Minz_Request::paramBoolean('yt_autosize'));
FreshRSS_Context::userConf()->_attribute('yt_player_height', Minz_Request::paramInt('yt_height'));
FreshRSS_Context::userConf()->_attribute('yt_player_width', Minz_Request::paramInt('yt_width'));
Expand Down
1 change: 1 addition & 0 deletions xExtension-YouTube/i18n/de/ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return array(
'yt_videos' => array(
'embed_videos' => 'Videos in Artikel einbetten',
'autosize' => 'Automatische Größe des Players',
'height' => 'Höhe des Players',
'width' => 'Breite des Players',
Expand Down
1 change: 1 addition & 0 deletions xExtension-YouTube/i18n/en/ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return array(
'yt_videos' => array(
'embed_videos' => 'Embed videos in articles',
'autosize' => 'Automatically size the player',
'height' => 'Player height',
'width' => 'Player width',
Expand Down
1 change: 1 addition & 0 deletions xExtension-YouTube/i18n/fr/ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return array(
'yt_videos' => array(
'embed_videos' => 'Intégrer les vidéos dans les articles',
'autosize' => 'Taille automatique du lecteur',
'height' => 'Hauteur du lecteur',
'width' => 'Largeur du lecteur',
Expand Down
1 change: 1 addition & 0 deletions xExtension-YouTube/i18n/pl/ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return array(
'yt_videos' => array(
'embed_videos' => 'Osadzaj filmy w artykułach',
'autosize' => 'Automatyczny rozmiar odtwarzacza',
'height' => 'Wysokość odtwarzacza wideo',
'width' => 'Szerokość odtwarzacza wideo',
Expand Down
1 change: 1 addition & 0 deletions xExtension-YouTube/i18n/tr/ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return array(
'yt_videos' => array(
'embed_videos' => 'Videoları makalelere yerleştir',
'autosize' => 'Oynatıcıyı otomatik boyutlandır',
'height' => 'Oynatıcı yükseklik',
'width' => 'Oynatıcı genişlik',
Expand Down
2 changes: 1 addition & 1 deletion xExtension-YouTube/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "YouTube Video Feed",
"author": "Kevin Papst, Inverle",
"description": "Embed YouTube feeds inside article content.",
"version": "1.3.2",
"version": "1.4.0",
"entrypoint": "YouTube",
"type": "user"
}