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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 14 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 20 additions & 19 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand All @@ -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 -->
Expand All @@ -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"/>
Expand All @@ -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 -->
Expand Down
1 change: 0 additions & 1 deletion xExtension-Captcha/Controllers/userController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ public function createAction(): void {
parent::createAction();
}
}

2 changes: 1 addition & 1 deletion xExtension-Captcha/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static function loadDependencies(): array {
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 = [
Expand Down
6 changes: 4 additions & 2 deletions xExtension-ImageProxy/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function handleConfigureAction(): void {
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();
Expand Down Expand Up @@ -143,7 +144,8 @@ public static function swapUris(string $content): string {
$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);
Expand Down
16 changes: 5 additions & 11 deletions xExtension-WordHighlighter/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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 = '';
Expand All @@ -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:
Expand All @@ -36,8 +35,7 @@ public function init(): void
}

#[\Override]
public function handleConfigureAction(): void
{
public function handleConfigureAction(): void {
$this->registerTranslates();

$current_user = Minz_Session::paramString('currentUser');
Expand All @@ -48,11 +46,9 @@ public function handleConfigureAction(): void
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'));

Expand Down Expand Up @@ -85,15 +81,13 @@ public function handleConfigureAction(): void
$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);";
Expand Down
Loading