Compare commits
10 Commits
88ff5412fb
...
b2b003a125
Author | SHA1 | Date |
---|---|---|
Jean-Christian Paul Denis | b2b003a125 | |
Jean-Christian Paul Denis | f17d032a00 | |
Jean-Christian Paul Denis | 4cf4cf1bd9 | |
Jean-Christian Paul Denis | de34bd1b79 | |
Jean-Christian Paul Denis | 963568f7d8 | |
Jean-Christian Paul Denis | 0cf94448ea | |
Jean-Christian Paul Denis | 4c6eef040f | |
Jean-Christian Paul Denis | 35697890a1 | |
Jean-Christian Paul Denis | 3a33babb3d | |
Jean-Christian Paul Denis | 73acccce65 |
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,3 +1,22 @@
|
|||
todo:
|
||||
- cleanup plugin importExport features
|
||||
|
||||
2023.05.13
|
||||
- require dotclear 2.26
|
||||
- require PHP 8.0+
|
||||
- use define php_min
|
||||
- fix post editor
|
||||
|
||||
2023.04.26
|
||||
- require dotclear 2.26
|
||||
- require PHP 8.0+
|
||||
- use namespace
|
||||
- use sql statement
|
||||
- add use columns preference
|
||||
- add list filters
|
||||
- add plugin Uninstaller features (no direct actions)
|
||||
- various fixes
|
||||
|
||||
2022.12.23
|
||||
- use SVG icon
|
||||
- use constant for table name
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[![Release](https://img.shields.io/github/v/release/JcDenis/postWidgetText)](https://github.com/JcDenis/postWidgetText/releases)
|
||||
[![Date](https://img.shields.io/github/release-date/JcDenis/postWidgetText)](https://github.com/JcDenis/postWidgetText/releases)
|
||||
[![Issues](https://img.shields.io/github/issues/JcDenis/postWidgetText)](https://github.com/JcDenis/postWidgetText/issues)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/postWidgetText)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/postWidgetText)](https://github.com/JcDenis/postWidgetText/blob/master/LICENSE)
|
||||
|
||||
|
@ -20,7 +20,8 @@ Add a widget related to an entry with custom titles and content.
|
|||
|
||||
* permissions to manage widgets
|
||||
* permissions to manage entries
|
||||
* Dotclear 2.20
|
||||
* Dotclear 2.26
|
||||
* PHP 8.0+
|
||||
|
||||
Note this plugin add table called post_option to Dotclear database.
|
||||
|
||||
|
|
|
@ -18,9 +18,12 @@ $this->registerModule(
|
|||
'Post widget text',
|
||||
'Add a widget with a text related to an entry',
|
||||
'Jean-Christian Denis and Contributors',
|
||||
'2022.12.23',
|
||||
'2023.05.13',
|
||||
[
|
||||
'requires' => [['core', '2.24']],
|
||||
'requires' => [
|
||||
['php', '8.0'],
|
||||
['core', '2.26'],
|
||||
],
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcCore::app()->auth::PERMISSION_USAGE,
|
||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="postWidgetText">
|
||||
<name>Post widget text</name>
|
||||
<version>2022.12.23</version>
|
||||
<version>2023.05.13</version>
|
||||
<author>Jean-Christian Denis and Contributors</author>
|
||||
<desc>Add a widget with a text related to an entry</desc>
|
||||
<file>https://github.com/JcDenis/postWidgetText/releases/download/v2022.12.23/plugin-postWidgetText.zip</file>
|
||||
<da:dcmin>2.24</da:dcmin>
|
||||
<file>https://github.com/JcDenis/postWidgetText/releases/download/v2023.05.13/plugin-postWidgetText.zip</file>
|
||||
<da:dcmin>2.26</da:dcmin>
|
||||
<da:details>https://plugins.dotaddict.org/dc2/details/postWidgetText</da:details>
|
||||
<da:support>https://github.com/JcDenis/postWidgetText</da:support>
|
||||
</module>
|
||||
|
|
|
@ -9,25 +9,27 @@
|
|||
# DOT NOT MODIFY THIS FILE !
|
||||
#
|
||||
|
||||
l10n::$locales['Post widget text'] = 'Widget texte de billet';
|
||||
l10n::$locales['Add a widget with a text related to an entry'] = 'Ajouter un widget avec du texte relatif à un billet';
|
||||
l10n::$locales['More about this entry'] = 'En savoir plus sur ce billet';
|
||||
l10n::$locales['Use excerpt if no content'] = 'Utiliser le résumé si le widget n\'a pas de contenu';
|
||||
l10n::$locales['Show widget even if empty'] = 'Afficher le widget même si il est vide';
|
||||
l10n::$locales['You are not allowed to create an entry text widget'] = 'Vous n\'êtes pas autorisé à créer un widget texte sur ce billet';
|
||||
l10n::$locales['You are not allowed to update entries text widget'] = 'Vous n\'êtes pas autorisé à modifier les widgets texte des billets';
|
||||
l10n::$locales['You are not allowed to delete this entry text widget'] = 'Vous n\'êtes pas autorisé à effacer le widget texte de ce billet';
|
||||
l10n::$locales['You are not allowed to delete entries text widget'] = 'Vous n\'êtes pas autorisé à effacer les widgets texte des billets';
|
||||
l10n::$locales['Post title'] = 'Titre du billet';
|
||||
l10n::$locales['Post date'] = 'Date du billet';
|
||||
l10n::$locales['Widget title'] = 'Titre du widget';
|
||||
l10n::$locales['Widget date'] = 'Date du widget';
|
||||
l10n::$locales['Enable post widget text on this blog'] = 'Activer les widgets texte de billet sur ce blog';
|
||||
l10n::$locales['Enable import/export behaviors'] = 'Activer les fonctions d\'import/export';
|
||||
l10n::$locales['Additional widget'] = 'Widget additionnel';
|
||||
l10n::$locales['Widget title:'] = 'Titre du widget :';
|
||||
l10n::$locales['Wigdet text:'] = 'Texte du widget :';
|
||||
l10n::$locales['No widget'] = 'Pas de widget';
|
||||
l10n::$locales['Posts widgets successfully delete.'] = 'Widgets de billets effacés.';
|
||||
l10n::$locales['Posts widgets'] = 'Widgets de billets';
|
||||
l10n::$locales['Delete selected widgets'] = 'Effacer les widgets texte selectionnés';
|
||||
use Dotclear\Helper\L10n;
|
||||
|
||||
L10n::$locales['Post widget text'] = 'Widget texte de billet';
|
||||
L10n::$locales['Add a widget with a text related to an entry'] = 'Ajouter un widget avec du texte relatif à un billet';
|
||||
L10n::$locales['More about this entry'] = 'En savoir plus sur ce billet';
|
||||
L10n::$locales['Use excerpt if no content'] = 'Utiliser le résumé si le widget n\'a pas de contenu';
|
||||
L10n::$locales['Show widget even if empty'] = 'Afficher le widget même si il est vide';
|
||||
L10n::$locales['You are not allowed to create an entry text widget'] = 'Vous n\'êtes pas autorisé à créer un widget texte sur ce billet';
|
||||
L10n::$locales['You are not allowed to update entries text widget'] = 'Vous n\'êtes pas autorisé à modifier les widgets texte des billets';
|
||||
L10n::$locales['You are not allowed to delete this entry text widget'] = 'Vous n\'êtes pas autorisé à effacer le widget texte de ce billet';
|
||||
L10n::$locales['You are not allowed to delete entries text widget'] = 'Vous n\'êtes pas autorisé à effacer les widgets texte des billets';
|
||||
L10n::$locales['Post title'] = 'Titre du billet';
|
||||
L10n::$locales['Post date'] = 'Date du billet';
|
||||
L10n::$locales['Widget title'] = 'Titre du widget';
|
||||
L10n::$locales['Widget date'] = 'Date du widget';
|
||||
L10n::$locales['Enable post widget text on this blog'] = 'Activer les widgets texte de billet sur ce blog';
|
||||
L10n::$locales['Enable import/export behaviors'] = 'Activer les fonctions d\'import/export';
|
||||
L10n::$locales['Additional widget'] = 'Widget additionnel';
|
||||
L10n::$locales['Widget title:'] = 'Titre du widget :';
|
||||
L10n::$locales['Wigdet text:'] = 'Texte du widget :';
|
||||
L10n::$locales['No widget'] = 'Pas de widget';
|
||||
L10n::$locales['Posts widgets successfully delete.'] = 'Widgets de billets effacés.';
|
||||
L10n::$locales['Posts widgets'] = 'Widgets de billets';
|
||||
L10n::$locales['Delete selected widgets'] = 'Effacer les widgets texte selectionnés';
|
||||
|
|
|
@ -24,7 +24,6 @@ class Backend extends dcNsProcess
|
|||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& My::phpCompliant()
|
||||
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
|
||||
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||
dcCore::app()->auth::PERMISSION_USAGE,
|
||||
|
@ -67,6 +66,7 @@ class Backend extends dcNsProcess
|
|||
'adminBeforeBlogSettingsUpdate' => [BackendBehaviors::class, 'adminBeforeBlogSettingsUpdate'],
|
||||
// post
|
||||
'adminPostHeaders' => [BackendBehaviors::class, 'adminPostHeaders'],
|
||||
'adminPostEditorTags' => [BackendBehaviors::class, 'adminPostEditorTags'],
|
||||
'adminPostFormItems' => [BackendBehaviors::class, 'adminPostFormItems'],
|
||||
'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostSave'],
|
||||
'adminAfterPostCreate' => [BackendBehaviors::class, 'adminAfterPostSave'],
|
||||
|
|
|
@ -149,15 +149,22 @@ class BackendBehaviors
|
|||
*/
|
||||
public static function adminPostHeaders(): string
|
||||
{
|
||||
if (is_null(dcCore::app()->auth) || !Utils::isActive()) {
|
||||
return '';
|
||||
return dcPage::jsModuleLoad(My::id() . '/js/backend.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add editor to post tags.
|
||||
*
|
||||
* @param string $editor The editor name (ie dcCKEditor)
|
||||
* @param string $context The editor context (ie post)
|
||||
* @param ArrayObject $alt_tags The editor target (ie textarea id)
|
||||
* @param string $format The editor format (ie xhtml)
|
||||
*/
|
||||
public static function adminPostEditorTags(string $editor, string $context, ArrayObject $alt_tags, string $format): void
|
||||
{
|
||||
if ($context == 'post') {
|
||||
$alt_tags->append('#post_wtext');
|
||||
}
|
||||
|
||||
$editor = dcCore::app()->auth->getOption('editor');
|
||||
|
||||
return
|
||||
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') .
|
||||
dcPage::jsModuleLoad(My::id() . '/js/backend.js');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +261,7 @@ class BackendBehaviors
|
|||
/**
|
||||
* Delete widget text on post deletion.
|
||||
*
|
||||
* @param int The post ID
|
||||
* @param int $post_id The post ID
|
||||
*/
|
||||
public static function adminBeforePostDelete(int $post_id): void
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ class Frontend extends dcNsProcess
|
|||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = My::phpCompliant();
|
||||
static::$init = defined('DC_RC_PATH');
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ class Install extends dcNsProcess
|
|||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& My::phpCompliant()
|
||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
||||
|
||||
return static::$init;
|
||||
|
|
|
@ -29,7 +29,6 @@ class Manage extends dcNsProcess
|
|||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& My::phpCompliant()
|
||||
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
|
||||
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||
dcCore::app()->auth::PERMISSION_USAGE,
|
||||
|
|
|
@ -121,7 +121,7 @@ class ManageList extends adminGenericListV2
|
|||
// display list footer
|
||||
echo
|
||||
'</tbody></table></div>' .
|
||||
($blocks[1] ?? '').
|
||||
($blocks[1] ?? '') .
|
||||
$pager->getLinks();
|
||||
}
|
||||
}
|
||||
|
|
21
src/My.php
21
src/My.php
|
@ -17,18 +17,15 @@ namespace Dotclear\Plugin\postWidgetText;
|
|||
use dcCore;
|
||||
|
||||
/**
|
||||
* module definitions shortcuts
|
||||
* This module definitions.
|
||||
*/
|
||||
class My
|
||||
{
|
||||
/** @var string Required php version */
|
||||
public const PHP_MIN = '8.1';
|
||||
|
||||
/** @var string Plugin table name */
|
||||
/** @var string Plugin table name */
|
||||
public const TABLE_NAME = 'post_option';
|
||||
|
||||
/**
|
||||
* This module id
|
||||
* This module id.
|
||||
*/
|
||||
public static function id(): string
|
||||
{
|
||||
|
@ -36,18 +33,20 @@ class My
|
|||
}
|
||||
|
||||
/**
|
||||
* This module name
|
||||
* This module name.
|
||||
*/
|
||||
public static function name(): string
|
||||
{
|
||||
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
|
||||
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
||||
|
||||
return __(is_string($name) ? $name : self::id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check php version
|
||||
* This module path.
|
||||
*/
|
||||
public static function phpCompliant(): bool
|
||||
public static function path(): string
|
||||
{
|
||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
||||
return dirname(__DIR__);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue