upgrade to Dotclear 2.28
This commit is contained in:
parent
b9c1e55c45
commit
619414e325
10 changed files with 121 additions and 138 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
CategoriesPage 1.3 - 2023.10.15
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
CategoriesPage 1.2 - 2023.08.06
|
CategoriesPage 1.2 - 2023.08.06
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
|
32
README.md
32
README.md
|
@ -1,25 +1,22 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-1.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/CategoriesPage/releases)
|
[![Release](https://img.shields.io/badge/release-1.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/CategoriesPage/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.06-c44d58.svg)](https://git.dotclear.watch/JcDenis/CategoriesPage/releases)
|
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/CategoriesPage)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/CategoriesPage)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/CategoriesPage)](https://git.dotclear.watch/JcDenis/CategoriesPage/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/CategoriesPage/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS CATEGORIESPAGE ?
|
## ABOUT
|
||||||
|
|
||||||
_CategoriesPage_ is a plugin for the open-source
|
_CategoriesPage_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
Add a public page to list blog categories.
|
> Add a public page to list blog categories. A widget is also available.
|
||||||
A widget is also available.
|
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_CategoriesPage_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1
|
||||||
* admin permissions
|
* admin permissions
|
||||||
* Dotclear 2.27
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
@ -31,14 +28,15 @@ default templates are on plugin directory CategoriesPage/default-templates/
|
||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/CategoriesPage/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/CategoriesPage) or [GitHub Page](https://github.com/JcDenis/CategoriesPage)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/CategoriesPage/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/CategoriesPage))
|
||||||
* Packages & details : [Gitea Page](https://git.dotclear.watch/JcDenis/CategoriesPage/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/CategoriesPage)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/CategoriesPage) (or on [GitHub](https://github.com/JcDenis/CategoriesPage))
|
||||||
|
* [Issues & security](https://git.dotclear.watch/JcDenis/CategoriesPage/issues) (or on [GitHub](https://github.com/JcDenis/CategoriesPage/issues))
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Pierre Van Glabeke
|
* Pierre Van Glabeke (author)
|
||||||
* Bernard Le Roux
|
* Bernard Le Roux
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (latest)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
24
_define.php
24
_define.php
|
@ -1,29 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin CategoriesPage definition
|
||||||
|
* @ingroup CategoriesPage
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup CategoriesPage Plugin CategoriesPage.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
* Add a public page for categories list.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
* @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')) {
|
declare(strict_types=1);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Categories Page',
|
'Categories Page',
|
||||||
'Add a public page for categories list',
|
'Add a public page for categories list',
|
||||||
'Pierre Van Glabeke, Bernard Le Roux and Contributors',
|
'Pierre Van Glabeke, Bernard Le Roux and Contributors',
|
||||||
'1.2',
|
'1.3',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcAuth::PERMISSION_ADMIN,
|
|
||||||
]),
|
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="CategoriesPage">
|
<module id="CategoriesPage">
|
||||||
<name>Categories Page</name>
|
<name>Categories Page</name>
|
||||||
<version>1.2</version>
|
<version>1.3</version>
|
||||||
<author>Pierre Van Glabeke, Bernard Le Roux and Contributors</author>
|
<author>Pierre Van Glabeke, Bernard Le Roux and Contributors</author>
|
||||||
<desc>Add a public page for categories list</desc>
|
<desc>Add a public page for categories list</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/CategoriesPage/releases/download/v1.2/plugin-CategoriesPage.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/CategoriesPage/releases/download/v1.3/plugin-CategoriesPage.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/CategoriesPage/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/CategoriesPage/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/CategoriesPage/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/CategoriesPage/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CategoriesPage backend class.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -30,9 +28,7 @@ class Backend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CategoriesPage frontend class.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Frontend extends Process
|
class Frontend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -31,19 +29,18 @@ class Frontend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehaviors([
|
||||||
// template path
|
// template path
|
||||||
'publicBeforeDocumentV2' => function (): void {
|
'publicBeforeDocumentV2' => function (): void {
|
||||||
// nullsafe PHP < 8.0
|
if (!App::blog()->isDefined()) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset');
|
$tplset = App::themes()->moduleInfo(App::blog()->settings()->get('system')->get('theme'), 'tplset');
|
||||||
if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
|
if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', DC_DEFAULT_TPLSET]));
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', App::config()->defaultTplset()]));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// breacrumb addon
|
// breacrumb addon
|
||||||
|
@ -51,15 +48,15 @@ class Frontend extends Process
|
||||||
return $context == 'categories' ? My::name() : '';
|
return $context == 'categories' ? My::name() : '';
|
||||||
},
|
},
|
||||||
// widget
|
// widget
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
'initWidgets' => Widgets::initWidgets(...),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// tpl values
|
// tpl values
|
||||||
dcCore::app()->tpl->addValue('CategoryCount', function (ArrayObject $attr): string {
|
App::frontend()->template()->addValue('CategoryCount', function (ArrayObject $attr): string {
|
||||||
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($attr), 'dcCore::app()->ctx->categories->nb_post') . '; ?>';
|
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($attr), 'App::frontend()->context()->categories->nb_post') . '; ?>';
|
||||||
});
|
});
|
||||||
dcCore::app()->tpl->addValue('CategoriesURL', function (ArrayObject $attr): string {
|
App::frontend()->template()->addValue('CategoriesURL', function (ArrayObject $attr): string {
|
||||||
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($attr), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("categories")') . '; ?>';
|
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($attr), 'App::blog()->url().App::url()->getBase("categories")') . '; ?>';
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
20
src/My.php
20
src/My.php
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
@ -17,8 +7,14 @@ namespace Dotclear\Plugin\CategoriesPage;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* @brief CategoriesPage My helper.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
|
// Use default permissions
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CategoriesPage prepend class.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Prepend extends Process
|
class Prepend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -30,11 +28,11 @@ class Prepend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->url->register(
|
App::url()->register(
|
||||||
'categories',
|
'categories',
|
||||||
'categories',
|
'categories',
|
||||||
'^categories$',
|
'^categories$',
|
||||||
[UrlHandler::class, 'categories']
|
UrlHandler::categories(...)
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
|
||||||
use dcUrlHandlers;
|
use Dotclear\Core\Frontend\Url;
|
||||||
|
|
||||||
class UrlHandler extends dcUrlHandlers
|
/**
|
||||||
|
* @brief CategoriesPage frontend URL handler class.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
class UrlHandler extends Url
|
||||||
{
|
{
|
||||||
public static function categories(?string $args): void
|
public static function categories(?string $args): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief CategoriesPage, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Van Glabeke, Bernard Le Roux and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\CategoriesPage;
|
namespace Dotclear\Plugin\CategoriesPage;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Plugin\widgets\WidgetsStack;
|
use Dotclear\Plugin\widgets\WidgetsStack;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CategoriesPage widgets class.
|
||||||
|
* @ingroup CategoriesPage
|
||||||
|
*
|
||||||
|
* @author Pierre Van Glabeke (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Widgets
|
class Widgets
|
||||||
{
|
{
|
||||||
public static function initWidgets(WidgetsStack $w): void
|
public static function initWidgets(WidgetsStack $w): void
|
||||||
|
@ -27,7 +25,7 @@ class Widgets
|
||||||
->create(
|
->create(
|
||||||
My::id(),
|
My::id(),
|
||||||
My::name(),
|
My::name(),
|
||||||
[self::class, 'parseWidget'],
|
self::parseWidget(...),
|
||||||
null,
|
null,
|
||||||
__('Link to categories')
|
__('Link to categories')
|
||||||
)
|
)
|
||||||
|
@ -40,12 +38,10 @@ class Widgets
|
||||||
|
|
||||||
public static function parseWidget(WidgetsElement $w): string
|
public static function parseWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
if ($w->offline
|
||||||
return '';
|
|| !$w->checkHomeOnly(App::url()->type)
|
||||||
}
|
|| !App::blog()->isDefined()
|
||||||
|
) {
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +50,7 @@ class Widgets
|
||||||
My::id() . ' ' . $w->class,
|
My::id() . ' ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
||||||
'<p><a href="' . dcCore::app()->blog->url . dcCore::app()->url->getBase('categories') . '">' .
|
'<p><a href="' . App::blog()->url() . App::url()->getBase('categories') . '">' .
|
||||||
($w->link_title ? Html::escapeHTML($w->link_title) : __('All categories')) .
|
($w->link_title ? Html::escapeHTML($w->link_title) : __('All categories')) .
|
||||||
'</a></p>'
|
'</a></p>'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue