From 8b441a29893a3f6af8610f260b106c2cd1a97878 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Wed, 16 Nov 2022 23:03:38 +0100 Subject: [PATCH] prepare to DC 2.24 --- _admin.php | 51 +++++++++++++++-------------- _define.php | 24 ++++++++------ _install.php | 90 +++++++++++++++++++++++++++++----------------------- _public.php | 7 ++-- _widgets.php | 38 +++++++++++----------- 5 files changed, 111 insertions(+), 99 deletions(-) diff --git a/_admin.php b/_admin.php index d0a0ce8..674a3f8 100644 --- a/_admin.php +++ b/_admin.php @@ -1,10 +1,11 @@ addBehavior( - 'adminDashboardItems', +dcCore::app()->addBehavior( + 'adminDashboardItemsV2', ['dcLatestVersionsAdmin', 'adminDashboardItems'] ); -$core->addBehavior( - 'adminDashboardOptionsForm', +dcCore::app()->addBehavior( + 'adminDashboardOptionsFormV2', ['dcLatestVersionsAdmin', 'adminDashboardOptionsForm'] ); -$core->addBehavior( +dcCore::app()->addBehavior( 'adminAfterDashboardOptionsUpdate', ['dcLatestVersionsAdmin', 'adminAfterDashboardOptionsUpdate'] ); @@ -38,22 +39,21 @@ $core->addBehavior( */ class dcLatestVersionsAdmin { - public static function adminDashboardItems(dcCore $core, $__dashboard_items) + public static function adminDashboardItems($__dashboard_items) { - if (!$core->auth->user_prefs->dashboard->get('dcLatestVersionsItems')) { + if (!dcCore::app()->auth->user_prefs->dashboard->get('dcLatestVersionsItems')) { return null; } - $builds = explode(',', (string) $core->blog->settings->dcLatestVersions->builds); + $builds = explode(',', (string) dcCore::app()->blog->settings->dcLatestVersions->builds); if (empty($builds)) { return null; } $text = __('
  • %r : %v
  • '); - $li = []; - - foreach($builds as $build) { + $li = []; + foreach ($builds as $build) { $build = strtolower(trim($build)); if (empty($build)) { continue; @@ -74,12 +74,12 @@ class dcLatestVersionsAdmin [ '%r', '%v', - '%u' + '%u', ], [ $build, $updater->getVersion(), - $updater->getFileURL() + $updater->getFileURL(), ], $text ); @@ -88,27 +88,26 @@ class dcLatestVersionsAdmin if (empty($li)) { return null; } - + # Display - $__dashboard_items[0][] = - '
    ' . + $__dashboard_items[0][] = '
    ' . '

    ' . html::escapeHTML(__("Dotclear's latest versions")) . '

    ' . '
      ' . implode('', $li) . '
    ' . '
    '; } - public static function adminDashboardOptionsForm(dcCore $core) + public static function adminDashboardOptionsForm() { - if (!$core->auth->user_prefs->dashboard->prefExists('dcLatestVersionsItems')) { - $core->auth->user_prefs->dashboard->put( + if (!dcCore::app()->auth->user_prefs->dashboard->prefExists('dcLatestVersionsItems')) { + dcCore::app()->auth->user_prefs->dashboard->put( 'dcLatestVersionsItems', false, 'boolean' ); } - $pref = $core->auth->user_prefs->dashboard->get('dcLatestVersionsItems'); + $pref = dcCore::app()->auth->user_prefs->dashboard->get('dcLatestVersionsItems'); - echo + echo '
    ' . '

    ' . __("Dotclear's latest versions") . '

    ' . '

      %s
    ', implode('',$li)) + $w->content_only, + 'dclatestversionswidget ' . $w->class, + '', + ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . sprintf('
      %s
    ', implode('', $li)) ); } -} \ No newline at end of file +}