upgrade to Dotclear 2.28

This commit is contained in:
Jean-Christian Paul Denis 2023-10-19 21:39:07 +02:00
parent 54d29c0a0f
commit d408637db2
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
8 changed files with 96 additions and 109 deletions

View File

@ -1,3 +1,9 @@
myBlogNumbers 2023.10.19
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Upgrade to Dotclear 2.28
myBlogNumbers 2023.08.13
===========================================================
* Require Dotclear 2.27

View File

@ -1,25 +1,22 @@
# README
[![Release](https://img.shields.io/badge/release-2023.08.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/myBlogNumber/releases)
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/myBlogNumber/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![Release](https://img.shields.io/badge/release-2023.10.19-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/myBlogNumber/releases)
![Date](https://img.shields.io/badge/date-2023.10.19-c44d58.svg)
[![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/myBlogNumber)
[![License](https://img.shields.io/github/license/JcDenis/myBlogNumber)](https://git.dotclear.watch/JcDenis/myBlogNumber/blob/master/LICENSE)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/myBlogNumber/src/branch/master/LICENSE)
## WHAT IS MYBLOGNUMBERS ?
## ABOUT
"My Blog Numbers" is a plugin for the open-source
web publishing software called Dotclear.
_myBlogNumber_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
Simply show visitors some statistics about current blog.
> Show visitors some statistics about current blog.
## REQUIREMENTS
_myBlogNumbers_ requires:
* permissions to manage widgets
* Dotclear 2.27
* PHP 7.4+
* Dotclear 2.28
* PHP 8.1+
* Dotclear permissions to manage widgets
## USAGE
@ -31,14 +28,15 @@ You can add a dashboard item by enable it from your dashboard preferences.
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/myBlogNumber) or [GitHub Page](https://github.com/JcDenis/myBlogNumber)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/myBlogNumber/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/myBlogNumber)
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?id=40934)
* [License](https://git.dotclear.watch/JcDenis/myBlogNumber/src/branch/master/LICENSE)
* [Packages & details](https://git.dotclear.watch/JcDenis/myBlogNumber/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/myBlogNumber))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/myBlogNumber) (or on [GitHub](https://github.com/JcDenis/myBlogNumber))
* [Issues & security](https://git.dotclear.watch/JcDenis/myBlogNumber/issues) (or on [GitHub](https://github.com/JcDenis/myBlogNumber/issues))
* [Discuss & help](http://forum.dotclear.org/viewtopic.php?id=40934)
## CONTRIBUTORS
* Jean-Christian Denis
* Jean-Christian Denis (author)
* Pierre Van Glabeke
You are welcome to contribute to this code.

View File

@ -1,30 +1,26 @@
<?php
/**
* @brief myBlogNumbers, a plugin for Dotclear 2
* @file
* @brief The plugin myBlogNumbers definition
* @ingroup myBlogNumbers
*
* @package Dotclear
* @subpackage Plugin
* @defgroup myBlogNumbers Plugin myBlogNumbers.
*
* @author Jean-Christian Denis, Pierre Van Glabeke
* Show some figures of your blog.
*
* @copyright Jean-Christian Denis
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
declare(strict_types=1);
$this->registerModule(
'My blog numbers',
'Show some figures of your blog',
'Jean-Christian Denis, Pierre Van Glabeke',
'2023.08.13',
'2023.10.19',
[
'requires' => [['core', '2.27']],
'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
dcAuth::PERMISSION_CONTENT_ADMIN,
]),
'requires' => [['core', '2.28']],
'permissions' => 'My',
'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="myBlogNumbers">
<name>My blog numbers</name>
<version>2023.08.13</version>
<version>2023.10.19</version>
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
<desc>Show some figures of your blog</desc>
<file>https://git.dotclear.watch/JcDenis/myBlogNumbers/releases/download/v2023.08.13/plugin-myBlogNumbers.zip</file>
<da:dcmin>2.27</da:dcmin>
<file>https://git.dotclear.watch/JcDenis/myBlogNumbers/releases/download/v2023.10.19/plugin-myBlogNumbers.zip</file>
<da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/myBlogNumbers/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/myBlogNumbers/issues</da:support>
</module>

View File

@ -1,22 +1,19 @@
<?php
/**
* @brief myBlogNumbers, 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);
namespace Dotclear\Plugin\myBlogNumbers;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
/**
* @brief myBlogNumbers backend class.
* @ingroup myBlogNumbers
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Backend extends Process
{
public static function init(): bool
@ -30,9 +27,7 @@ class Backend extends Process
return false;
}
dcCore::app()->addBehaviors([
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
return true;
}

View File

@ -1,22 +1,19 @@
<?php
/**
* @brief myBlogNumbers, 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);
namespace Dotclear\Plugin\myBlogNumbers;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
/**
* @brief myBlogNumbers frontend class.
* @ingroup myBlogNumbers
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Frontend extends Process
{
public static function init(): bool
@ -30,9 +27,7 @@ class Frontend extends Process
return false;
}
dcCore::app()->addBehaviors([
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
return true;
}

View File

@ -1,21 +1,19 @@
<?php
/**
* @brief myBlogNumbers, 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);
namespace Dotclear\Plugin\myBlogNumbers;
use Dotclear\Module\MyPlugin;
/**
* @brief myBlogNumbers My helper.
* @ingroup myBlogNumbers
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class My extends MyPlugin
{
// Use default permissions
}

View File

@ -1,25 +1,21 @@
<?php
/**
* @brief myBlogNumbers, 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);
namespace Dotclear\Plugin\myBlogNumbers;
use dcCore;
use dcMeta;
use Dotclear\App;
use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack;
use Dotclear\Plugin\widgets\WidgetsElement;
/**
* @brief myBlogNumbers widgets class.
* @ingroup myBlogNumbers
*
* @author Jean-Christian Denis (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Widgets
{
public static function initWidgets(WidgetsStack $w): void
@ -28,7 +24,7 @@ class Widgets
->create(
'myblognumbers',
__('My blog numbers'),
[self::class, 'frontendWidget'],
self::frontendWidget(...),
null,
__('Show some figures of your blog')
)
@ -90,7 +86,7 @@ class Widgets
'text'
);
if (dcCore::app()->plugins->moduleExists('tags')) {
if (App::plugins()->moduleExists('tags')) {
# Tag
$w->myblognumbers
->setting(
@ -123,7 +119,7 @@ class Widgets
);
# --BEHAVIOR-- myBlogNumbersWidgetInit
dcCore::app()->callBehavior('myBlogNumbersWidgetInit', $w);
App::behavior()->callBehavior('myBlogNumbersWidgetInit', $w);
# widget option - page to show on
$w->myblognumbers
@ -135,7 +131,10 @@ class Widgets
public static function frontendWidget(WidgetsElement $w): string
{
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 '';
}
@ -148,7 +147,7 @@ class Widgets
$title = $w->entry_title ?
sprintf($s_title, Html::escapeHTML($w->entry_title)) : '';
$count = (int) dcCore::app()->blog->getPosts([], true)->f(0);
$count = (int) App::blog()->getPosts([], true)->f(0);
$text = $count == 0 ?
sprintf(__('no entries'), $count) :
@ -162,7 +161,7 @@ class Widgets
$title = $w->cat_title ?
sprintf($s_title, Html::escapeHTML($w->cat_title)) : '';
$count = dcCore::app()->blog->getCategories([])->count();
$count = App::blog()->getCategories([])->count();
$text = $count == 0 ?
sprintf(__('no categories'), $count) :
@ -181,7 +180,7 @@ class Widgets
'comment_status' => 1,
'comment_trackback' => 0,
];
$count = (int) dcCore::app()->blog->getComments($params, true)->f(0);
$count = (int) App::blog()->getComments($params, true)->f(0);
$text = $count == 0 ?
sprintf(__('no comments'), $count) :
@ -200,7 +199,7 @@ class Widgets
'comment_status' => 1,
'comment_trackback' => 1,
];
$count = (int) dcCore::app()->blog->getComments($params, true)->f(0);
$count = (int) App::blog()->getComments($params, true)->f(0);
$text = $count == 0 ?
sprintf(__('no trackbacks'), $count) :
@ -210,16 +209,16 @@ class Widgets
}
# Tag
if (dcCore::app()->plugins->moduleExists('tags') && $w->tag_show) {
if (App::plugins()->moduleExists('tags') && $w->tag_show) {
$title = $w->tag_title ?
sprintf($s_title, Html::escapeHTML($w->tag_title)) : '';
$count = (int) dcCore::app()->con->select(
$count = (int) App::con()->select(
'SELECT count(M.meta_id) AS count ' .
'FROM ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' M ' .
'LEFT JOIN ' . dcCore::app()->prefix . 'post P ON P.post_id=M.post_id ' .
'FROM ' . App::con()->prefix() . App::meta()::META_TABLE_NAME . ' M ' .
'LEFT JOIN ' . App::con()->prefix() . 'post P ON P.post_id=M.post_id ' .
"WHERE M.meta_type='tag' " .
"AND P.blog_id='" . dcCore::app()->blog->id . "' "
"AND P.blog_id='" . App::blog()->id() . "' "
)->f(0);
$text = $count == 0 ?
@ -234,7 +233,7 @@ class Widgets
$title = $w->user_title ?
sprintf($s_title, Html::escapeHTML($w->user_title)) : '';
$count = dcCore::app()->blog->getPostsUsers('post')->count();
$count = App::blog()->getPostsUsers('post')->count();
$text = $count == 0 ?
sprintf(__('no author'), $count) :
@ -244,7 +243,7 @@ class Widgets
}
# --BEHAVIOR-- myBlogNumbersWidgetParse
$addons = dcCore::app()->callBehavior('myBlogNumbersWidgetParse', $w);
$addons = App::behavior()->callBehavior('myBlogNumbersWidgetParse', $w);
# Nothing to display
if (!$content && !$addons) {