upgrade to Dotclear 2.27
This commit is contained in:
parent
f04b2b8330
commit
9a829ea3f2
4 changed files with 32 additions and 15 deletions
|
@ -15,20 +15,18 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
class Backend extends dcNsProcess
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
return self::status(My::checkContext(My::BACKEND));
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,20 +15,18 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
class Frontend extends dcNsProcess
|
class Frontend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = true;
|
return self::status(My::checkContext(My::FRONTEND));
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
src/My.php
Normal file
21
src/My.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @brief lastpostsExtend, a plugin for Dotclear 2
|
||||||
|
*
|
||||||
|
* @package Dotclear
|
||||||
|
* @subpackage Plugin
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis and contributors
|
||||||
|
*
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
class My extends MyPlugin
|
||||||
|
{
|
||||||
|
}
|
|
@ -51,7 +51,7 @@ class Widgets
|
||||||
__('Gallery') => 'galitem',
|
__('Gallery') => 'galitem',
|
||||||
];
|
];
|
||||||
// plugin muppet types
|
// plugin muppet types
|
||||||
if (dcCore::app()->plugins->moduleExists('muppet') && class_exists('\muppet')) {
|
if (dcCore::app()->plugins->getDefine('muppet')->isDefined() && class_exists('\muppet')) {
|
||||||
$muppet_types = \muppet::getPostTypes();
|
$muppet_types = \muppet::getPostTypes();
|
||||||
if (is_array($muppet_types) && !empty($muppet_types)) {
|
if (is_array($muppet_types) && !empty($muppet_types)) {
|
||||||
foreach ($muppet_types as $k => $v) {
|
foreach ($muppet_types as $k => $v) {
|
||||||
|
@ -234,7 +234,7 @@ class Widgets
|
||||||
public static function parseWidget(WidgetsElement $w): string
|
public static function parseWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
// Widget is offline & Home page only
|
// Widget is offline & Home page only
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog) || $w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
if (is_null(dcCore::app()->blog) || $w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ class Widgets
|
||||||
|
|
||||||
private static function entryFirstImage(string $type, $id, string $size = 's'): string
|
private static function entryFirstImage(string $type, $id, string $size = 's'): string
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog) || !in_array($type, ['post', 'page', 'galitem'])) {
|
if (is_null(dcCore::app()->blog) || !in_array($type, ['post', 'page', 'galitem'])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue