upgrade to dotclear 2.28
This commit is contained in:
parent
a4111065bb
commit
aa7ec2d61d
8 changed files with 125 additions and 146 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
postInfoWidget 1.2 - 2023.10.20
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
postInfoWidget 1.1 - 2023.08.13
|
postInfoWidget 1.1 - 2023.08.13
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
|
34
README.md
34
README.md
|
@ -1,25 +1,22 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-1.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/postInfoWidget/releases)
|
[![Release](https://img.shields.io/badge/release-1.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/postInfoWidget/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/postInfoWidget/releases)
|
![Date](https://img.shields.io/badge/date-2023.10.20-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/postInfoWidget)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/postInfoWidget)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/postInfoWidget)](https://git.dotclear.watch/JcDenis/postInfoWidget/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/postInfoWidget/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS POSTINFOWIDGET ?
|
## ABOUT
|
||||||
|
|
||||||
_postInfoWidget_ "Entry information list" is a plugin for the open-source
|
_postInfoWidget_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
Show entry details in a widget.
|
> Show entry details in a widget.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_postInfoWidget_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1
|
||||||
* permissions to manage widgets
|
* Dotclear permissions to manage widgets
|
||||||
* Dotclear 2.26
|
|
||||||
* PHP 7.4
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
@ -30,14 +27,15 @@ Add and configure "Entry information list" 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/postInfoWidget/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/postInfoWidget) or [GitHub Page](https://github.com/JcDenis/postInfoWidget)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/postInfoWidget/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/postInfoWidget))
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/postInfoWidget/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postInfoWidget)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/postInfoWidget) (or on [GitHub](https://github.com/JcDenis/postInfoWidget))
|
||||||
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=332974#p332974)
|
* [Issues & security](https://git.dotclear.watch/JcDenis/postInfoWidget/issues) (or on [GitHub](https://github.com/JcDenis/postInfoWidget/issues))
|
||||||
|
* [Discuss & help](http://forum.dotclear.org/viewtopic.php?pid=332974#p332974)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (author)
|
||||||
* Pierre Van Glabeke
|
* Pierre Van Glabeke
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
|
24
_define.php
24
_define.php
|
@ -1,30 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief postInfoWidget, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin postInfoWidget definition
|
||||||
|
* @ingroup postInfoWidget
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup postInfoWidget Plugin postInfoWidget.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
* Show Entry informations on a widget.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author 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')) {
|
declare(strict_types=1);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Entry information list',
|
'Entry information list',
|
||||||
'Show Entry informations on a widget',
|
'Show Entry informations on a widget',
|
||||||
'Jean-Christian Denis, Pierre Van Glabeke',
|
'Jean-Christian Denis, Pierre Van Glabeke',
|
||||||
'1.1',
|
'1.2',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcAuth::PERMISSION_USAGE,
|
|
||||||
dcAuth::PERMISSION_CONTENT_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="postInfoWidget">
|
<module id="postInfoWidget">
|
||||||
<name>Entry information list</name>
|
<name>Entry information list</name>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
||||||
<desc>Show Entry informations on a widget</desc>
|
<desc>Show Entry informations on a widget</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/postInfoWidget/releases/download/v1.1/plugin-postInfoWidget.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/postInfoWidget/releases/download/v1.2/plugin-postInfoWidget.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/postInfoWidget/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/postInfoWidget/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/postInfoWidget/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/postInfoWidget/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief postInfoWidget, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
|
||||||
*
|
|
||||||
* @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\postInfoWidget;
|
namespace Dotclear\Plugin\postInfoWidget;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief postInfoWidget backend class.
|
||||||
|
* @ingroup postInfoWidget
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @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 postInfoWidget, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
|
||||||
*
|
|
||||||
* @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\postInfoWidget;
|
namespace Dotclear\Plugin\postInfoWidget;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief postInfoWidget frontend class.
|
||||||
|
* @ingroup postInfoWidget
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @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 postInfoWidget, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
|
||||||
*
|
|
||||||
* @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\postInfoWidget;
|
namespace Dotclear\Plugin\postInfoWidget;
|
||||||
|
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief postInfoWidget My helper.
|
||||||
|
* @ingroup postInfoWidget
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
|
// Use default permissions
|
||||||
}
|
}
|
||||||
|
|
121
src/Widgets.php
121
src/Widgets.php
|
@ -1,20 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief postInfoWidget, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
|
||||||
*
|
|
||||||
* @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\postInfoWidget;
|
namespace Dotclear\Plugin\postInfoWidget;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Database\MetaRecord;
|
use Dotclear\Database\MetaRecord;
|
||||||
use Dotclear\Helper\{
|
use Dotclear\Helper\{
|
||||||
Date,
|
Date,
|
||||||
|
@ -26,6 +16,13 @@ use Dotclear\Plugin\widgets\{
|
||||||
WidgetsElement
|
WidgetsElement
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief postInfoWidget widgets class.
|
||||||
|
* @ingroup postInfoWidget
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @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
|
||||||
|
@ -33,8 +30,8 @@ class Widgets
|
||||||
$w
|
$w
|
||||||
->create(
|
->create(
|
||||||
'postinfowidget',
|
'postinfowidget',
|
||||||
__('PostInfoWidget: entry information list'),
|
__('Entry information list'),
|
||||||
[self::class, 'publicWidget'],
|
self::publicWidget(...),
|
||||||
null,
|
null,
|
||||||
__('Show Entry informations on a widget')
|
__('Show Entry informations on a widget')
|
||||||
)
|
)
|
||||||
|
@ -76,7 +73,7 @@ class Widgets
|
||||||
'text'
|
'text'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dcCore::app()->plugins->moduleExists('tags')) {
|
if (App::plugins()->moduleExists('tags')) {
|
||||||
$w->__get('postinfowidget')->setting(
|
$w->__get('postinfowidget')->setting(
|
||||||
'tag_str',
|
'tag_str',
|
||||||
__('Tags text (%T = tags list):'),
|
__('Tags text (%T = tags list):'),
|
||||||
|
@ -173,7 +170,7 @@ class Widgets
|
||||||
);
|
);
|
||||||
//*/
|
//*/
|
||||||
# --BEHAVIOR-- postInfoWidgetAdmin
|
# --BEHAVIOR-- postInfoWidgetAdmin
|
||||||
dcCore::app()->callBehavior('postInfoWidgetAdmin', $w);
|
App::behavior()->callBehavior('postInfoWidgetAdmin', $w);
|
||||||
|
|
||||||
$w->__get('postinfowidget')
|
$w->__get('postinfowidget')
|
||||||
->addContentOnly()
|
->addContentOnly()
|
||||||
|
@ -183,14 +180,10 @@ class Widgets
|
||||||
|
|
||||||
public static function publicWidget(WidgetsElement $w): string
|
public static function publicWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
// nullsafe
|
if (!App::blog()->isDefined()
|
||||||
if (is_null(dcCore::app()->blog) || is_null(dcCore::app()->ctx)) {
|
|| $w->__get('offline')
|
||||||
return '';
|
|| App::url()->type != 'post'
|
||||||
}
|
|| !App::frontend()->context()->__get('posts')->f('post_id')
|
||||||
|
|
||||||
if ($w->__get('offline')
|
|
||||||
|| dcCore::app()->url->type != 'post'
|
|
||||||
|| !dcCore::app()->ctx->__get('posts')->f('post_id')
|
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -204,8 +197,8 @@ class Widgets
|
||||||
'date',
|
'date',
|
||||||
Date::str(
|
Date::str(
|
||||||
$w->__get('dt_str'),
|
$w->__get('dt_str'),
|
||||||
(int) strtotime(dcCore::app()->ctx->__get('posts')->f('post_dt')),
|
(int) strtotime(App::frontend()->context()->__get('posts')->f('post_dt')),
|
||||||
dcCore::app()->blog->settings->get('system')->get('blog_timezone')
|
App::blog()->settings()->get('system')->get('blog_timezone')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -216,8 +209,8 @@ class Widgets
|
||||||
'create',
|
'create',
|
||||||
Date::str(
|
Date::str(
|
||||||
$w->__get('creadt_str'),
|
$w->__get('creadt_str'),
|
||||||
(int) strtotime(dcCore::app()->ctx->__get('posts')->post_creadt),
|
(int) strtotime(App::frontend()->context()->__get('posts')->post_creadt),
|
||||||
dcCore::app()->blog->settings->get('system')->get('blog_timezone')
|
App::blog()->settings()->get('system')->get('blog_timezone')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -228,24 +221,24 @@ class Widgets
|
||||||
'update',
|
'update',
|
||||||
Date::str(
|
Date::str(
|
||||||
$w->__get('upddt_str'),
|
$w->__get('upddt_str'),
|
||||||
(int) strtotime(dcCore::app()->ctx->__get('posts')->f('post_upddt')),
|
(int) strtotime(App::frontend()->context()->__get('posts')->f('post_upddt')),
|
||||||
dcCore::app()->blog->settings->get('system')->get('blog_timezone')
|
App::blog()->settings()->get('system')->get('blog_timezone')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('lang_str') != '') {
|
if ($w->__get('lang_str') != '') {
|
||||||
$ln = L10n::getISOcodes();
|
$ln = L10n::getISOcodes();
|
||||||
$lang_code = dcCore::app()->ctx->__get('posts')->f('post_lang') ?
|
$lang_code = App::frontend()->context()->__get('posts')->f('post_lang') ?
|
||||||
dcCore::app()->ctx->__get('posts')->f('post_lang') :
|
App::frontend()->context()->__get('posts')->f('post_lang') :
|
||||||
dcCore::app()->blog->settings->get('system')->get('lang');
|
App::blog()->settings()->get('system')->get('lang');
|
||||||
$lang_name = $ln[$lang_code] ?? $lang_code;
|
$lang_name = $ln[$lang_code] ?? $lang_code;
|
||||||
$lang_flag = file_exists(
|
$lang_flag = file_exists(
|
||||||
dirname(__DIR__) .
|
dirname(__DIR__) .
|
||||||
'/img/flags/' .
|
'/img/flags/' .
|
||||||
$lang_code . '.png'
|
$lang_code . '.png'
|
||||||
) ?
|
) ?
|
||||||
'<img src="' . dcCore::app()->blog->getQmarkURL() .
|
'<img src="' . App::blog()->getQmarkURL() .
|
||||||
'pf=postInfoWidget/img/flags/' .
|
'pf=postInfoWidget/img/flags/' .
|
||||||
$lang_code . '.png" alt="' . $lang_name . '" />' :
|
$lang_code . '.png" alt="' . $lang_name . '" />' :
|
||||||
'';
|
'';
|
||||||
|
@ -267,13 +260,13 @@ class Widgets
|
||||||
'author',
|
'author',
|
||||||
str_replace(
|
str_replace(
|
||||||
'%T',
|
'%T',
|
||||||
dcCore::app()->ctx->__get('posts')->getAuthorLink(),
|
App::frontend()->context()->__get('posts')->getAuthorLink(),
|
||||||
Html::escapeHTML($w->__get('author_str'))
|
Html::escapeHTML($w->__get('author_str'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('category_str') != '' && dcCore::app()->ctx->__get('posts')->f('cat_id')) {
|
if ($w->__get('category_str') != '' && App::frontend()->context()->__get('posts')->f('cat_id')) {
|
||||||
$content .= self::li(
|
$content .= self::li(
|
||||||
$w,
|
$w,
|
||||||
'category',
|
'category',
|
||||||
|
@ -281,25 +274,25 @@ class Widgets
|
||||||
'%T',
|
'%T',
|
||||||
sprintf(
|
sprintf(
|
||||||
$link,
|
$link,
|
||||||
dcCore::app()->ctx->__get('posts')->__call('getCategoryURL', []),
|
App::frontend()->context()->__get('posts')->__call('getCategoryURL', []),
|
||||||
Html::escapeHTML(dcCore::app()->ctx->__get('posts')->f('cat_title'))
|
Html::escapeHTML(App::frontend()->context()->__get('posts')->f('cat_title'))
|
||||||
),
|
),
|
||||||
Html::escapeHTML($w->__get('category_str'))
|
Html::escapeHTML($w->__get('category_str'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('tag_str') != '' && dcCore::app()->plugins->moduleExists('tags')) {
|
if ($w->__get('tag_str') != '' && App::plugins()->moduleExists('tags')) {
|
||||||
$meta = dcCore::app()->meta->getMetadata([
|
$meta = App::meta()->getMetadata([
|
||||||
'meta_type' => 'tag',
|
'meta_type' => 'tag',
|
||||||
'post_id' => dcCore::app()->ctx->__get('posts')->f('post_id'),
|
'post_id' => App::frontend()->context()->__get('posts')->f('post_id'),
|
||||||
]);
|
]);
|
||||||
$metas = [];
|
$metas = [];
|
||||||
while ($meta->fetch()) {
|
while ($meta->fetch()) {
|
||||||
$metas[$meta->f('meta_id')] = sprintf(
|
$metas[$meta->f('meta_id')] = sprintf(
|
||||||
$link,
|
$link,
|
||||||
dcCore::app()->blog->url .
|
App::blog()->url() .
|
||||||
dcCore::app()->url->getBase('tag') . '/' .
|
App::url()->getBase('tag') . '/' .
|
||||||
rawurlencode($meta->f('meta_id')),
|
rawurlencode($meta->f('meta_id')),
|
||||||
$meta->f('meta_id')
|
$meta->f('meta_id')
|
||||||
);
|
);
|
||||||
|
@ -318,7 +311,7 @@ class Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('attachment_str') != '') {
|
if ($w->__get('attachment_str') != '') {
|
||||||
$nb = dcCore::app()->ctx->__get('posts')->__call('countMedia', []);
|
$nb = App::frontend()->context()->__get('posts')->__call('countMedia', []);
|
||||||
if ($nb == 0) {
|
if ($nb == 0) {
|
||||||
$attachment_numeric = 0;
|
$attachment_numeric = 0;
|
||||||
$attachment_textual = __('no attachment');
|
$attachment_textual = __('no attachment');
|
||||||
|
@ -357,8 +350,8 @@ class Widgets
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('comment_str') != '' && dcCore::app()->ctx->__get('posts')->__call('commentsActive', [])) {
|
if ($w->__get('comment_str') != '' && App::frontend()->context()->__get('posts')->__call('commentsActive', [])) {
|
||||||
$nb = (int) dcCore::app()->ctx->__get('posts')->f('nb_comment');
|
$nb = (int) App::frontend()->context()->__get('posts')->f('nb_comment');
|
||||||
if ($nb == 0) {
|
if ($nb == 0) {
|
||||||
$comment_numeric = 0;
|
$comment_numeric = 0;
|
||||||
$comment_textual = __('no comment');
|
$comment_textual = __('no comment');
|
||||||
|
@ -397,8 +390,8 @@ class Widgets
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('trackback_str') != '' && dcCore::app()->ctx->__get('posts')->__call('trackbacksActive', [])) {
|
if ($w->__get('trackback_str') != '' && App::frontend()->context()->__get('posts')->__call('trackbacksActive', [])) {
|
||||||
$nb = (int) dcCore::app()->ctx->__get('posts')->f('nb_trackback');
|
$nb = (int) App::frontend()->context()->__get('posts')->f('nb_trackback');
|
||||||
if ($nb == 0) {
|
if ($nb == 0) {
|
||||||
$trackback_numeric = 0;
|
$trackback_numeric = 0;
|
||||||
$trackback_textual = __('no trackback');
|
$trackback_textual = __('no trackback');
|
||||||
|
@ -446,26 +439,26 @@ class Widgets
|
||||||
[
|
[
|
||||||
sprintf(
|
sprintf(
|
||||||
$link,
|
$link,
|
||||||
dcCore::app()->ctx->__get('posts')->__call('getURL', []),
|
App::frontend()->context()->__get('posts')->__call('getURL', []),
|
||||||
__('Permalink')
|
__('Permalink')
|
||||||
),
|
),
|
||||||
dcCore::app()->ctx->__get('posts')->__call('getURL', []),
|
App::frontend()->context()->__get('posts')->__call('getURL', []),
|
||||||
],
|
],
|
||||||
Html::escapeHTML($w->__get('permalink_str'))
|
Html::escapeHTML($w->__get('permalink_str'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($w->__get('feed') && dcCore::app()->ctx->__get('posts')->__call('commentsActive', [])) {
|
if ($w->__get('feed') && App::frontend()->context()->__get('posts')->__call('commentsActive', [])) {
|
||||||
$content .= self::li(
|
$content .= self::li(
|
||||||
$w,
|
$w,
|
||||||
'feed',
|
'feed',
|
||||||
sprintf(
|
sprintf(
|
||||||
$link,
|
$link,
|
||||||
dcCore::app()->blog->url .
|
App::blog()->url() .
|
||||||
dcCore::app()->url->getBase('feed') .
|
App::url()->getBase('feed') .
|
||||||
'/atom/comments/' .
|
'/atom/comments/' .
|
||||||
dcCore::app()->ctx->__get('posts')->f('post_id'),
|
App::frontend()->context()->__get('posts')->f('post_id'),
|
||||||
__("This post's comments feed")
|
__("This post's comments feed")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -473,7 +466,7 @@ class Widgets
|
||||||
|
|
||||||
if ($w->__get('navprevpost')) {
|
if ($w->__get('navprevpost')) {
|
||||||
$npp = self::nav(
|
$npp = self::nav(
|
||||||
dcCore::app()->ctx->__get('posts'),
|
App::frontend()->context()->__get('posts'),
|
||||||
-1,
|
-1,
|
||||||
false,
|
false,
|
||||||
__('Previous entry'),
|
__('Previous entry'),
|
||||||
|
@ -489,7 +482,7 @@ class Widgets
|
||||||
}
|
}
|
||||||
if ($w->__get('navnextpost')) {
|
if ($w->__get('navnextpost')) {
|
||||||
$nnp = self::nav(
|
$nnp = self::nav(
|
||||||
dcCore::app()->ctx->__get('posts'),
|
App::frontend()->context()->__get('posts'),
|
||||||
1,
|
1,
|
||||||
false,
|
false,
|
||||||
__('Next entry'),
|
__('Next entry'),
|
||||||
|
@ -506,7 +499,7 @@ class Widgets
|
||||||
|
|
||||||
if ($w->__get('navprevcat')) {
|
if ($w->__get('navprevcat')) {
|
||||||
$npc = self::nav(
|
$npc = self::nav(
|
||||||
dcCore::app()->ctx->__get('posts'),
|
App::frontend()->context()->__get('posts'),
|
||||||
-1,
|
-1,
|
||||||
true,
|
true,
|
||||||
__('Previous entry of this category'),
|
__('Previous entry of this category'),
|
||||||
|
@ -523,7 +516,7 @@ class Widgets
|
||||||
|
|
||||||
if ($w->__get('navnextcat')) {
|
if ($w->__get('navnextcat')) {
|
||||||
$nnc = self::nav(
|
$nnc = self::nav(
|
||||||
dcCore::app()->ctx->__get('posts'),
|
App::frontend()->context()->__get('posts'),
|
||||||
1,
|
1,
|
||||||
true,
|
true,
|
||||||
__('Next entry of this category'),
|
__('Next entry of this category'),
|
||||||
|
@ -539,7 +532,7 @@ class Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- postInfoWidgetPublic
|
# --BEHAVIOR-- postInfoWidgetPublic
|
||||||
$content .= dcCore::app()->callBehavior('postInfoWidgetPublic', $w);
|
$content .= (string) App::behavior()->callBehavior('postInfoWidgetPublic', $w);
|
||||||
|
|
||||||
if (empty($content)) {
|
if (empty($content)) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -581,13 +574,12 @@ class Widgets
|
||||||
|
|
||||||
public static function li(WidgetsElement $w, string $i, string $c): string
|
public static function li(WidgetsElement $w, string $i, string $c): string
|
||||||
{
|
{
|
||||||
// nullsafe
|
if (!App::blog()->isDefined()) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = ' style="padding-left:%spx;background: transparent url(\'' .
|
$s = ' style="padding-left:%spx;background: transparent url(\'' .
|
||||||
dcCore::app()->blog->getQmarkURL() .
|
App::blog()->getQmarkURL() .
|
||||||
'pf=postInfoWidget/img/%s%s.png\') no-repeat left center;"';
|
'pf=postInfoWidget/img/%s%s.png\') no-repeat left center;"';
|
||||||
if ($w->__get('style') == 'small') {
|
if ($w->__get('style') == 'small') {
|
||||||
$s = sprintf($s, 16, $i, '-small');
|
$s = sprintf($s, 16, $i, '-small');
|
||||||
|
@ -603,12 +595,11 @@ class Widgets
|
||||||
|
|
||||||
public static function nav(MetaRecord $p, int $d, bool $r, string $t, string $c): string
|
public static function nav(MetaRecord $p, int $d, bool $r, string $t, string $c): string
|
||||||
{
|
{
|
||||||
// nullsafe
|
if (!App::blog()->isDefined()) {
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = dcCore::app()->blog->getNextPost($p, $d, $r);
|
$rs = App::blog()->getNextPost($p, $d, $r);
|
||||||
if (is_null($rs)) {
|
if (is_null($rs)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue