diff --git a/CHANGELOG.md b/CHANGELOG.md index e897ccc..5639cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,14 @@ enhancePostContent xxxx.xx.xx * Not added priority on filters for replacement order * Not added priority on lists of filters for replacement order * Not added auto-find post title in content - * move settings from plugin to blog -enhancePostContent 2021.08.xx +enhancePostContent 2021.08.24 * switch to Dotclear 2.19 * switch to php 7.3+ and php 8.0.x * switch to Github * update license * update php code to PSR-2 and short array + * move settings from plugin to blog enhancePostContent 2013.11.08 * Switch to Dotclear 2.6 (admin styles and settings) diff --git a/README.md b/README.md index b7ffbcb..0747c91 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,7 @@ atgs, acronyms, abbreviations, definition, citation, link, etc... First install enhancePostContent, manualy from a zip package or from Dotaddict repository. (See Dotclear's documentation to know how do this) -Go to ''plugins manager'', expand enhancePostContent information then -go to ''configure plugin'', fill in form. +Go to ''blog preference'' => fieldset ''plugin preference', fill in form. Once it's done you can manage filters from menu ''Enhance Post Content'' on sidebar or you can add dashboard icon, diff --git a/_admin.php b/_admin.php index a6b1a91..e05faae 100644 --- a/_admin.php +++ b/_admin.php @@ -15,6 +15,8 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } +$core->blog->settings->addNamespace('enhancePostContent'); + require dirname(__FILE__) . '/_widgets.php'; # Admin menu @@ -33,6 +35,14 @@ $core->addBehavior( 'adminDashboardFavorites', ['epcAdminBehaviors', 'adminDashboardFavorites'] ); +$core->addBehavior( + 'adminBlogPreferencesForm', + ['epcAdminBehaviors', 'adminBlogPreferencesForm'] +); +$core->addBehavior( + 'adminBeforeBlogSettingsUpdate', + ['epcAdminBehaviors', 'adminBeforeBlogSettingsUpdate'] +); class epcAdminBehaviors { @@ -57,4 +67,83 @@ class epcAdminBehaviors && isset($params['p']) && $params['p'] == 'enhancePostContent'; } + + public static function sortbyCombo() + { + return [ + __('Date') => 'epc_upddt', + __('Key') => 'epc_key', + __('Value') => 'epc_value', + __('ID') => 'epc_id' + ]; + } + + public static function orderCombo() + { + return [ + __('Ascending') => 'asc', + __('Descending') => 'desc' + ]; + } + + public static function adminBlogPreferencesForm(dcCore $core, dcSettings $blog_settings) + { + $active = (boolean) $blog_settings->enhancePostContent->enhancePostContent_active; + $list_sortby = (string) $blog_settings->enhancePostContent->enhancePostContent_list_sortby; + $list_order = (string) $blog_settings->enhancePostContent->enhancePostContent_list_order; + $list_nb = (integer) $blog_settings->enhancePostContent->enhancePostContent_list_nb; + $_filters = libEPC::blogFilters(); + $allowedtplvalues = libEPC::blogAllowedTplValues(); + $allowedpubpages = libEPC::blogAllowedPubPages(); + + echo + '
' . + __('This enable public widgets and contents filter.') . + '
' . + '' . __('This is the default order of records lists.') . '
' . + '' . + form::combo('epc_list_sortby', self::sortbyCombo(), $list_sortby) . '
' . + '' . + form::combo('epc_list_order', self::orderCombo(), $list_order) . '
' . + '' . + form::field('epc_list_nb', 3, 3, $list_nb) . '
' . + '' . __('This is a special feature to edit list of allowed template values and public pages where this plugin works.') . '
' . + '' . + form::field('epc_allowedtplvalues', 100, 0, libEPC::implode($allowedtplvalues)) . '
' . + '' . __('Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".') . '
' . + '' . + form::field('epc_allowedpubpages', 100, 0, libEPC::implode($allowedpubpages)) . '
' . + '' . __('Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".') . '
' . + ''.__('This enable public widgets and contents filter.').'
- - - -'.__('This is the default order of records lists.').'
- -'. -form::combo('list_sortby', $sortby_combo, $list_sortby).'
- -'. -form::combo('list_order', $order_combo, $list_order).'
- -'. -form::field('list_nb', 3, 3, $list_nb).'
- -'.__('This is a special feature to edit list of allowed template values and public pages where this plugin works.').'
- -'. -form::field('allowedtplvalues', 100,0, libEPC::implode($allowedtplvalues)).'
-'.__('Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".').'
- -'. -form::field('allowedpubpages', 100, 0, libEPC::implode($allowedpubpages)).'
-'.__('Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".').'
- -