fix nullsafe warnings

master
Jean-Christian Paul Denis 2023-04-22 14:32:04 +02:00
parent 867845f8fa
commit ba13d88082
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 12 additions and 8 deletions

View File

@ -41,7 +41,7 @@ class Backend extends dcNsProcess
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
$favs->register(My::id(), [
'title' => My::name(),
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
@ -56,9 +56,9 @@ class Backend extends dcNsProcess
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
My::name(),
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
preg_match('/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
dcCore::app()->auth?->isSuperAdmin()
);

View File

@ -28,8 +28,8 @@ use Dotclear\Helper\Html\Form\{
Text
};
use Dotclear\Helper\File\Path;
use Dotclear\Helper\Network\Http;
use Exception;
use http;
class Manage extends dcNsProcess
{
@ -79,7 +79,7 @@ class Manage extends dcNsProcess
dcPage::addSuccessNotice(
__('License successfully added.')
);
http::redirect(
Http::redirect(
empty($_POST['redir']) ?
dcCore::app()->admin->getPageURL() : $_POST['redir']
);
@ -212,7 +212,7 @@ class Manage extends dcNsProcess
{
if (!(dcCore::app()->themes instanceof dcThemes)) {
dcCore::app()->themes = new dcThemes();
dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path, null);
dcCore::app()->themes->loadModules((string) dcCore::app()->blog?->themes_path, null);
}
return [

View File

@ -34,6 +34,10 @@ class Utils
*/
public static function addLicense(array $module): void
{
if (is_null(dcCore::app()->auth)) {
return;
}
$s = Settings::init();
# --BEHAVIOR-- licenseBootstrapBeforeAddLicense
@ -237,7 +241,7 @@ class Utils
*/
protected static function replacePhpContent(string $content, string $license, bool $overwrite): string
{
$clean = preg_replace(
$clean = (string) preg_replace(
'/((# -- BEGIN LICENSE BLOCK ([-]+))(.*?)' .
'(# -- END LICENSE BLOCK ([-]+))([\n|\r\n]+))/msi',
'',
@ -248,7 +252,7 @@ class Utils
return $content;
}
return preg_replace(
return (string) preg_replace(
'/(\<\?php)/',
'<?php' .
"\r\n# -- BEGIN LICENSE BLOCK ----------------------------------\r\n" .