Compare commits
7 Commits
v2023.08.1
...
master
Author | SHA1 | Date | |
---|---|---|---|
02dc3bd51e | |||
eb3ad16f88 | |||
ff2e09e743 | |||
b1f644a8f3 | |||
4ec3ac9610 | |||
208963952c | |||
aa05e6e1b5 |
30
CHANGELOG.md
30
CHANGELOG.md
@ -1,3 +1,33 @@
|
|||||||
|
enhancePostContent 2023.10.24
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Fix widgets
|
||||||
|
|
||||||
|
enhancePostContent 2023.10.16
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Code review
|
||||||
|
|
||||||
|
enhancePostContent 2023.10.13
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to last minute change to Dotclear 2.28
|
||||||
|
|
||||||
|
enhancePostContent 2023.10.11
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Code review
|
||||||
|
|
||||||
|
enhancePostContent 2023.10.08
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
enhancePostContent 2023.08.14
|
enhancePostContent 2023.08.14
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
36
README.md
36
README.md
@ -1,28 +1,23 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.08.14-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/releases)
|
[![Release](https://img.shields.io/badge/release-2023.10.24-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.14-c44d58.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/releases)
|
![Date](https://img.shields.io/badge/date-2023.10.24-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/enhancePostContent)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/enhancePostContent)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/enhancePostContent)](https://git.dotclear.watch/JcDenis/enhancePostContent/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS ENHANCEPOSTCONTENT ?
|
## ABOUT
|
||||||
|
|
||||||
"Enhance Post Content" is a plugin for the open-source
|
_enhancePostContent_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
It help to filter post content and extract or
|
> It help to filter post content and extract or show inline more info about words and expressions such as tags, acronyms, abbreviations, definition, citation, link, etc...
|
||||||
show inline more info about words and expressions such as
|
|
||||||
atgs, acronyms, abbreviations, definition, citation, link, etc...
|
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_enhancePostContent_ requires:
|
* Dotclear 2.28
|
||||||
|
|
||||||
* admin permissions to set up plugin
|
|
||||||
* content admin permissions to manage fitlers
|
|
||||||
* Dotclear 2.27
|
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
|
* Dotclear admin permissions to set up plugin
|
||||||
|
* Dotclear content admin permissions to manage fitlers
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
@ -37,13 +32,14 @@ you should also add widgets.
|
|||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/enhancePostContent) or [GitHub Page](https://github.com/JcDenis/enhancePostContent)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/enhancePostContent))
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/enhancePostContent)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/enhancePostContent) (or on [GitHub](https://github.com/JcDenis/enhancePostContent))
|
||||||
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?id=40876)
|
* [Issues & security](https://git.dotclear.watch/JcDenis/enhancePostContent/issues) (or on [GitHub](https://github.com/JcDenis/enhancePostContent/issues))
|
||||||
|
* [Discuss and help](http://forum.dotclear.org/viewtopic.php?id=40876)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (author)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
29
_define.php
29
_define.php
@ -1,36 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief enhancePostContent, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin enhancePostContent definition
|
||||||
|
* @ingroup enhancePostContent
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup enhancePostContent Plugin enhancePostContent.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* Add features to words in post content.
|
||||||
*
|
*
|
||||||
* @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')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Enhance post content',
|
'Enhance post content',
|
||||||
'Add features to words in post content',
|
'Add features to words in post content',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'2023.08.14',
|
'2023.10.24',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'type' => 'plugin',
|
||||||
['php', '8.1'],
|
'requires' => [['core', '2.28']],
|
||||||
['core', '2.27'],
|
'permissions' => 'My',
|
||||||
],
|
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
|
||||||
]),
|
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
'self' => '',
|
||||||
'blog' => '#params.epc_params',
|
'blog' => '#params.epc_params',
|
||||||
],
|
],
|
||||||
'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',
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||||
|
20
_init.php
20
_init.php
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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
|
|
||||||
*/
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class initEnhancePostContent
|
|
||||||
{
|
|
||||||
public const TABLE_NAME = 'epc';
|
|
||||||
}
|
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="enhancePostContent">
|
<module id="enhancePostContent">
|
||||||
<name>Enhance post content</name>
|
<name>Enhance post content</name>
|
||||||
<version>2023.08.14</version>
|
<version>2023.10.24</version>
|
||||||
<author>Jean-Christian Denis and Contributors</author>
|
<author>Jean-Christian Denis and Contributors</author>
|
||||||
<desc>Add features to words in post content</desc>
|
<desc>Add features to words in post content</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/enhancePostContent/releases/download/v2023.08.14/plugin-enhancePostContent.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/enhancePostContent/releases/download/v2023.10.24/plugin-enhancePostContent.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/enhancePostContent/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/enhancePostContent/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief enhancePostContent, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin enhancePostContent resources
|
||||||
|
* @ingroup enhancePostContent
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @author Jean-Christian Denis
|
||||||
* @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
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
\Dotclear\App::backend()->resources()->set('help', 'enhancePostContent', __DIR__ . '/help/help.html');
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->resources['help']['enhancePostContent'] = __DIR__ . '/help/help.html';
|
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief enhancePostContent, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin enhancePostContent resources
|
||||||
|
* @ingroup enhancePostContent
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @author Jean-Christian Denis
|
||||||
* @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
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
\Dotclear\App::backend()->resources()->set('help', 'enhancePostContent', __DIR__ . '/help/help.html');
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->resources['help']['enhancePostContent'] = __DIR__ . '/help/help.html';
|
|
||||||
|
@ -1,22 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcSettings;
|
|
||||||
use Dotclear\Core\Backend\Favorites;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
@ -29,7 +18,15 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
Para,
|
Para,
|
||||||
Text
|
Text
|
||||||
};
|
};
|
||||||
|
use Dotclear\Interface\Core\BlogSettingsInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent backend class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @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
|
||||||
@ -45,7 +42,7 @@ class Backend extends Process
|
|||||||
|
|
||||||
My::addBackendMenuItem();
|
My::addBackendMenuItem();
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehaviors([
|
||||||
// backend user dashboard favorites icon
|
// backend user dashboard favorites icon
|
||||||
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
||||||
$favs->register(My::id(), [
|
$favs->register(My::id(), [
|
||||||
@ -53,11 +50,11 @@ class Backend extends Process
|
|||||||
'url' => My::manageUrl(),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => My::icons(),
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]),
|
'permissions' => App::auth()->makePermissions([App::auth()::PERMISSION_CONTENT_ADMIN]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
// backend user preference form
|
// backend user preference form
|
||||||
'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {
|
'adminBlogPreferencesFormV2' => function (BlogSettingsInterface $blog_settings): void {
|
||||||
$active = (bool) $blog_settings->get(My::id())->get('active');
|
$active = (bool) $blog_settings->get(My::id())->get('active');
|
||||||
$allowedtplvalues = Epc::blogAllowedTemplateValue();
|
$allowedtplvalues = Epc::blogAllowedTemplateValue();
|
||||||
$allowedpubpages = Epc::blogAllowedTemplatePage();
|
$allowedpubpages = Epc::blogAllowedTemplatePage();
|
||||||
@ -102,7 +99,7 @@ class Backend extends Process
|
|||||||
// allowedtplvalues
|
// allowedtplvalues
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Allowed DC template values:'), Label::OUTSIDE_LABEL_BEFORE))->for('epc_allowedtplvalues'),
|
(new Label(__('Allowed DC template values:'), Label::OUTSIDE_LABEL_BEFORE))->for('epc_allowedtplvalues'),
|
||||||
(new Input('epc_allowedtplvalues'))->size(100)->maxlenght(0)->value(Epc::encodeMulti($allowedtplvalues)),
|
(new Input('epc_allowedtplvalues'))->size(100)->maxlength(0)->value(Epc::encodeMulti($allowedtplvalues)),
|
||||||
]),
|
]),
|
||||||
(new Note())
|
(new Note())
|
||||||
->class('form-note')
|
->class('form-note')
|
||||||
@ -110,7 +107,7 @@ class Backend extends Process
|
|||||||
// allowedpubpages
|
// allowedpubpages
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Allowed public pages:'), Label::OUTSIDE_LABEL_BEFORE))->for('epc_allowedpubpages'),
|
(new Label(__('Allowed public pages:'), Label::OUTSIDE_LABEL_BEFORE))->for('epc_allowedpubpages'),
|
||||||
(new Input('epc_allowedpubpages'))->size(100)->maxlenght(0)->value(Epc::encodeMulti($allowedpubpages)),
|
(new Input('epc_allowedpubpages'))->size(100)->maxlength(0)->value(Epc::encodeMulti($allowedpubpages)),
|
||||||
]),
|
]),
|
||||||
(new Note())
|
(new Note())
|
||||||
->class('form-note')
|
->class('form-note')
|
||||||
@ -123,7 +120,7 @@ class Backend extends Process
|
|||||||
->render();
|
->render();
|
||||||
},
|
},
|
||||||
// backend user preference save
|
// backend user preference save
|
||||||
'adminBeforeBlogSettingsUpdate' => function (dcSettings $blog_settings): void {
|
'adminBeforeBlogSettingsUpdate' => function (BlogSettingsInterface $blog_settings): void {
|
||||||
$active = !empty($_POST['epc_active']);
|
$active = !empty($_POST['epc_active']);
|
||||||
$allowedtplvalues = Epc::decodeMulti($_POST['epc_allowedtplvalues']);
|
$allowedtplvalues = Epc::decodeMulti($_POST['epc_allowedtplvalues']);
|
||||||
$allowedpubpages = Epc::decodeMulti($_POST['epc_allowedpubpages']);
|
$allowedpubpages = Epc::decodeMulti($_POST['epc_allowedpubpages']);
|
||||||
@ -148,7 +145,7 @@ class Backend extends Process
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
// widgets registration
|
// widgets registration
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
'initWidgets' => Widgets::initWidgets(...),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
@ -24,7 +14,11 @@ use Dotclear\Helper\Html\Form\Checkbox;
|
|||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend filters values list.
|
* @brief enhancePostContent filters list class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class BackendList extends Listing
|
class BackendList extends Listing
|
||||||
{
|
{
|
||||||
@ -43,7 +37,7 @@ class BackendList extends Listing
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager = new Pager($filter->value('page'), $this->rs_count, $filter->value('nb'), 10);
|
$pager = new Pager($filter->value('page'), (int) $this->rs_count, $filter->value('nb'), 10);
|
||||||
$pager->base_url = $url;
|
$pager->base_url = $url;
|
||||||
|
|
||||||
$epc_id = [];
|
$epc_id = [];
|
||||||
@ -71,7 +65,7 @@ class BackendList extends Listing
|
|||||||
echo $pager->getLinks() . $blocks[0];
|
echo $pager->getLinks() . $blocks[0];
|
||||||
|
|
||||||
while ($this->rs->fetch()) {
|
while ($this->rs->fetch()) {
|
||||||
$this->line(isset($epc_id[$this->rs->epc_id]));
|
$this->line(isset($epc_id[$this->rs->f('epc_id')]));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $blocks[1] . $blocks[2] . $pager->getLinks();
|
echo $blocks[1] . $blocks[2] . $pager->getLinks();
|
||||||
@ -85,14 +79,14 @@ class BackendList extends Listing
|
|||||||
private function line(bool $checked): void
|
private function line(bool $checked): void
|
||||||
{
|
{
|
||||||
$cols = [
|
$cols = [
|
||||||
'check' => '<td class="nowrap">' . (new Checkbox(['epc_id[]'], $checked))->value($this->rs->epc_id)->render() . '</td>',
|
'check' => '<td class="nowrap">' . (new Checkbox(['epc_id[]'], $checked))->value($this->rs->f('epc_id'))->render() . '</td>',
|
||||||
'key' => '<td class="nowrap">' . Html::escapeHTML($this->rs->epc_key) . '</td>',
|
'key' => '<td class="nowrap">' . Html::escapeHTML($this->rs->f('epc_key')) . '</td>',
|
||||||
'value' => '<td class="maximal">' . Html::escapeHTML($this->rs->epc_value) . '</td>',
|
'value' => '<td class="maximal">' . Html::escapeHTML($this->rs->f('epc_value')) . '</td>',
|
||||||
'date' => '<td class="nowrap count">' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->epc_upddt) . '</td>',
|
'date' => '<td class="nowrap count">' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('epc_upddt')) . '</td>',
|
||||||
];
|
];
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<tr class="line" id="p' . $this->rs->epc_id . '">' .
|
'<tr class="line" id="p' . $this->rs->f('epc_id') . '">' .
|
||||||
implode($cols) .
|
implode($cols) .
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
102
src/Epc.php
102
src/Epc.php
@ -1,21 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -31,15 +21,59 @@ __('search results page');
|
|||||||
__('atom feeds');
|
__('atom feeds');
|
||||||
__('RSS feeds');
|
__('RSS feeds');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent main class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Epc
|
class Epc
|
||||||
{
|
{
|
||||||
/** @var string The temporary pattern to tag words to replace */
|
/**
|
||||||
|
* Plugin table name.
|
||||||
|
*
|
||||||
|
* @var string TABLE_NAME
|
||||||
|
*/
|
||||||
|
public const TABLE_NAME = 'epc';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distributed filters.
|
||||||
|
*
|
||||||
|
* @var array<int,string> DEFAULT_FILTERS
|
||||||
|
*/
|
||||||
|
public const DEFAULT_FILTERS = [
|
||||||
|
Filter\EpcFilterTag::class,
|
||||||
|
Filter\EpcFilterSearch::class,
|
||||||
|
Filter\EpcFilterAcronym::class,
|
||||||
|
Filter\EpcFilterAbbreviation::class,
|
||||||
|
Filter\EpcFilterDefinition::class,
|
||||||
|
Filter\EpcFilterCitation::class,
|
||||||
|
Filter\EpcFilterLink::class,
|
||||||
|
Filter\EpcFilterReplace::class,
|
||||||
|
Filter\EpcFilterUpdate::class,
|
||||||
|
Filter\EpcFilterTwitter::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The temporary pattern to tag words to replace.
|
||||||
|
*
|
||||||
|
* @var string FLAGGER
|
||||||
|
*/
|
||||||
public const FLAGGER = 'ççççç%sççççç';
|
public const FLAGGER = 'ççççç%sççççç';
|
||||||
|
|
||||||
/** @var EpcFilters $filters THe filters stack */
|
/**
|
||||||
|
* The filters stack.
|
||||||
|
*
|
||||||
|
* @var EpcFilters $filters
|
||||||
|
*/
|
||||||
private static EpcFilters $filters;
|
private static EpcFilters $filters;
|
||||||
|
|
||||||
/** @var array<string,int> $limits The replacment limit per filtre */
|
/**
|
||||||
|
* The replacment limit per filtre.
|
||||||
|
*
|
||||||
|
* @var array<string,int> $limits
|
||||||
|
*/
|
||||||
private static array $limits = [];
|
private static array $limits = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +90,7 @@ class Epc
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAllowedTplValues : ArrayObject
|
# --BEHAVIOR-- enhancePostContentAllowedTplValues : ArrayObject
|
||||||
dcCore::app()->callBehavior('enhancePostContentAllowedTplValues', $list);
|
App::behavior()->callBehavior('enhancePostContentAllowedTplValues', $list);
|
||||||
|
|
||||||
return iterator_to_array($list, true);
|
return iterator_to_array($list, true);
|
||||||
}
|
}
|
||||||
@ -76,27 +110,27 @@ class Epc
|
|||||||
/**
|
/**
|
||||||
* Get list of allowed templates name->[tag,callback] to list on epc widgets.
|
* Get list of allowed templates name->[tag,callback] to list on epc widgets.
|
||||||
*
|
*
|
||||||
* @return array The templates name->[id,cb] values
|
* @return array<string, array<string, mixed>> The templates name->[id,cb] values
|
||||||
*/
|
*/
|
||||||
public static function widgetAllowedTemplateValue(): array
|
public static function widgetAllowedTemplateValue(): array
|
||||||
{
|
{
|
||||||
$list = new ArrayObject([
|
$list = new ArrayObject([
|
||||||
'entry excerpt' => [
|
'entry excerpt' => [
|
||||||
'id' => 'entryexcerpt',
|
'id' => 'entryexcerpt',
|
||||||
'cb' => [self::class, 'widgetContentEntryExcerpt'],
|
'cb' => self::widgetContentEntryExcerpt(...),
|
||||||
],
|
],
|
||||||
'entry content' => [
|
'entry content' => [
|
||||||
'id' => 'entrycontent',
|
'id' => 'entrycontent',
|
||||||
'cb' => [self::class, 'widgetContentEntryContent'],
|
'cb' => self::widgetContentEntryContent(...),
|
||||||
],
|
],
|
||||||
'comment content' => [
|
'comment content' => [
|
||||||
'id' => 'commentcontent',
|
'id' => 'commentcontent',
|
||||||
'cb' => [self::class, 'widgetContentCommentContent'],
|
'cb' => self::widgetContentCommentContent(...),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAllowedWidgetValues : ArrayObject
|
# --BEHAVIOR-- enhancePostContentAllowedWidgetValues : ArrayObject
|
||||||
dcCore::app()->callBehavior('enhancePostContentAllowedWidgetValues', $list);
|
App::behavior()->callBehavior('enhancePostContentAllowedWidgetValues', $list);
|
||||||
|
|
||||||
return iterator_to_array($list, true);
|
return iterator_to_array($list, true);
|
||||||
}
|
}
|
||||||
@ -118,7 +152,7 @@ class Epc
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAllowedPubPages : ArrayObject
|
# --BEHAVIOR-- enhancePostContentAllowedPubPages : ArrayObject
|
||||||
dcCore::app()->callBehavior('enhancePostContentAllowedPubPages', $list);
|
App::behavior()->callBehavior('enhancePostContentAllowedPubPages', $list);
|
||||||
|
|
||||||
return iterator_to_array($list, true);
|
return iterator_to_array($list, true);
|
||||||
}
|
}
|
||||||
@ -149,9 +183,9 @@ class Epc
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
# --BEHAVIOR-- enhancePostContentFilters : EpcFilters
|
# --BEHAVIOR-- enhancePostContentFilters : EpcFilters
|
||||||
dcCore::app()->callBehavior('enhancePostContentFilters', $filters);
|
App::behavior()->callBehavior('enhancePostContentFilters', $filters);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$filters = $filters->sort();
|
self::$filters = $filters->sort();
|
||||||
@ -375,13 +409,13 @@ class Epc
|
|||||||
*/
|
*/
|
||||||
public static function widgetContentEntryExcerpt(?WidgetsElement $widget = null): string
|
public static function widgetContentEntryExcerpt(?WidgetsElement $widget = null): string
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
|
if (!App::frontend()->context()->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->context()->__get('posts')?->fetch()) {
|
||||||
$content .= dcCore::app()->ctx->__get('posts')->f('post_excerpt');
|
$content .= App::frontend()->context()->__get('posts')->f('post_excerpt');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
@ -396,13 +430,13 @@ class Epc
|
|||||||
*/
|
*/
|
||||||
public static function widgetContentEntryContent(?WidgetsElement $widget = null): string
|
public static function widgetContentEntryContent(?WidgetsElement $widget = null): string
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
|
if (!App::frontend()->context()->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->context()->__get('posts')?->fetch()) {
|
||||||
$content .= dcCore::app()->ctx->__get('posts')->f('post_content');
|
$content .= App::frontend()->context()->__get('posts')->f('post_content');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
@ -417,14 +451,14 @@ class Epc
|
|||||||
*/
|
*/
|
||||||
public static function widgetContentCommentContent(?WidgetsElement $widget = null): string
|
public static function widgetContentCommentContent(?WidgetsElement $widget = null): string
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->ctx) || !dcCore::app()->ctx->exists('posts')) {
|
if (!App::frontend()->context()->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->context()->__get('posts')->fetch()) {
|
||||||
$comments = dcCore::app()->blog?->getComments(['post_id' => dcCore::app()->ctx->__get('posts')->f('post_id')]);
|
$comments = App::blog()->getComments(['post_id' => App::frontend()->context()->__get('posts')->f('post_id')]);
|
||||||
while ($comments?->fetch()) {
|
while ($comments->fetch()) {
|
||||||
$content .= $comments->__call('getContent', []);
|
$content .= $comments->__call('getContent', []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
@ -20,9 +10,13 @@ use Dotclear\Plugin\widgets\WidgetsElement;
|
|||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter abstract class.
|
* @brief enhancePostContent abstract filter class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
*
|
*
|
||||||
* All filter must extends this class.
|
* All filter must extends this class.
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
abstract class EpcFilter
|
abstract class EpcFilter
|
||||||
{
|
{
|
||||||
@ -44,10 +38,10 @@ abstract class EpcFilter
|
|||||||
/** @var bool $has_list Filter has list of records (property) */
|
/** @var bool $has_list Filter has list of records (property) */
|
||||||
public readonly bool $has_list;
|
public readonly bool $has_list;
|
||||||
|
|
||||||
/** @var array $ignore The filter disabled html tags (property) */
|
/** @var array<int,string> $ignore The filter disabled html tags (property) */
|
||||||
public readonly array $ignore;
|
public readonly array $ignore;
|
||||||
|
|
||||||
/** @var array $class The css class that apply to filter (property) */
|
/** @var array<int,string> $class The css class that apply to filter (property) */
|
||||||
public readonly array $class;
|
public readonly array $class;
|
||||||
|
|
||||||
/** @var string $replace The filter replacement bloc in content (property) */
|
/** @var string $replace The filter replacement bloc in content (property) */
|
||||||
@ -65,16 +59,16 @@ abstract class EpcFilter
|
|||||||
/** @var bool $plural The replacement limit per filter (settings) */
|
/** @var bool $plural The replacement limit per filter (settings) */
|
||||||
public readonly int $limit;
|
public readonly int $limit;
|
||||||
|
|
||||||
/** @var array $style The style applied to filter class (settings) */
|
/** @var array<int,string> $style The style applied to filter class (settings) */
|
||||||
public readonly array $style;
|
public readonly array $style;
|
||||||
|
|
||||||
/** @var array $notag The filter disabled html tags (settings) */
|
/** @var array<int,string> $notag The filter disabled html tags (settings) */
|
||||||
public readonly array $notag;
|
public readonly array $notag;
|
||||||
|
|
||||||
/** @var array $template The extra template value to scan (settings) */
|
/** @var array<int,string> $template The extra template value to scan (settings) */
|
||||||
public readonly array $template;
|
public readonly array $template;
|
||||||
|
|
||||||
/** @var array $page The extra frontend pages to scan (settings) */
|
/** @var array<int,string> $page The extra frontend pages to scan (settings) */
|
||||||
public readonly array $page;
|
public readonly array $page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,27 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters stack.
|
* @brief enhancePostContent filters stack.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
*
|
*
|
||||||
* Use Epc::getFilters() to get loaded stack
|
* Use Epc::getFilters() to get loaded stack
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class EpcFilters
|
class EpcFilters
|
||||||
{
|
{
|
||||||
/** @var array<int,EpcFilter> $satck The filters stack */
|
/**
|
||||||
|
* The filters stack.
|
||||||
|
*
|
||||||
|
* @var array<int, EpcFilter> $stack
|
||||||
|
*/
|
||||||
private array $stack = [];
|
private array $stack = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Database\{
|
use Dotclear\Database\{
|
||||||
Cursor,
|
Cursor,
|
||||||
MetaRecord
|
MetaRecord
|
||||||
@ -22,7 +12,11 @@ use Dotclear\Database\{
|
|||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter records.
|
* @brief enhancePostContent filters records.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class EpcRecord
|
class EpcRecord
|
||||||
{
|
{
|
||||||
@ -48,19 +42,19 @@ class EpcRecord
|
|||||||
'E.epc_filter, E.epc_key, E.epc_value ';
|
'E.epc_filter, E.epc_key, E.epc_value ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq .= 'FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' E ';
|
$strReq .= 'FROM ' . App::con()->prefix() . Epc::TABLE_NAME . ' E ';
|
||||||
|
|
||||||
if (!empty($params['from'])) {
|
if (!empty($params['from'])) {
|
||||||
$strReq .= $params['from'] . ' ';
|
$strReq .= $params['from'] . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq .= "WHERE E.blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' ";
|
$strReq .= "WHERE E.blog_id = '" . App::con()->escapeStr(App::blog()->id()) . "' ";
|
||||||
|
|
||||||
if (isset($params['epc_type'])) {
|
if (isset($params['epc_type'])) {
|
||||||
if (is_array($params['epc_type']) && !empty($params['epc_type'])) {
|
if (is_array($params['epc_type']) && !empty($params['epc_type'])) {
|
||||||
$strReq .= 'AND E.epc_type ' . dcCore::app()->con->in($params['epc_type']);
|
$strReq .= 'AND E.epc_type ' . App::con()->in($params['epc_type']);
|
||||||
} elseif ($params['epc_type'] != '') {
|
} elseif ($params['epc_type'] != '') {
|
||||||
$strReq .= "AND E.epc_type = '" . dcCore::app()->con->escapeStr((string) $params['epc_type']) . "' ";
|
$strReq .= "AND E.epc_type = '" . App::con()->escapeStr((string) $params['epc_type']) . "' ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$strReq .= "AND E.epc_type = 'epc' ";
|
$strReq .= "AND E.epc_type = 'epc' ";
|
||||||
@ -68,9 +62,9 @@ class EpcRecord
|
|||||||
|
|
||||||
if (isset($params['epc_filter'])) {
|
if (isset($params['epc_filter'])) {
|
||||||
if (is_array($params['epc_filter']) && !empty($params['epc_filter'])) {
|
if (is_array($params['epc_filter']) && !empty($params['epc_filter'])) {
|
||||||
$strReq .= 'AND E.epc_filter ' . dcCore::app()->con->in($params['epc_filter']);
|
$strReq .= 'AND E.epc_filter ' . App::con()->in($params['epc_filter']);
|
||||||
} elseif ($params['epc_filter'] != '') {
|
} elseif ($params['epc_filter'] != '') {
|
||||||
$strReq .= "AND E.epc_filter = '" . dcCore::app()->con->escapeStr((string) $params['epc_filter']) . "' ";
|
$strReq .= "AND E.epc_filter = '" . App::con()->escapeStr((string) $params['epc_filter']) . "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,16 +74,16 @@ class EpcRecord
|
|||||||
} else {
|
} else {
|
||||||
$params['epc_id'] = [(int) $params['epc_id']];
|
$params['epc_id'] = [(int) $params['epc_id']];
|
||||||
}
|
}
|
||||||
$strReq .= 'AND E.epc_id ' . dcCore::app()->con->in($params['epc_id']);
|
$strReq .= 'AND E.epc_id ' . App::con()->in($params['epc_id']);
|
||||||
} elseif (isset($params['not_id']) && is_numeric($params['not_id'])) {
|
} elseif (isset($params['not_id']) && is_numeric($params['not_id'])) {
|
||||||
$strReq .= "AND NOT E.epc_id = '" . $params['not_id'] . "' ";
|
$strReq .= "AND NOT E.epc_id = '" . $params['not_id'] . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params['epc_key'])) {
|
if (isset($params['epc_key'])) {
|
||||||
if (is_array($params['epc_key']) && !empty($params['epc_key'])) {
|
if (is_array($params['epc_key']) && !empty($params['epc_key'])) {
|
||||||
$strReq .= 'AND E.epc_key ' . dcCore::app()->con->in($params['epc_key']);
|
$strReq .= 'AND E.epc_key ' . App::con()->in($params['epc_key']);
|
||||||
} elseif ($params['epc_key'] != '') {
|
} elseif ($params['epc_key'] != '') {
|
||||||
$strReq .= "AND E.epc_key = '" . dcCore::app()->con->escapeStr((string) $params['epc_key']) . "' ";
|
$strReq .= "AND E.epc_key = '" . App::con()->escapeStr((string) $params['epc_key']) . "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,17 +93,17 @@ class EpcRecord
|
|||||||
|
|
||||||
if (!$count_only) {
|
if (!$count_only) {
|
||||||
if (!empty($params['order'])) {
|
if (!empty($params['order'])) {
|
||||||
$strReq .= 'ORDER BY ' . dcCore::app()->con->escapeStr((string) $params['order']) . ' ';
|
$strReq .= 'ORDER BY ' . App::con()->escapeStr((string) $params['order']) . ' ';
|
||||||
} else {
|
} else {
|
||||||
$strReq .= 'ORDER BY E.epc_key ASC ';
|
$strReq .= 'ORDER BY E.epc_key ASC ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$count_only && !empty($params['limit'])) {
|
if (!$count_only && !empty($params['limit'])) {
|
||||||
$strReq .= dcCore::app()->con->limit($params['limit']);
|
$strReq .= App::con()->limit($params['limit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MetaRecord(dcCore::app()->con->select($strReq));
|
return new MetaRecord(App::con()->select($strReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,26 +115,26 @@ class EpcRecord
|
|||||||
*/
|
*/
|
||||||
public static function addRecord(Cursor $cur): int
|
public static function addRecord(Cursor $cur): int
|
||||||
{
|
{
|
||||||
dcCore::app()->con->writeLock(dcCore::app()->prefix . My::TABLE_NAME);
|
App::con()->writeLock(App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$cur->setField('epc_id', self::getNextId());
|
$cur->setField('epc_id', self::getNextId());
|
||||||
$cur->setField('blog_id', (string) dcCore::app()->blog?->id);
|
$cur->setField('blog_id', App::blog()->id());
|
||||||
$cur->setField('epc_upddt', date('Y-m-d H:i:s'));
|
$cur->setField('epc_upddt', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
self::getCursor($cur);
|
self::getCursor($cur);
|
||||||
|
|
||||||
$cur->insert();
|
$cur->insert();
|
||||||
dcCore::app()->con->unlock();
|
App::con()->unlock();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->con->unlock();
|
App::con()->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
dcCore::app()->blog?->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAfterAddRecord : Cursor
|
# --BEHAVIOR-- enhancePostContentAfterAddRecord : Cursor
|
||||||
dcCore::app()->callBehavior('enhancePostContentAfterAddRecord', $cur);
|
App::behavior()->callBehavior('enhancePostContentAfterAddRecord', $cur);
|
||||||
|
|
||||||
return (int) $cur->getField('epc_id');
|
return (int) $cur->getField('epc_id');
|
||||||
}
|
}
|
||||||
@ -159,11 +153,11 @@ class EpcRecord
|
|||||||
|
|
||||||
$cur->setField('epc_upddt', date('Y-m-d H:i:s'));
|
$cur->setField('epc_upddt', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
$cur->update('WHERE epc_id = ' . $id . " AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' ");
|
$cur->update('WHERE epc_id = ' . $id . " AND blog_id = '" . App::con()->escapeStr(App::blog()->id()) . "' ");
|
||||||
dcCore::app()->blog?->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAfterUpdRecord : Cursor, int
|
# --BEHAVIOR-- enhancePostContentAfterUpdRecord : Cursor, int
|
||||||
dcCore::app()->callBehavior('enhancePostContentAfterUpdRecord', $cur, $id);
|
App::behavior()->callBehavior('enhancePostContentAfterUpdRecord', $cur, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,15 +190,15 @@ class EpcRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentBeforeDelRecord, int
|
# --BEHAVIOR-- enhancePostContentBeforeDelRecord, int
|
||||||
dcCore::app()->callBehavior('enhancePostContentbeforeDelRecord', $id);
|
App::behavior()->callBehavior('enhancePostContentbeforeDelRecord', $id);
|
||||||
|
|
||||||
dcCore::app()->con->execute(
|
App::con()->execute(
|
||||||
'DELETE FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' ' .
|
'DELETE FROM ' . App::con()->prefix() . Epc::TABLE_NAME . ' ' .
|
||||||
'WHERE epc_id = ' . $id . ' ' .
|
'WHERE epc_id = ' . $id . ' ' .
|
||||||
"AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog?->id) . "' "
|
"AND blog_id = '" . App::con()->escapeStr(App::blog()->id()) . "' "
|
||||||
);
|
);
|
||||||
|
|
||||||
dcCore::app()->blog?->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,8 +208,8 @@ class EpcRecord
|
|||||||
*/
|
*/
|
||||||
private static function getNextId(): int
|
private static function getNextId(): int
|
||||||
{
|
{
|
||||||
return (int) dcCore::app()->con->select(
|
return (int) App::con()->select(
|
||||||
'SELECT MAX(epc_id) FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' '
|
'SELECT MAX(epc_id) FROM ' . App::con()->prefix() . Epc::TABLE_NAME . ' '
|
||||||
)->f(0) + 1;
|
)->f(0) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +220,7 @@ class EpcRecord
|
|||||||
*/
|
*/
|
||||||
public static function openCursor(): Cursor
|
public static function openCursor(): Cursor
|
||||||
{
|
{
|
||||||
return dcCore::app()->con->openCursor(dcCore::app()->prefix . My::TABLE_NAME);
|
return App::con()->openCursor(App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -19,6 +9,14 @@ use Dotclear\Plugin\enhancePostContent\Epc;
|
|||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent abbreviation filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterAbbreviation extends EpcFilter
|
class EpcFilterAbbreviation extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'abbreviation';
|
protected string $id = 'abbreviation';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -19,6 +9,14 @@ use Dotclear\Plugin\enhancePostContent\Epc;
|
|||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent acronym filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterAcronym extends EpcFilter
|
class EpcFilterAcronym extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'acronym';
|
protected string $id = 'acronym';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -19,6 +9,14 @@ use Dotclear\Plugin\enhancePostContent\Epc;
|
|||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent citaion filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterCitation extends EpcFilter
|
class EpcFilterCitation extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'citation';
|
protected string $id = 'citation';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -19,6 +9,14 @@ use Dotclear\Plugin\enhancePostContent\Epc;
|
|||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent definition filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterDefinition extends EpcFilter
|
class EpcFilterDefinition extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'definition';
|
protected string $id = 'definition';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -19,6 +9,14 @@ use Dotclear\Plugin\enhancePostContent\Epc;
|
|||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent link filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterLink extends EpcFilter
|
class EpcFilterLink extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'link';
|
protected string $id = 'link';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -17,6 +7,14 @@ namespace Dotclear\Plugin\enhancePostContent\Filter;
|
|||||||
use Dotclear\Plugin\enhancePostContent\Epc;
|
use Dotclear\Plugin\enhancePostContent\Epc;
|
||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent replacement filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterReplace extends EpcFilter
|
class EpcFilterReplace extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'replace';
|
protected string $id = 'replace';
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Plugin\enhancePostContent\Epc;
|
use Dotclear\Plugin\enhancePostContent\Epc;
|
||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent search filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterSearch extends EpcFilter
|
class EpcFilterSearch extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'search';
|
protected string $id = 'search';
|
||||||
@ -48,11 +46,11 @@ class EpcFilterSearch extends EpcFilter
|
|||||||
|
|
||||||
public function publicContent(string $tag, array $args): void
|
public function publicContent(string $tag, array $args): void
|
||||||
{
|
{
|
||||||
if (empty(dcCore::app()->public->search)) {
|
if (empty(App::frontend()->search)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchs = explode(' ', dcCore::app()->public->search);
|
$searchs = explode(' ', App::frontend()->search);
|
||||||
|
|
||||||
foreach ($searchs as $k => $v) {
|
foreach ($searchs as $k => $v) {
|
||||||
$args[0] = Epc::replaceString(
|
$args[0] = Epc::replaceString(
|
||||||
|
@ -1,25 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Plugin\enhancePostContent\Epc;
|
use Dotclear\Plugin\enhancePostContent\Epc;
|
||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent tag filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterTag extends EpcFilter
|
class EpcFilterTag extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'tag';
|
protected string $id = 'tag';
|
||||||
@ -49,16 +47,16 @@ class EpcFilterTag extends EpcFilter
|
|||||||
|
|
||||||
public function publicContent(string $tag, array $args): void
|
public function publicContent(string $tag, array $args): void
|
||||||
{
|
{
|
||||||
if (!dcCore::app()->plugins->moduleExists('tags')) {
|
if (!App::plugins()->moduleExists('tags')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$metas = dcCore::app()->meta->getMetadata(['meta_type' => 'tag']);
|
$metas = App::meta()->getMetadata(['meta_type' => 'tag']);
|
||||||
|
|
||||||
while ($metas->fetch()) {
|
while ($metas->fetch()) {
|
||||||
$args[0] = Epc::replaceString(
|
$args[0] = Epc::replaceString(
|
||||||
$metas->f('meta_id'),
|
$metas->f('meta_id'),
|
||||||
sprintf($this->replace, dcCore::app()->blog?->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
|
sprintf($this->replace, App::blog()->url() . App::url()->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
|
||||||
$args[0],
|
$args[0],
|
||||||
$this
|
$this
|
||||||
);
|
);
|
||||||
@ -67,16 +65,16 @@ class EpcFilterTag extends EpcFilter
|
|||||||
|
|
||||||
public function widgetList(string $content, WidgetsElement $w, ArrayObject $list): void
|
public function widgetList(string $content, WidgetsElement $w, ArrayObject $list): void
|
||||||
{
|
{
|
||||||
if (!dcCore::app()->plugins->moduleExists('tags')) {
|
if (!App::plugins()->moduleExists('tags')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$metas = dcCore::app()->meta->getMetadata(['meta_type' => 'tag']);
|
$metas = App::meta()->getMetadata(['meta_type' => 'tag']);
|
||||||
|
|
||||||
while ($metas->fetch()) {
|
while ($metas->fetch()) {
|
||||||
$list[] = Epc::matchString(
|
$list[] = Epc::matchString(
|
||||||
$metas->f('meta_id'),
|
$metas->f('meta_id'),
|
||||||
sprintf($this->widget, dcCore::app()->blog?->url . dcCore::app()->url->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
|
sprintf($this->widget, App::blog()->url() . App::url()->getBase('tag') . '/' . $metas->f('meta_id'), '\\1'),
|
||||||
$content,
|
$content,
|
||||||
$this
|
$this
|
||||||
);
|
);
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -17,6 +7,14 @@ namespace Dotclear\Plugin\enhancePostContent\Filter;
|
|||||||
use Dotclear\Plugin\enhancePostContent\Epc;
|
use Dotclear\Plugin\enhancePostContent\Epc;
|
||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent twitter filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterTwitter extends EpcFilter
|
class EpcFilterTwitter extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'twitter';
|
protected string $id = 'twitter';
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent\Filter;
|
namespace Dotclear\Plugin\enhancePostContent\Filter;
|
||||||
@ -17,6 +7,14 @@ namespace Dotclear\Plugin\enhancePostContent\Filter;
|
|||||||
use Dotclear\Plugin\enhancePostContent\Epc;
|
use Dotclear\Plugin\enhancePostContent\Epc;
|
||||||
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
use Dotclear\Plugin\enhancePostContent\EpcFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent update filter.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class EpcFilterUpdate extends EpcFilter
|
class EpcFilterUpdate extends EpcFilter
|
||||||
{
|
{
|
||||||
protected string $id = 'update';
|
protected string $id = 'update';
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcUtils;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent frontend class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @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
|
||||||
@ -31,16 +27,16 @@ class Frontend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehaviors([
|
||||||
// Add CSS URL to frontend header
|
// Add CSS URL to frontend header
|
||||||
'publicHeadContent' => function (): void {
|
'publicHeadContent' => function (): void {
|
||||||
echo dcUtils::cssLoad(dcCore::app()->blog?->url . dcCore::app()->url->getURLFor('epccss'));
|
echo App::plugins()->cssLoad(App::blog()->url() . App::url()->getURLFor('epccss'));
|
||||||
},
|
},
|
||||||
// Filter template blocks content
|
// Filter template blocks content
|
||||||
'publicBeforeContentFilterV2' => function (string $tag, array $args): void {
|
'publicBeforeContentFilterV2' => function (string $tag, array $args): void {
|
||||||
foreach (Epc::getFilters()->dump() as $filter) {
|
foreach (Epc::getFilters()->dump() as $filter) {
|
||||||
// test context
|
// test context
|
||||||
if (in_array((string) dcCore::app()->ctx?->__get('current_tpl'), $filter->page)
|
if (in_array((string) App::frontend()->context()->__get('current_tpl'), $filter->page)
|
||||||
&& in_array($tag, $filter->template)
|
&& in_array($tag, $filter->template)
|
||||||
&& $args[0] != '' //content
|
&& $args[0] != '' //content
|
||||||
&& empty($args['encode_xml'])
|
&& empty($args['encode_xml'])
|
||||||
@ -53,7 +49,7 @@ class Frontend extends Process
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Widgets
|
// Widgets
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
'initWidgets' => Widgets::initWidgets(...),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcNamespace;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Database\Structure;
|
use Dotclear\Database\Structure;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent installation class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Install extends Process
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -35,8 +31,8 @@ class Install extends Process
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Database
|
// Database
|
||||||
$s = new Structure(dcCore::app()->con, dcCore::app()->prefix);
|
$s = new Structure(App::con(), App::con()->prefix());
|
||||||
$s->__get(My::TABLE_NAME)
|
$s->__get(Epc::TABLE_NAME)
|
||||||
->field('epc_id', 'bigint', 0, false)
|
->field('epc_id', 'bigint', 0, false)
|
||||||
->field('blog_id', 'varchar', 32, false)
|
->field('blog_id', 'varchar', 32, false)
|
||||||
->field('epc_type', 'varchar', 32, false, "'epc'")
|
->field('epc_type', 'varchar', 32, false, "'epc'")
|
||||||
@ -51,7 +47,7 @@ class Install extends Process
|
|||||||
->index('idx_epc_filter', 'btree', 'epc_filter')
|
->index('idx_epc_filter', 'btree', 'epc_filter')
|
||||||
->index('idx_epc_key', 'btree', 'epc_key');
|
->index('idx_epc_key', 'btree', 'epc_key');
|
||||||
|
|
||||||
(new Structure(dcCore::app()->con, dcCore::app()->prefix))->synchronize($s);
|
(new Structure(App::con(), App::con()->prefix()))->synchronize($s);
|
||||||
$s = null;
|
$s = null;
|
||||||
|
|
||||||
// Uppgrade
|
// Uppgrade
|
||||||
@ -59,10 +55,6 @@ class Install extends Process
|
|||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
$s = My::settings();
|
$s = My::settings();
|
||||||
if (is_null($s)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$s->put('active', false, 'boolean', 'Enable enhancePostContent', false, true);
|
$s->put('active', false, 'boolean', 'Enable enhancePostContent', false, true);
|
||||||
$s->put('list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
$s->put('list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
||||||
$s->put('list_order', 'desc', 'string', 'Admin records list order', false, true);
|
$s->put('list_order', 'desc', 'string', 'Admin records list order', false, true);
|
||||||
@ -86,7 +78,7 @@ class Install extends Process
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -97,7 +89,7 @@ class Install extends Process
|
|||||||
*/
|
*/
|
||||||
public static function growUp(): void
|
public static function growUp(): void
|
||||||
{
|
{
|
||||||
$current = dcCore::app()->getVersion(My::id());
|
$current = App::version()->getVersion(My::id());
|
||||||
|
|
||||||
if ($current && version_compare($current, '0.6.6', '<=')) {
|
if ($current && version_compare($current, '0.6.6', '<=')) {
|
||||||
self::upTo00060607();
|
self::upTo00060607();
|
||||||
@ -122,27 +114,27 @@ class Install extends Process
|
|||||||
private static function upTo00060607(): void
|
private static function upTo00060607(): void
|
||||||
{
|
{
|
||||||
# Move old filters lists from settings to database
|
# Move old filters lists from settings to database
|
||||||
$record = dcCore::app()->con->select('SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . " WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL ");
|
$record = App::con()->select('SELECT * FROM ' . App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME . " WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL ");
|
||||||
|
|
||||||
while ($record->fetch()) {
|
while ($record->fetch()) {
|
||||||
if (preg_match('#enhancePostContent_(.*?)List#', $record->f('setting_id'), $m)) {
|
if (preg_match('#enhancePostContent_(.*?)List#', $record->f('setting_id'), $m)) {
|
||||||
$curlist = @unserialize($record->f('setting_value'));
|
$curlist = @unserialize($record->f('setting_value'));
|
||||||
if (is_array($curlist)) {
|
if (is_array($curlist)) {
|
||||||
foreach ($curlist as $k => $v) {
|
foreach ($curlist as $k => $v) {
|
||||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . My::TABLE_NAME);
|
$cur = App::con()->openCursor(App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
dcCore::app()->con->writeLock(dcCore::app()->prefix . My::TABLE_NAME);
|
App::con()->writeLock(App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
|
|
||||||
$cur->setField('epc_id', (int) dcCore::app()->con->select('SELECT MAX(epc_id) FROM ' . dcCore::app()->prefix . My::TABLE_NAME . ' ')->f(0) + 1);
|
$cur->setField('epc_id', (int) App::con()->select('SELECT MAX(epc_id) FROM ' . App::con()->prefix() . Epc::TABLE_NAME . ' ')->f(0) + 1);
|
||||||
$cur->setField('blog_id', $record->f('blog_id'));
|
$cur->setField('blog_id', $record->f('blog_id'));
|
||||||
$cur->setField('epc_filter', strtolower($m[1]));
|
$cur->setField('epc_filter', strtolower($m[1]));
|
||||||
$cur->setField('epc_key', $k);
|
$cur->setField('epc_key', $k);
|
||||||
$cur->setField('epc_value', $v);
|
$cur->setField('epc_value', $v);
|
||||||
|
|
||||||
$cur->insert();
|
$cur->insert();
|
||||||
dcCore::app()->con->unlock();
|
App::con()->unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dcCore::app()->con->execute('DELETE FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . " WHERE setting_id='" . $record->f('setting_id') . "' AND setting_ns='enhancePostContent' AND blog_id='" . $record->f('blog_id') . "' ");
|
App::con()->execute('DELETE FROM ' . App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME . " WHERE setting_id='" . $record->f('setting_id') . "' AND setting_ns='enhancePostContent' AND blog_id='" . $record->f('blog_id') . "' ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,14 +147,14 @@ class Install extends Process
|
|||||||
private static function upTo20211006(): void
|
private static function upTo20211006(): void
|
||||||
{
|
{
|
||||||
# Move old filter name to filter id
|
# Move old filter name to filter id
|
||||||
$record = dcCore::app()->con->select('SELECT epc_id, epc_filter FROM ' . dcCore::app()->prefix . My::TABLE_NAME);
|
$record = App::con()->select('SELECT epc_id, epc_filter FROM ' . App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
while ($record->fetch()) {
|
while ($record->fetch()) {
|
||||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . My::TABLE_NAME);
|
$cur = App::con()->openCursor(App::con()->prefix() . Epc::TABLE_NAME);
|
||||||
|
|
||||||
$cur->setField('epc_filter', strtolower($record->f('epc_filter')));
|
$cur->setField('epc_filter', strtolower($record->f('epc_filter')));
|
||||||
|
|
||||||
$cur->update('WHERE epc_id = ' . $record->f('epc_id') . ' ');
|
$cur->update('WHERE epc_id = ' . $record->f('epc_id') . ' ');
|
||||||
dcCore::app()->blog?->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,15 +177,15 @@ class Install extends Process
|
|||||||
);
|
);
|
||||||
|
|
||||||
// get all enhancePostContent settings
|
// get all enhancePostContent settings
|
||||||
$record = dcCore::app()->con->select(
|
$record = App::con()->select(
|
||||||
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' .
|
'SELECT * FROM ' . App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME . ' ' .
|
||||||
"WHERE setting_ns = 'enhancePostContent' "
|
"WHERE setting_ns = 'enhancePostContent' "
|
||||||
);
|
);
|
||||||
|
|
||||||
// update settings id, ns, value
|
// update settings id, ns, value
|
||||||
while ($record->fetch()) {
|
while ($record->fetch()) {
|
||||||
if (preg_match('/^enhancePostContent_(.*?)$/', $record->f('setting_id'), $match)) {
|
if (preg_match('/^enhancePostContent_(.*?)$/', $record->f('setting_id'), $match)) {
|
||||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
$cur = App::blogWorkspace()->openBlogWorkspaceCursor();
|
||||||
$cur->setField('setting_id', $match[1]);
|
$cur->setField('setting_id', $match[1]);
|
||||||
$cur->setField('setting_ns', My::id());
|
$cur->setField('setting_ns', My::id());
|
||||||
|
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
@ -42,6 +32,13 @@ use Dotclear\Helper\Html\Html;
|
|||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent manage class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Manage extends Process
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -63,14 +60,14 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check errors
|
// check errors
|
||||||
if (dcCore::app()->error->flag()) {
|
if (App::error()->flag()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open save to other plugins
|
// open save to other plugins
|
||||||
if (!empty($action)) {
|
if (!empty($action)) {
|
||||||
# --BEHAVIOR-- enhancePostContentAdminSave
|
# --BEHAVIOR-- enhancePostContentAdminSave
|
||||||
dcCore::app()->callBehavior('enhancePostContentAdminSave');
|
App::behavior()->callBehavior('enhancePostContentAdminSave');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -89,7 +86,7 @@ class Manage extends Process
|
|||||||
|
|
||||||
My::settings()->put($filter->id(), json_encode($f));
|
My::settings()->put($filter->id(), json_encode($f));
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Filter successfully updated.')
|
__('Filter successfully updated.')
|
||||||
@ -116,7 +113,7 @@ class Manage extends Process
|
|||||||
} else {
|
} else {
|
||||||
EpcRecord::addRecord($cur);
|
EpcRecord::addRecord($cur);
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Filter successfully updated.')
|
__('Filter successfully updated.')
|
||||||
@ -138,7 +135,7 @@ class Manage extends Process
|
|||||||
EpcRecord::delRecord((int) $id);
|
EpcRecord::delRecord((int) $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Filter successfully updated.')
|
__('Filter successfully updated.')
|
||||||
@ -154,7 +151,7 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -191,7 +188,7 @@ class Manage extends Process
|
|||||||
$counter = EpcRecord::getRecords($params, true);
|
$counter = EpcRecord::getRecords($params, true);
|
||||||
$pager = new BackendList($list, (int) $counter->f(0));
|
$pager = new BackendList($list, (int) $counter->f(0));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = $sorts->js(My::manageUrl(['part' => $filter->id()], '&') . '#record');
|
$header = $sorts->js(My::manageUrl(['part' => $filter->id()], '&') . '#record');
|
||||||
@ -205,7 +202,7 @@ class Manage extends Process
|
|||||||
$header .
|
$header .
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAdminHeader
|
# --BEHAVIOR-- enhancePostContentAdminHeader
|
||||||
dcCore::app()->callBehavior('enhancePostContentAdminHeader')
|
App::behavior()->callBehavior('enhancePostContentAdminHeader')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -220,7 +217,7 @@ class Manage extends Process
|
|||||||
echo
|
echo
|
||||||
(new Form('filters_menu'))
|
(new Form('filters_menu'))
|
||||||
->method('get')
|
->method('get')
|
||||||
->action(dcCore::app()->admin->getPageURL())
|
->action(My::manageUrl())
|
||||||
->fields([
|
->fields([
|
||||||
(new Para())
|
(new Para())
|
||||||
->class('anchor-nav')
|
->class('anchor-nav')
|
||||||
@ -268,7 +265,7 @@ class Manage extends Process
|
|||||||
->for('filter_style' . $k),
|
->for('filter_style' . $k),
|
||||||
(new Input(['filter_style[]', 'filter_style' . $k]))
|
(new Input(['filter_style[]', 'filter_style' . $k]))
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlenght(255)
|
->maxlength(255)
|
||||||
->value(Html::escapeHTML($filter->style[$k])),
|
->value(Html::escapeHTML($filter->style[$k])),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -340,7 +337,7 @@ class Manage extends Process
|
|||||||
->for('filter_notag'),
|
->for('filter_notag'),
|
||||||
(new Input('filter_notag'))
|
(new Input('filter_notag'))
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlenght(255)
|
->maxlength(255)
|
||||||
->value(Epc::encodeSingle($filter->notag)),
|
->value(Epc::encodeSingle($filter->notag)),
|
||||||
]),
|
]),
|
||||||
(new Note())
|
(new Note())
|
||||||
@ -372,7 +369,7 @@ class Manage extends Process
|
|||||||
$pager->display(
|
$pager->display(
|
||||||
$sorts,
|
$sorts,
|
||||||
My::manageUrl(array_merge($sorts->values(true), ['page' => '%s']), '#record'),
|
My::manageUrl(array_merge($sorts->values(true), ['page' => '%s']), '#record'),
|
||||||
'<form action="' . dcCore::app()->admin->getPageURL() . '#record" method="post" id="form-records">' .
|
'<form action="' . App::backend()->getPageURL() . '#record" method="post" id="form-records">' .
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
||||||
'<div class="two-cols">' .
|
'<div class="two-cols">' .
|
||||||
@ -401,7 +398,7 @@ class Manage extends Process
|
|||||||
->items([
|
->items([
|
||||||
(new Form('form-create'))
|
(new Form('form-create'))
|
||||||
->method('post')
|
->method('post')
|
||||||
->action(dcCore::app()->admin->getPageURL() . '#record')
|
->action(App::backend()->getPageURL() . '#record')
|
||||||
->fields([
|
->fields([
|
||||||
(new Para())
|
(new Para())
|
||||||
->items([
|
->items([
|
||||||
@ -409,7 +406,7 @@ class Manage extends Process
|
|||||||
->for('new_key'),
|
->for('new_key'),
|
||||||
(new Input('new_key'))
|
(new Input('new_key'))
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlenght(255)
|
->maxlength(255)
|
||||||
->required(true),
|
->required(true),
|
||||||
]),
|
]),
|
||||||
(new Para())
|
(new Para())
|
||||||
@ -418,7 +415,7 @@ class Manage extends Process
|
|||||||
->for('new_value'),
|
->for('new_value'),
|
||||||
(new Input('new_value'))
|
(new Input('new_value'))
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlenght(255)
|
->maxlength(255)
|
||||||
->required(true),
|
->required(true),
|
||||||
]),
|
]),
|
||||||
(new Para())
|
(new Para())
|
||||||
@ -436,7 +433,7 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAdminPage
|
# --BEHAVIOR-- enhancePostContentAdminPage
|
||||||
dcCore::app()->callBehavior('enhancePostContentAdminPage');
|
App::behavior()->callBehavior('enhancePostContentAdminPage');
|
||||||
|
|
||||||
Page::helpBlock('enhancePostContent');
|
Page::helpBlock('enhancePostContent');
|
||||||
Page::closeModule();
|
Page::closeModule();
|
||||||
|
49
src/My.php
49
src/My.php
@ -1,49 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* @brief enhancePostContent My helper.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @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
|
||||||
{
|
{
|
||||||
/** @var string Plugin table name */
|
|
||||||
public const TABLE_NAME = 'epc';
|
|
||||||
|
|
||||||
/** @var array Distributed filters */
|
|
||||||
public const DEFAULT_FILTERS = [
|
|
||||||
Filter\EpcFilterTag::class,
|
|
||||||
Filter\EpcFilterSearch::class,
|
|
||||||
Filter\EpcFilterAcronym::class,
|
|
||||||
Filter\EpcFilterAbbreviation::class,
|
|
||||||
Filter\EpcFilterDefinition::class,
|
|
||||||
Filter\EpcFilterCitation::class,
|
|
||||||
Filter\EpcFilterLink::class,
|
|
||||||
Filter\EpcFilterReplace::class,
|
|
||||||
Filter\EpcFilterUpdate::class,
|
|
||||||
Filter\EpcFilterTwitter::class,
|
|
||||||
];
|
|
||||||
|
|
||||||
public static function checkCustomContext(int $context): ?bool
|
public static function checkCustomContext(int $context): ?bool
|
||||||
{
|
{
|
||||||
return !in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? null :
|
return match ($context) {
|
||||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
// Limit main backend featrues to content admin
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
self::BACKEND, self::MANAGE, self::MENU => App::auth()->check(App::auth()->makePermissions([
|
||||||
]), dcCore::app()->blog->id);
|
App::auth()::PERMISSION_CONTENT_ADMIN,
|
||||||
|
]), App::blog()->id()),
|
||||||
|
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent prepend class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @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
|
||||||
@ -32,14 +29,14 @@ class Prepend extends Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register epc filters
|
// register epc filters
|
||||||
dcCore::app()->addBehavior('enhancePostContentFilters', function (EpcFilters $stack): void {
|
App::behavior()->addBehavior('enhancePostContentFilters', function (EpcFilters $stack): void {
|
||||||
foreach (My::DEFAULT_FILTERS as $class) {
|
foreach (Epc::DEFAULT_FILTERS as $class) {
|
||||||
$stack->add(new $class());
|
$stack->add(new $class());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// register epc filters frontend css
|
// register epc filters frontend css
|
||||||
dcCore::app()->url->register(
|
App::url()->register(
|
||||||
'epccss',
|
'epccss',
|
||||||
'epc.css',
|
'epc.css',
|
||||||
'^epc\.css',
|
'^epc\.css',
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief enhancePostContent uninstall class.
|
||||||
|
* @ingroup enhancePostContent
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Uninstall extends Process
|
class Uninstall extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -27,7 +23,7 @@ class Uninstall extends Process
|
|||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +36,7 @@ class Uninstall extends Process
|
|||||||
->addUserAction(
|
->addUserAction(
|
||||||
'tables',
|
'tables',
|
||||||
'delete',
|
'delete',
|
||||||
My::TABLE_NAME
|
Epc::TABLE_NAME
|
||||||
)
|
)
|
||||||
->addUserAction(
|
->addUserAction(
|
||||||
'plugins',
|
'plugins',
|
||||||
@ -60,7 +56,7 @@ class Uninstall extends Process
|
|||||||
->addDirectAction(
|
->addDirectAction(
|
||||||
'tables',
|
'tables',
|
||||||
'delete',
|
'delete',
|
||||||
My::TABLE_NAME
|
Epc::TABLE_NAME
|
||||||
)
|
)
|
||||||
->addDirectAction(
|
->addDirectAction(
|
||||||
'plugins',
|
'plugins',
|
||||||
|
@ -1,29 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief enhancePostContent, 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\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup DC_PLUGIN_ENHANCEPOSTCONTENT
|
* @brief enhancePostContent widgets class.
|
||||||
* @brief Filter posts content - widgets methods.
|
* @ingroup enhancePostContent
|
||||||
* @since 2.6
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class Widgets
|
class Widgets
|
||||||
{
|
{
|
||||||
@ -37,7 +29,7 @@ class Widgets
|
|||||||
$w->create(
|
$w->create(
|
||||||
'epclist',
|
'epclist',
|
||||||
My::name(),
|
My::name(),
|
||||||
[self::class, 'parseWidget'],
|
self::parseWidget(...),
|
||||||
null,
|
null,
|
||||||
__('List filtered contents.')
|
__('List filtered contents.')
|
||||||
);
|
);
|
||||||
@ -94,7 +86,7 @@ class Widgets
|
|||||||
|
|
||||||
# Page
|
# Page
|
||||||
if (!My::settings()->get('active')
|
if (!My::settings()->get('active')
|
||||||
|| !in_array(dcCore::app()->ctx?->__get('current_tpl'), ['post.html', 'page.html'])
|
|| !in_array(App::frontend()->context()->__get('current_tpl'), ['post.html', 'page.html'])
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user