use abstract plugin name, fix phpstan error

This commit is contained in:
Jean-Christian Denis 2022-12-20 22:18:58 +01:00
parent 67c433ee20
commit 946d2b6fc8
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 17 additions and 27 deletions

View file

@ -7,7 +7,7 @@
* *
* @author Jean-Christian Denis, Pierre Van Glabeke * @author Jean-Christian Denis, Pierre Van Glabeke
* *
* @copyright Jean-Crhistian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
@ -21,12 +21,11 @@ dcCore::app()->addBehavior('adminDashboardItemsV2', function($__dashboard_items)
return null; return null;
} }
$builds = explode(',', (string) dcCore::app()->blog->settings->dcLatestVersions->builds); $builds = explode(',', (string) dcCore::app()->blog->settings->get(basename(__DIR__))->get('builds'));
if (empty($builds)) { if (empty($builds[0])) {
return null; return null;
} }
$text = __('<li><a href="%u" title="Download Dotclear %v">%r</a> : %v</li>');
$li = []; $li = [];
foreach ($builds as $build) { foreach ($builds as $build) {
@ -46,18 +45,12 @@ dcCore::app()->addBehavior('adminDashboardItemsV2', function($__dashboard_items)
continue; continue;
} }
$li[] = str_replace( $li[] = sprintf(
[ '<li><a href="%1$s" title="%2$s">%3$s</a> : %4$s</li>',
'%r',
'%v',
'%u',
],
[
$build,
$updater->getVersion(),
$updater->getFileURL(), $updater->getFileURL(),
], sprintf(__('Download Dotclear %s'), $updater->getVersion()),
$text $build,
$updater->getVersion()
); );
} }

View file

@ -7,14 +7,14 @@
* *
* @author Jean-Christian Denis, Pierre Van Glabeke * @author Jean-Christian Denis, Pierre Van Glabeke
* *
* @copyright Jean-Crhistian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }
dcCore::app()->blog->settings->addNamespace('dcLatestVersions'); dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
dcCore::app()->addBehavior( dcCore::app()->addBehavior(
'initWidgets', 'initWidgets',
@ -55,8 +55,6 @@ class dcLatestVersionsWidget
public static function publicWidget($w) public static function publicWidget($w)
{ {
dcCore::app()->blog->settings->addNamespace('dcLatestVersions');
if ($w->offline) { if ($w->offline) {
return null; return null;
} }
@ -66,9 +64,8 @@ class dcLatestVersionsWidget
} }
# Builds to check # Builds to check
$builds = (string) dcCore::app()->blog->settings->dcLatestVersions->builds; $builds = explode(',', (string) dcCore::app()->blog->settings->get(basename(__DIR__))->get('builds'));
$builds = explode(',', $builds); if (empty($builds[0])) {
if (empty($builds)) {
return null; return null;
} }