release 2023.10.08
This commit is contained in:
parent
7495252f13
commit
aa05e6e1b5
16 changed files with 133 additions and 135 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
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
|
||||||
|
|
28
README.md
28
README.md
|
@ -1,27 +1,22 @@
|
||||||
# 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.08-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.08-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:
|
|
||||||
|
|
||||||
* admin permissions to set up plugin
|
* admin permissions to set up plugin
|
||||||
* content admin permissions to manage fitlers
|
* content admin permissions to manage fitlers
|
||||||
* Dotclear 2.27
|
* Dotclear 2.28
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
@ -40,7 +35,12 @@ you should also add widgets.
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/enhancePostContent) or [GitHub Page](https://github.com/JcDenis/enhancePostContent)
|
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/enhancePostContent) or [GitHub Page](https://github.com/JcDenis/enhancePostContent)
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) or [Dotaddict Page](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)
|
||||||
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?id=40876)
|
|
||||||
|
* [License](https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/LICENSE)
|
||||||
|
* [Packages & details](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/enhancePostContent))
|
||||||
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/enhancePostContent) (or on [GitHub](https://github.com/JcDenis/enhancePostContent))
|
||||||
|
* [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
|
||||||
|
|
||||||
|
|
11
_define.php
11
_define.php
|
@ -10,9 +10,8 @@
|
||||||
* @copyright Jean-Christian Denis
|
* @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')) {
|
|
||||||
return null;
|
use Dotclear\App;
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Enhance post content',
|
'Enhance post content',
|
||||||
|
@ -22,10 +21,10 @@ $this->registerModule(
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [
|
||||||
['php', '8.1'],
|
['php', '8.1'],
|
||||||
['core', '2.27'],
|
['core', '2.28'],
|
||||||
],
|
],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => App::auth()->makePermissions([
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
App::auth()::PERMISSION_CONTENT_ADMIN,
|
||||||
]),
|
]),
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'blog' => '#params.epc_params',
|
'blog' => '#params.epc_params',
|
||||||
|
|
|
@ -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.08</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.08/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>
|
||||||
|
|
|
@ -15,9 +15,9 @@ 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\BlogSettings;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -45,7 +45,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 +53,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 (BlogSettings $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();
|
||||||
|
@ -123,7 +123,7 @@ class Backend extends Process
|
||||||
->render();
|
->render();
|
||||||
},
|
},
|
||||||
// backend user preference save
|
// backend user preference save
|
||||||
'adminBeforeBlogSettingsUpdate' => function (dcSettings $blog_settings): void {
|
'adminBeforeBlogSettingsUpdate' => function (BlogSettings $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']);
|
||||||
|
|
30
src/Epc.php
30
src/Epc.php
|
@ -15,7 +15,7 @@ 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;
|
||||||
|
@ -56,7 +56,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);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class Epc
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# --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 +118,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 +149,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 +375,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()->ctx->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->ctx->__get('posts')?->fetch()) {
|
||||||
$content .= dcCore::app()->ctx->__get('posts')->f('post_excerpt');
|
$content .= App::frontend()->__get('posts')->f('post_excerpt');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
@ -396,13 +396,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()->ctx->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->ctx->__get('posts')?->fetch()) {
|
||||||
$content .= dcCore::app()->ctx->__get('posts')->f('post_content');
|
$content .= dApp::frontend()->ctx->__get('posts')->f('post_content');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
@ -417,13 +417,13 @@ 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()->ctx->exists('posts')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
while (dcCore::app()->ctx->__get('posts')?->fetch()) {
|
while (App::frontend()->ctx->__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()->ctx->__get('posts')->f('post_id')]);
|
||||||
while ($comments?->fetch()) {
|
while ($comments?->fetch()) {
|
||||||
$content .= $comments->__call('getContent', []);
|
$content .= $comments->__call('getContent', []);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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
|
||||||
|
@ -48,19 +48,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() . My::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 +68,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 +80,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 +99,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 +121,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() . My::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 +159,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 +196,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() . My::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 +214,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() . My::TABLE_NAME . ' '
|
||||||
)->f(0) + 1;
|
)->f(0) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,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() . My::TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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;
|
||||||
|
|
||||||
|
@ -48,11 +48,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(
|
||||||
|
|
|
@ -15,7 +15,7 @@ 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;
|
||||||
|
@ -49,16 +49,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 +67,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
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,8 +14,7 @@ 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;
|
||||||
|
|
||||||
class Frontend extends Process
|
class Frontend extends Process
|
||||||
|
@ -31,16 +30,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()->ctx->__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'])
|
||||||
|
|
|
@ -14,8 +14,7 @@ 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;
|
||||||
|
@ -35,7 +34,7 @@ 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(My::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)
|
||||||
|
@ -51,7 +50,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 +58,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 +81,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 +92,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 +117,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() . My::TABLE_NAME);
|
||||||
dcCore::app()->con->writeLock(dcCore::app()->prefix . My::TABLE_NAME);
|
App::con()->writeLock(App::con()->prefix() . My::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() . My::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 +150,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() . My::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() . My::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 +180,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());
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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,
|
||||||
|
@ -63,14 +63,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 +89,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 +116,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 +138,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 +154,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 +191,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 +205,7 @@ class Manage extends Process
|
||||||
$header .
|
$header .
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAdminHeader
|
# --BEHAVIOR-- enhancePostContentAdminHeader
|
||||||
dcCore::app()->callBehavior('enhancePostContentAdminHeader')
|
App::behavior()->callBehavior('enhancePostContentAdminHeader')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -220,7 +220,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')
|
||||||
|
@ -372,7 +372,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 +401,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([
|
||||||
|
@ -436,7 +436,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();
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,8 +42,8 @@ class My extends MyPlugin
|
||||||
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 !in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? null :
|
||||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
App::auth()->check(App::auth()->makePermissions([
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
App::auth()::PERMISSION_CONTENT_ADMIN,
|
||||||
]), dcCore::app()->blog->id);
|
]), App::blog()->id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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;
|
||||||
|
|
||||||
|
@ -32,14 +32,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 (My::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',
|
||||||
|
|
|
@ -14,7 +14,6 @@ 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;
|
||||||
|
|
||||||
|
@ -27,7 +26,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ 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;
|
||||||
|
@ -94,7 +94,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()->ctx->__get('current_tpl'), ['post.html', 'page.html'])
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue