mirror of
https://github.com/FreshRSS/Extensions.git
synced 2026-11-04 10:48:40 +00:00
Upgrade to PHP_CodeSniffer 4 (#369)
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Version-4.0-User-Upgrade-Guide Related to https://github.com/FreshRSS/FreshRSS/pull/7993
This commit is contained in:
1 parent
217976cf07
commit
7e08d145b2
11 files changed
+73
-100
No files matched your search
+1
-1
@@ -51,7 +51,7 @@
|
||||
"ext-xmlwriter": "*",
|
||||
"phpstan/phpstan": "^2",
|
||||
"phpstan/phpstan-strict-rules": "^2",
|
||||
"squizlabs/php_codesniffer": "^3"
|
||||
"squizlabs/php_codesniffer": "^4"
|
||||
},
|
||||
"scripts": {
|
||||
"php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null",
|
||||
|
||||
Generated
+14
-19
@@ -4,21 +4,21 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "02054632764558c26a4fbecc0e408c09",
|
||||
"content-hash": "8a6dcc1afea2037b32149736705f192e",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.1.22",
|
||||
"version": "2.1.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4"
|
||||
"reference": "578fa296a166605d97b94091f724f1257185d278"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4",
|
||||
"reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/578fa296a166605d97b94091f724f1257185d278",
|
||||
"reference": "578fa296a166605d97b94091f724f1257185d278",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -63,7 +63,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-04T19:17:37+00:00"
|
||||
"time": "2025-09-19T08:58:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-strict-rules",
|
||||
@@ -115,37 +115,32 @@
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.13.2",
|
||||
"version": "4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
|
||||
"reference": "5b5e3821314f947dd040c70f7992a64eac89025c"
|
||||
"reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c",
|
||||
"reference": "5b5e3821314f947dd040c70f7992a64eac89025c",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/06113cfdaf117fc2165f9cd040bd0f17fcd5242d",
|
||||
"reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-simplexml": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": ">=5.4.0"
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
|
||||
"phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpcbf",
|
||||
"bin/phpcs"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
@@ -164,7 +159,7 @@
|
||||
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||
"description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.",
|
||||
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
@@ -195,7 +190,7 @@
|
||||
"type": "thanks_dev"
|
||||
}
|
||||
],
|
||||
"time": "2025-06-17T22:17:01+00:00"
|
||||
"time": "2025-09-15T11:28:58+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
<ruleset name="FreshRSS">
|
||||
<arg name="extensions" value="php,phtml"/>
|
||||
<arg name="tab-width" value="4"/>
|
||||
<exclude-pattern>./.git/</exclude-pattern>
|
||||
<exclude-pattern>./data/config.php</exclude-pattern>
|
||||
<exclude-pattern>./data/update.php</exclude-pattern>
|
||||
<exclude-pattern>./data/users/*/config.php</exclude-pattern>
|
||||
<exclude-pattern>./extensions/</exclude-pattern>
|
||||
<exclude-pattern>./lib/http-conditional.php</exclude-pattern>
|
||||
<exclude-pattern>./lib/marienfressinaud/</exclude-pattern>
|
||||
<exclude-pattern>./lib/phpgt/</exclude-pattern>
|
||||
<exclude-pattern>./lib/phpmailer/</exclude-pattern>
|
||||
<exclude-pattern>./lib/simplepie/</exclude-pattern>
|
||||
<exclude-pattern>./node_modules/</exclude-pattern>
|
||||
<exclude-pattern>./p/scripts/vendor/</exclude-pattern>
|
||||
<exclude-pattern>./vendor/</exclude-pattern>
|
||||
<exclude-pattern>/\.git/*</exclude-pattern>
|
||||
<exclude-pattern>/data/config.php</exclude-pattern>
|
||||
<exclude-pattern>/data/update.php</exclude-pattern>
|
||||
<exclude-pattern>/data/users/*/config.php</exclude-pattern>
|
||||
<exclude-pattern>/(?-i:extensions)/*</exclude-pattern><!-- Case sensitive to allow our Extensions repo -->
|
||||
<exclude-pattern>/lib/http-conditional.php</exclude-pattern>
|
||||
<exclude-pattern>/lib/marienfressinaud/</exclude-pattern>
|
||||
<exclude-pattern>/lib/phpgt/*</exclude-pattern>
|
||||
<exclude-pattern>/lib/phpmailer/*</exclude-pattern>
|
||||
<exclude-pattern>/lib/simplepie/*</exclude-pattern>
|
||||
<exclude-pattern>/node_modules/*</exclude-pattern>
|
||||
<exclude-pattern>/p/scripts/vendor/*</exclude-pattern>
|
||||
<exclude-pattern>/vendor/*</exclude-pattern>
|
||||
<!-- Additional exclusions for Extensions: -->
|
||||
<exclude-pattern>./symbolic/</exclude-pattern>
|
||||
<exclude-pattern>./third-party/</exclude-pattern>
|
||||
<exclude-pattern>./tmp/</exclude-pattern>
|
||||
<exclude-pattern>/symbolic/*</exclude-pattern>
|
||||
<exclude-pattern>/third-party/*</exclude-pattern>
|
||||
<exclude-pattern>/tmp/*</exclude-pattern>
|
||||
<rule ref="PSR12">
|
||||
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
|
||||
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
|
||||
@@ -33,7 +33,8 @@
|
||||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/>
|
||||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR12.Files.FileHeader.IncorrectOrder"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR12.Files.FileHeader.SpacingAfterDeclareBlock"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR12.Files.FileHeader.SpacingAfterTagBlock"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR12.Traits.UseDeclaration.MultipleImport"/>
|
||||
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/><!-- Consider using PSR12 defaults instead -->
|
||||
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/><!-- Consider using PSR12 defaults instead -->
|
||||
@@ -45,7 +46,7 @@
|
||||
<exclude name="PSR2.Methods.FunctionCallSignature.Indent"/>
|
||||
<exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/>
|
||||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
|
||||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
|
||||
<exclude name="Squiz.Classes.ValidClassName.NotPascalCase"/>
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine"/>
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace"/>
|
||||
@@ -64,7 +65,7 @@
|
||||
<property name="lineLimit" value="165"/>
|
||||
<property name="absoluteLineLimit" value="190"/>
|
||||
</properties>
|
||||
<exclude-pattern>/app/i18n/*\.php$</exclude-pattern>
|
||||
<exclude-pattern>/i18n/*\.php$</exclude-pattern>
|
||||
<exclude-pattern>*\.phtml$</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/><!-- Consider using PSR12 defaults instead -->
|
||||
|
||||
@@ -16,4 +16,3 @@ class FreshExtension_user_Controller extends FreshRSS_user_Controller {
|
||||
parent::createAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ final class CaptchaExtension extends Minz_Extension {
|
||||
if ($csp_hosts === 'https://www.google.com') {
|
||||
// Original js_url injects script from www.gstatic.com therefore this is needed
|
||||
$csp_hosts .= "/recaptcha/api.js https://www.gstatic.com/recaptcha/";
|
||||
} else if ($csp_hosts === 'https://js.hcaptcha.com') {
|
||||
} elseif ($csp_hosts === 'https://js.hcaptcha.com') {
|
||||
$csp_hosts = 'https://hcaptcha.com https://*.hcaptcha.com';
|
||||
}
|
||||
$csp = [
|
||||
|
||||
@@ -62,7 +62,8 @@ final class ImageProxyExtension extends Minz_Extension {
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_url', Minz_Request::paramString('image_proxy_url', plaintext: true) ?: self::PROXY_URL);
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_http', Minz_Request::paramBoolean('image_proxy_scheme_http'));
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_https', Minz_Request::paramBoolean('image_proxy_scheme_https'));
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_default', Minz_Request::paramString('image_proxy_scheme_default', plaintext: true) ?: self::SCHEME_DEFAULT);
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_default',
|
||||
Minz_Request::paramString('image_proxy_scheme_default', plaintext: true) ?: self::SCHEME_DEFAULT);
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_include', Minz_Request::paramBoolean('image_proxy_scheme_include'));
|
||||
FreshRSS_Context::userConf()->_attribute('image_proxy_url_encode', Minz_Request::paramBoolean('image_proxy_url_encode'));
|
||||
FreshRSS_Context::userConf()->save();
|
||||
@@ -143,7 +144,8 @@ final class ImageProxyExtension extends Minz_Extension {
|
||||
$newSrc = self::getProxyImageUri($src);
|
||||
/*
|
||||
Due to the URL change, FreshRSS is not aware of already rendered enclosures.
|
||||
Adding data-xextension-imageproxy-original-src / srcset ensures that original URLs are present in the content for the renderer check FreshRSS_Entry->containsLink.
|
||||
Adding data-xextension-imageproxy-original-src / srcset ensures that
|
||||
original URLs are present in the content for the renderer check FreshRSS_Entry->containsLink.
|
||||
*/
|
||||
$img->setAttribute('data-xextension-imageproxy-original-src', $src);
|
||||
$img->setAttribute('src', $newSrc);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
final class WordHighlighterExtension extends Minz_Extension
|
||||
{
|
||||
const JSON_ENCODE_CONF = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
|
||||
private const JSON_ENCODE_CONF = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR;
|
||||
|
||||
public string $word_highlighter_conf = 'test';
|
||||
public string $permission_problem = '';
|
||||
@@ -14,8 +14,7 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||
public bool $separate_word_search = false;
|
||||
|
||||
#[\Override]
|
||||
public function init(): void
|
||||
{
|
||||
public function init(): void {
|
||||
$this->registerTranslates();
|
||||
|
||||
// register CSS for WordHighlighter:
|
||||
@@ -36,8 +35,7 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function handleConfigureAction(): void
|
||||
{
|
||||
public function handleConfigureAction(): void {
|
||||
$this->registerTranslates();
|
||||
|
||||
$current_user = Minz_Session::paramString('currentUser');
|
||||
@@ -48,11 +46,9 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||
if (!file_exists($configFileJson) && !is_writable($staticPath)) {
|
||||
$tmpPath = explode(EXTENSIONS_PATH . '/', $staticPath);
|
||||
$this->permission_problem = $tmpPath[1] . '/';
|
||||
|
||||
} elseif (file_exists($configFileJson) && !is_writable($configFileJson)) {
|
||||
$tmpPath = explode(EXTENSIONS_PATH . '/', $configFileJson);
|
||||
$this->permission_problem = $tmpPath[1];
|
||||
|
||||
} elseif (Minz_Request::isPost()) {
|
||||
$configWordList = html_entity_decode(Minz_Request::paramString('words_list'));
|
||||
|
||||
@@ -85,15 +81,13 @@ final class WordHighlighterExtension extends Minz_Extension
|
||||
$this->case_sensitive = (bool) ($confJson['case_sensitive'] ?? false);
|
||||
$this->separate_word_search = (bool) ($confJson['separate_word_search'] ?? false);
|
||||
$this->word_highlighter_conf = implode("\n", (array) ($confJson['words'] ?? []));
|
||||
|
||||
} catch (Exception $exception) {
|
||||
} catch (Exception $exception) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
// probably nothing to do needed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function jsonToJs(string $jsonStr): string
|
||||
{
|
||||
private function jsonToJs(string $jsonStr): string {
|
||||
$js = "window.WordHighlighterConf = " .
|
||||
$jsonStr . ";\n" .
|
||||
"window.WordHighlighterConf.enable_logs && console.log('WordHighlighter: loaded user config:', window.WordHighlighterConf);";
|
||||
|
||||
@@ -34,8 +34,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Initialize this extension
|
||||
*/
|
||||
#[\Override]
|
||||
public function init(): void
|
||||
{
|
||||
public function init(): void {
|
||||
$this->registerHook('entry_before_display', [$this, 'embedYouTubeVideo']);
|
||||
$this->registerHook('check_url_before_add', [self::class, 'convertYoutubeFeedUrl']);
|
||||
$this->registerHook('custom_favicon_hash', [$this, 'iconHashParams']);
|
||||
@@ -289,8 +288,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
return $feed;
|
||||
}
|
||||
|
||||
public static function convertYoutubeFeedUrl(string $url): string
|
||||
{
|
||||
public static function convertYoutubeFeedUrl(string $url): string {
|
||||
$matches = [];
|
||||
|
||||
if (preg_match('#^https?://www\.youtube\.com/channel/([0-9a-zA-Z_-]{6,36})#', $url, $matches) === 1) {
|
||||
@@ -309,8 +307,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Do not call that in your extensions init() method, it can't be used there.
|
||||
* @throws FreshRSS_Context_Exception
|
||||
*/
|
||||
public function loadConfigValues(): void
|
||||
{
|
||||
public function loadConfigValues(): void {
|
||||
if (!class_exists('FreshRSS_Context', false) || !FreshRSS_Context::hasUserConf()) {
|
||||
return;
|
||||
}
|
||||
@@ -345,8 +342,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Returns the width in pixel for the YouTube player iframe.
|
||||
* You have to call loadConfigValues() before this one, otherwise you get default values.
|
||||
*/
|
||||
public function getWidth(): int
|
||||
{
|
||||
public function getWidth(): int {
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
@@ -354,8 +350,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Returns the height in pixel for the YouTube player iframe.
|
||||
* You have to call loadConfigValues() before this one, otherwise you get default values.
|
||||
*/
|
||||
public function getHeight(): int
|
||||
{
|
||||
public function getHeight(): int {
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
@@ -363,8 +358,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Returns whether this extension displays the content of the YouTube feed.
|
||||
* You have to call loadConfigValues() before this one, otherwise you get default values.
|
||||
*/
|
||||
public function isShowContent(): bool
|
||||
{
|
||||
public function isShowContent(): bool {
|
||||
return $this->showContent;
|
||||
}
|
||||
|
||||
@@ -372,8 +366,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Returns whether the automatic icon download option is enabled.
|
||||
* You have to call loadConfigValues() before this one, otherwise you get default values.
|
||||
*/
|
||||
public function isDownloadIcons(): bool
|
||||
{
|
||||
public function isDownloadIcons(): bool {
|
||||
return $this->downloadIcons;
|
||||
}
|
||||
|
||||
@@ -381,8 +374,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Returns if this extension should use youtube-nocookie.com instead of youtube.com.
|
||||
* You have to call loadConfigValues() before this one, otherwise you get default values.
|
||||
*/
|
||||
public function isUseNoCookieDomain(): bool
|
||||
{
|
||||
public function isUseNoCookieDomain(): bool {
|
||||
return $this->useNoCookie;
|
||||
}
|
||||
|
||||
@@ -390,8 +382,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* Inserts the YouTube video iframe into the content of an entry, if the entries link points to a YouTube watch URL.
|
||||
* @throws FreshRSS_Context_Exception
|
||||
*/
|
||||
public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry
|
||||
{
|
||||
public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry {
|
||||
$link = $entry->link();
|
||||
|
||||
if ($this->isShort($link)) {
|
||||
@@ -410,8 +401,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
|
||||
if (stripos($link, 'www.youtube.com/watch?v=') !== false) {
|
||||
$html = $this->getHtmlContentForLink($entry, $link);
|
||||
}
|
||||
else { //peertube
|
||||
} else { //peertube
|
||||
$html = $this->getHtmlPeerTubeContentForLink($entry, $link);
|
||||
}
|
||||
|
||||
@@ -422,13 +412,12 @@ final class YouTubeExtension extends Minz_Extension
|
||||
/**
|
||||
* Returns an HTML <iframe> for a given Youtube watch URL (www.youtube.com/watch?v=)
|
||||
*/
|
||||
public function getHtmlContentForLink(FreshRSS_Entry $entry, string $link): string
|
||||
{
|
||||
public function getHtmlContentForLink(FreshRSS_Entry $entry, string $link): string {
|
||||
$domain = 'www.youtube.com';
|
||||
if ($this->useNoCookie) {
|
||||
$domain = 'www.youtube-nocookie.com';
|
||||
}
|
||||
$url = str_replace('//www.youtube.com/watch?v=', '//'.$domain.'/embed/', $link);
|
||||
$url = str_replace('//www.youtube.com/watch?v=', '//' . $domain . '/embed/', $link);
|
||||
$url = str_replace('http://', 'https://', $url);
|
||||
|
||||
return $this->getHtml($entry, $url);
|
||||
@@ -437,8 +426,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
/**
|
||||
* Returns an HTML <iframe> for a given PeerTube watch URL
|
||||
*/
|
||||
public function getHtmlPeerTubeContentForLink(FreshRSS_Entry $entry, string $link): string
|
||||
{
|
||||
public function getHtmlPeerTubeContentForLink(FreshRSS_Entry $entry, string $link): string {
|
||||
$url = str_replace('/watch', '/embed', $link);
|
||||
|
||||
return $this->getHtml($entry, $url);
|
||||
@@ -447,8 +435,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
/**
|
||||
* Returns an HTML <iframe> for a given URL for the configured width and height, with content ignored, appended or formatted.
|
||||
*/
|
||||
public function getHtml(FreshRSS_Entry $entry, string $url): string
|
||||
{
|
||||
public function getHtml(FreshRSS_Entry $entry, string $url): string {
|
||||
$content = '';
|
||||
|
||||
$iframe = '<iframe class="youtube-plugin-video"
|
||||
@@ -465,8 +452,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
$doc->recover = true;
|
||||
$doc->strictErrorChecking = false;
|
||||
|
||||
if ($doc->loadHTML('<?xml encoding="utf-8" ?>' . $entry->content()))
|
||||
{
|
||||
if ($doc->loadHTML('<?xml encoding="utf-8" ?>' . $entry->content())) {
|
||||
$xpath = new DOMXPath($doc);
|
||||
|
||||
/** @var DOMNodeList<DOMElement> $titles */
|
||||
@@ -494,16 +480,15 @@ final class YouTubeExtension extends Minz_Extension
|
||||
$content .= $iframe;
|
||||
|
||||
if ($descriptions->length > 0 && $descriptions[0] instanceof DOMNode) {
|
||||
$content .= '<p class="enclosure-description">' . nl2br(htmlspecialchars($descriptions[0]->nodeValue ?? '', ENT_COMPAT, 'UTF-8'), use_xhtml: true) . '</p>';
|
||||
$content .= '<p class="enclosure-description">' .
|
||||
nl2br(htmlspecialchars($descriptions[0]->nodeValue ?? '', ENT_COMPAT, 'UTF-8'), use_xhtml: true) . '</p>';
|
||||
}
|
||||
|
||||
$content .= "</div>\n";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content = $iframe . $entry->content();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content = $iframe;
|
||||
}
|
||||
|
||||
@@ -521,8 +506,7 @@ final class YouTubeExtension extends Minz_Extension
|
||||
* @throws Minz_PermissionDeniedException
|
||||
*/
|
||||
#[\Override]
|
||||
public function handleConfigureAction(): void
|
||||
{
|
||||
public function handleConfigureAction(): void {
|
||||
$this->registerTranslates();
|
||||
|
||||
if (Minz_Request::isPost()) {
|
||||
|
||||
@@ -13,4 +13,3 @@ return array(
|
||||
'use_nocookie' => 'Używaj domeny bez ciasteczek www.youtube-nocookie.com',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'showfeedid' => array(
|
||||
'show' => 'Show IDs',
|
||||
'hide' => 'Hide IDs',
|
||||
),
|
||||
'showfeedid' => array(
|
||||
'show' => 'Show IDs',
|
||||
'hide' => 'Hide IDs',
|
||||
),
|
||||
);
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'showfeedid' => array(
|
||||
'show' => 'Pokaż ID',
|
||||
'hide' => 'Ukryj ID',
|
||||
),
|
||||
'showfeedid' => array(
|
||||
'show' => 'Pokaż ID',
|
||||
'hide' => 'Ukryj ID',
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user