Add PHPStan and other quality checks
Similar to FreshRSS core Contributes to https://github.com/FreshRSS/Extensions/issues/184
This commit is contained in:
parent
a86467db48
commit
b49596818c
59 changed files with 1173 additions and 404 deletions
|
|
@ -3,11 +3,14 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
class CustomJSExtension extends Minz_Extension {
|
||||
public function init() {
|
||||
public string $js_rules;
|
||||
public string $permission_problem = '';
|
||||
|
||||
public function init(): void {
|
||||
$this->registerTranslates();
|
||||
|
||||
$current_user = Minz_Session::paramString('currentUser');
|
||||
$filename = 'script.' . $current_user . '.js';
|
||||
$filename = 'script.' . $current_user . '.js';
|
||||
$filepath = join_path($this->getPath(), 'static', $filename);
|
||||
|
||||
if (file_exists($filepath)) {
|
||||
|
|
@ -15,28 +18,28 @@ class CustomJSExtension extends Minz_Extension {
|
|||
}
|
||||
}
|
||||
|
||||
public function handleConfigureAction() {
|
||||
public function handleConfigureAction(): void {
|
||||
$this->registerTranslates();
|
||||
|
||||
$current_user = Minz_Session::paramString('currentUser');
|
||||
$filename = 'script.' . $current_user . '.js';
|
||||
$filename = 'script.' . $current_user . '.js';
|
||||
$staticPath = join_path($this->getPath(), 'static');
|
||||
$filepath = join_path($staticPath, $filename);
|
||||
|
||||
if (!file_exists($filepath) && !is_writable($staticPath)) {
|
||||
$tmpPath = explode(EXTENSIONS_PATH . '/', $staticPath);
|
||||
$this->permission_problem = $tmpPath[1] . '/';
|
||||
} else if (file_exists($filepath) && !is_writable($filepath)) {
|
||||
} elseif (file_exists($filepath) && !is_writable($filepath)) {
|
||||
$tmpPath = explode(EXTENSIONS_PATH . '/', $filepath);
|
||||
$this->permission_problem = $tmpPath[1];
|
||||
} else if (Minz_Request::isPost()) {
|
||||
} elseif (Minz_Request::isPost()) {
|
||||
$js_rules = html_entity_decode(Minz_Request::paramString('js-rules'));
|
||||
file_put_contents($filepath, $js_rules);
|
||||
}
|
||||
|
||||
$this->js_rules = '';
|
||||
if (file_exists($filepath)) {
|
||||
$this->js_rules = htmlentities(file_get_contents($filepath));
|
||||
$this->js_rules = htmlentities(file_get_contents($filepath) ?: '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue