upgrade to Dotclear 2.28
This commit is contained in:
parent
a841033859
commit
f378ba1faa
8 changed files with 105 additions and 118 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
lastpostsExtend 2023.10.19
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
lastpostsExtend 2023.08.13
|
lastpostsExtend 2023.08.13
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
|
33
README.md
33
README.md
|
@ -1,25 +1,22 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.08.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases)
|
[![Release](https://img.shields.io/badge/release-2023.10.19-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases)
|
[![Date](https://img.shields.io/badge/date-2023.10.19-c44d58.svg)](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases)
|
||||||
[![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/lastpostsExtend)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/lastpostsExtend)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/lastpostsExtend)](https://git.dotclear.watch/JcDenis/lastpostsExtend/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/lastpostsExtend/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS LASTPOSTSEXTEND ?
|
## ABOUT
|
||||||
|
|
||||||
_lastpostsExtend_ "Last entries (Extended)" is a plugin for the open-source
|
_lastpostsExtend_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
Like widget lastposts but with more options.
|
> Same as widget lastposts but with more options.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_lastpostsExtend_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1
|
||||||
* permissions to manage widgets
|
* Dotclear permissions to manage widgets
|
||||||
* Dotclear 2.27
|
|
||||||
* PHP 7.4
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
@ -30,13 +27,15 @@ Add and configure "Last entries (Extended)" from widgets manager.
|
||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/lastpostsExtend/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/lastpostsExtend) or [GitHub Page](https://github.com/JcDenis/lastpostsExtend)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/lastpostsExtend))
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/lastpostsExtend/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/lastpostsExtend)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/lastpostsExtend) (or on [GitHub](https://github.com/JcDenis/lastpostsExtend))
|
||||||
|
* [Issues & security](https://git.dotclear.watch/JcDenis/lastpostsExtend/issues) (or on [GitHub](https://github.com/JcDenis/lastpostsExtend/issues))
|
||||||
|
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Chirstian Denis
|
* Jean-Chirstian Denis (author)
|
||||||
* Pierre Van Glabeke
|
* Pierre Van Glabeke
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
|
33
_define.php
33
_define.php
|
@ -1,32 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief lastpostsExtend, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin lastpostsExtend definition
|
||||||
|
* @ingroup lastpostsExtend
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup lastpostsExtend Plugin lastpostsExtend.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contributors
|
* Extended list of entries.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Jean-Christian Denis (author)
|
||||||
* @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(
|
||||||
'Last entries (Extended)',
|
'Last entries (Extended)',
|
||||||
'Extended list of entries',
|
'Extended list of entries',
|
||||||
'Jean-Christian Denis and contributors',
|
'Jean-Christian Denis and contributors',
|
||||||
'2023.08.13',
|
'2023.10.19',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcAuth::PERMISSION_ADMIN,
|
'type' => 'plugin',
|
||||||
]),
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'type' => 'plugin',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="lastpostsExtend">
|
<module id="lastpostsExtend">
|
||||||
<name>Last entries (Extended)</name>
|
<name>Last entries (Extended)</name>
|
||||||
<version>2023.08.13</version>
|
<version>2023.10.19</version>
|
||||||
<author>Jean-Christian Denis and contributors</author>
|
<author>Jean-Christian Denis and contributors</author>
|
||||||
<desc>Extended list of entries</desc>
|
<desc>Extended list of entries</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/lastpostsExtend/releases/download/v2023.08.13/plugin-lastpostsExtend.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/lastpostsExtend/releases/download/v2023.10.19/plugin-lastpostsExtend.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/lastpostsExtend/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/lastpostsExtend/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/lastpostsExtend/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/lastpostsExtend/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief lastpostsExtend backend class.
|
||||||
|
* @ingroup lastpostsExtend
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @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 +27,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,22 +1,19 @@
|
||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief lastpostsExtend frontend class.
|
||||||
|
* @ingroup lastpostsExtend
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @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
|
||||||
|
@ -30,9 +27,7 @@ class Frontend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
20
src/My.php
20
src/My.php
|
@ -1,21 +1,19 @@
|
||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief lastpostsExtend My helper.
|
||||||
|
* @ingroup lastpostsExtend
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @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,10 @@
|
||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\lastpostsExtend;
|
namespace Dotclear\Plugin\lastpostsExtend;
|
||||||
|
|
||||||
use dcBlog;
|
use Dotclear\App;
|
||||||
use dcCore;
|
|
||||||
use dcMeta;
|
|
||||||
use Dotclear\Helper\Date;
|
use Dotclear\Helper\Date;
|
||||||
use Dotclear\Helper\Text;
|
use Dotclear\Helper\Text;
|
||||||
use Dotclear\Helper\File\Path;
|
use Dotclear\Helper\File\Path;
|
||||||
|
@ -24,12 +12,18 @@ 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 lastpostsExtend widgets class.
|
||||||
|
* @ingroup lastpostsExtend
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @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
|
||||||
{
|
{
|
||||||
// nullsafe
|
if (!App::blog()->isDefined()) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +31,7 @@ class Widgets
|
||||||
$w->create(
|
$w->create(
|
||||||
'lastpostsextend',
|
'lastpostsextend',
|
||||||
__('Last entries (Extended)'),
|
__('Last entries (Extended)'),
|
||||||
[self::class, 'parseWidget'],
|
self::parseWidget(...),
|
||||||
null,
|
null,
|
||||||
__('Extended list of entries')
|
__('Extended list of entries')
|
||||||
);
|
);
|
||||||
|
@ -51,7 +45,7 @@ class Widgets
|
||||||
__('Gallery') => 'galitem',
|
__('Gallery') => 'galitem',
|
||||||
];
|
];
|
||||||
// plugin muppet types
|
// plugin muppet types
|
||||||
if (dcCore::app()->plugins->getDefine('muppet')->isDefined() && class_exists('\muppet')) {
|
if (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) {
|
||||||
|
@ -68,7 +62,7 @@ class Widgets
|
||||||
);
|
);
|
||||||
|
|
||||||
// Category (post and page have same category)
|
// Category (post and page have same category)
|
||||||
$rs = dcCore::app()->blog->getCategories([
|
$rs = App::blog()->getCategories([
|
||||||
'post_type' => 'post',
|
'post_type' => 'post',
|
||||||
]);
|
]);
|
||||||
$categories = [
|
$categories = [
|
||||||
|
@ -135,7 +129,7 @@ class Widgets
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tag
|
// Tag
|
||||||
if (dcCore::app()->plugins->moduleExists('tags')) {
|
if (App::plugins()->moduleExists('tags')) {
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
'tag',
|
'tag',
|
||||||
__('Limit to tags:'),
|
__('Limit to tags:'),
|
||||||
|
@ -234,7 +228,10 @@ 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()->blog) || $w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
if (!App::blog()->isDefined()
|
||||||
|
|| $w->offline
|
||||||
|
|| !$w->checkHomeOnly(App::url()->type)
|
||||||
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,19 +303,19 @@ class Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
if (dcCore::app()->plugins->moduleExists('tags') && $w->tag) {
|
if (App::plugins()->moduleExists('tags') && $w->tag) {
|
||||||
$tags = explode(',', $w->tag);
|
$tags = explode(',', $w->tag);
|
||||||
foreach ($tags as $i => $tag) {
|
foreach ($tags as $i => $tag) {
|
||||||
$tags[$i] = trim($tag);
|
$tags[$i] = trim($tag);
|
||||||
}
|
}
|
||||||
$params['from'] .= ', ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' META ';
|
$params['from'] .= ', ' . App::con()->prefix() . App::meta()::META_TABLE_NAME . ' META ';
|
||||||
$params['sql'] .= 'AND META.post_id = P.post_id ';
|
$params['sql'] .= 'AND META.post_id = P.post_id ';
|
||||||
$params['sql'] .= 'AND META.meta_id ' . dcCore::app()->con->in($tags) . ' ';
|
$params['sql'] .= 'AND META.meta_id ' . App::con()->in($tags) . ' ';
|
||||||
$params['sql'] .= "AND META.meta_type = 'tag' ";
|
$params['sql'] .= "AND META.meta_type = 'tag' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = dcCore::app()->auth->sudo(
|
$rs = App::auth()->sudo(
|
||||||
[dcCore::app()->blog, 'getPosts'],
|
App::blog()->getPosts(...),
|
||||||
$params,
|
$params,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -332,20 +329,20 @@ class Widgets
|
||||||
$res = $w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '';
|
$res = $w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '';
|
||||||
|
|
||||||
while ($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
if (is_null(dcCore::app()->blog)) { // phpstan ignores previous check !?
|
if (!App::blog()->isDefined()) { // phpstan ignores previous check !?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$published = ((int) $rs->f('post_status')) == dcBlog::POST_PUBLISHED;
|
$published = ((int) $rs->f('post_status')) == App::blog()::POST_PUBLISHED;
|
||||||
|
|
||||||
$res .= '<li>' .
|
$res .= '<li>' .
|
||||||
'<' . ($published ? 'a href="' . $rs->getURL() . '"' : 'span') .
|
'<' . ($published ? 'a href="' . $rs->getURL() . '"' : 'span') .
|
||||||
' title="' .
|
' title="' .
|
||||||
Date::dt2str(
|
Date::dt2str(
|
||||||
dcCore::app()->blog->settings->get('system')->get('date_format'),
|
App::blog()->settings()->get('system')->get('date_format'),
|
||||||
$rs->f('post_upddt')
|
$rs->f('post_upddt')
|
||||||
) . ', ' .
|
) . ', ' .
|
||||||
Date::dt2str(
|
Date::dt2str(
|
||||||
dcCore::app()->blog->settings->get('system')->get('time_format'),
|
App::blog()->settings()->get('system')->get('time_format'),
|
||||||
$rs->f('post_upddt')
|
$rs->f('post_upddt')
|
||||||
) . '">' .
|
) . '">' .
|
||||||
Html::escapeHTML($rs->f('post_title')) .
|
Html::escapeHTML($rs->f('post_title')) .
|
||||||
|
@ -369,9 +366,9 @@ class Widgets
|
||||||
if ($w->excerpt) {
|
if ($w->excerpt) {
|
||||||
$excerpt = $rs->f('post_excerpt');
|
$excerpt = $rs->f('post_excerpt');
|
||||||
if ($rs->f('post_format') == 'wiki') {
|
if ($rs->f('post_format') == 'wiki') {
|
||||||
dcCore::app()->initWikiComment();
|
App::filter()->initWikiComment();
|
||||||
$excerpt = dcCore::app()->wikiTransform($excerpt);
|
$excerpt = App::filter()->wikiTransform($excerpt);
|
||||||
$excerpt = dcCore::app()->HTMLfilter($excerpt);
|
$excerpt = App::filter()->HTMLfilter($excerpt);
|
||||||
}
|
}
|
||||||
if (strlen($excerpt) > 0) {
|
if (strlen($excerpt) > 0) {
|
||||||
$cut = Text::cutString(
|
$cut = Text::cutString(
|
||||||
|
@ -396,12 +393,12 @@ 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()->blog) || !in_array($type, ['post', 'page', 'galitem'])) {
|
if (!App::blog()->isDefined() || !in_array($type, ['post', 'page', 'galitem'])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = dcCore::app()->auth->sudo(
|
$rs = App::auth()->sudo(
|
||||||
[dcCore::app()->blog, 'getPosts'],
|
App::blog()->getPosts(...),
|
||||||
['post_id' => $id, 'post_type' => $type],
|
['post_id' => $id, 'post_type' => $type],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -414,13 +411,13 @@ class Widgets
|
||||||
$size = 's';
|
$size = 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
$p_url = (string) dcCore::app()->blog->settings->get('system')->get('public_url');
|
$p_url = (string) App::blog()->settings()->get('system')->get('public_url');
|
||||||
$p_site = (string) preg_replace(
|
$p_site = (string) preg_replace(
|
||||||
'#^(.+?//.+?)/(.*)$#',
|
'#^(.+?//.+?)/(.*)$#',
|
||||||
'$1',
|
'$1',
|
||||||
dcCore::app()->blog->url
|
App::blog()->url()
|
||||||
);
|
);
|
||||||
$p_root = dcCore::app()->blog->public_path;
|
$p_root = App::blog()->publicPath();
|
||||||
|
|
||||||
$pattern = '(?:' . preg_quote($p_site, '/') . ')?' . preg_quote($p_url, '/');
|
$pattern = '(?:' . preg_quote($p_site, '/') . ')?' . preg_quote($p_url, '/');
|
||||||
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu', $pattern);
|
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu', $pattern);
|
||||||
|
|
Loading…
Reference in a new issue