rename main class
This commit is contained in:
parent
fa3457e278
commit
9be8e6bac7
12
_admin.php
12
_admin.php
@ -41,8 +41,8 @@ dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $f
|
||||
# Preference form
|
||||
dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function (dcSettings $blog_settings) {
|
||||
$active = (bool) $blog_settings->enhancePostContent->enhancePostContent_active;
|
||||
$allowedtplvalues = libEPC::blogAllowedTplValues();
|
||||
$allowedpubpages = libEPC::blogAllowedPubPages();
|
||||
$allowedtplvalues = enhancePostContent::blogAllowedTplValues();
|
||||
$allowedpubpages = enhancePostContent::blogAllowedPubPages();
|
||||
|
||||
echo
|
||||
'<div class="fieldset"><h4 id="epc_params">' . __('Enhance post content') . '</h4>' .
|
||||
@ -61,10 +61,10 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function (dcSettings $b
|
||||
'<h5>' . __('Extra') . '</h5>' .
|
||||
'<p>' . __('This is a special feature to edit list of allowed template values and public pages where this plugin works.') . '</p>' .
|
||||
'<p><label for="epc_allowedtplvalues">' . __('Allowed DC template values:') . '</label>' .
|
||||
form::field('epc_allowedtplvalues', 100, 0, libEPC::implode($allowedtplvalues)) . '</p>' .
|
||||
form::field('epc_allowedtplvalues', 100, 0, enhancePostContent::implode($allowedtplvalues)) . '</p>' .
|
||||
'<p class="form-note">' . __('Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".') . '</p>' .
|
||||
'<p><label for="epc_allowedpubpages">' . __('Allowed public pages:') . '</label>' .
|
||||
form::field('epc_allowedpubpages', 100, 0, libEPC::implode($allowedpubpages)) . '</p>' .
|
||||
form::field('epc_allowedpubpages', 100, 0, enhancePostContent::implode($allowedpubpages)) . '</p>' .
|
||||
'<p class="form-note">' . __('Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".') . '</p>' .
|
||||
'</div>' .
|
||||
'</div>' .
|
||||
@ -75,8 +75,8 @@ dcCore::app()->addBehavior('adminBlogPreferencesFormV2', function (dcSettings $b
|
||||
# Save preference
|
||||
dcCore::app()->addBehavior('adminBeforeBlogSettingsUpdate', function (dcSettings $blog_settings) {
|
||||
$active = !empty($_POST['epc_active']);
|
||||
$allowedtplvalues = libEPC::explode($_POST['epc_allowedtplvalues']);
|
||||
$allowedpubpages = libEPC::explode($_POST['epc_allowedpubpages']);
|
||||
$allowedtplvalues = enhancePostContent::explode($_POST['epc_allowedtplvalues']);
|
||||
$allowedpubpages = enhancePostContent::explode($_POST['epc_allowedpubpages']);
|
||||
|
||||
$blog_settings->enhancePostContent->put('enhancePostContent_active', $active);
|
||||
$blog_settings->enhancePostContent->put('enhancePostContent_allowedtplvalues', serialize($allowedtplvalues));
|
||||
|
@ -52,11 +52,11 @@ try {
|
||||
$s->put('enhancePostContent_list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
||||
$s->put('enhancePostContent_list_order', 'desc', 'string', 'Admin records list order', false, true);
|
||||
$s->put('enhancePostContent_list_nb', 20, 'integer', 'Admin records list nb per page', false, true);
|
||||
$s->put('enhancePostContent_allowedtplvalues', serialize(libEPC::defaultAllowedTplValues()), 'string', 'List of allowed template values', false, true);
|
||||
$s->put('enhancePostContent_allowedpubpages', serialize(libEPC::defaultAllowedPubPages()), 'string', 'List of allowed template pages', false, true);
|
||||
$s->put('enhancePostContent_allowedtplvalues', serialize(enhancePostContent::defaultAllowedTplValues()), 'string', 'List of allowed template values', false, true);
|
||||
$s->put('enhancePostContent_allowedpubpages', serialize(enhancePostContent::defaultAllowedPubPages()), 'string', 'List of allowed template pages', false, true);
|
||||
|
||||
# Filters settings
|
||||
$filters = libEPC::getFilters();
|
||||
$filters = enhancePostContent::getFilters();
|
||||
foreach ($filters as $id => $filter) {
|
||||
# Only editable options
|
||||
$opt = [
|
||||
|
12
_prepend.php
12
_prepend.php
@ -30,14 +30,14 @@ $filters = [
|
||||
$d = __DIR__ . '/inc/';
|
||||
|
||||
Clearbricks::lib()->autoload([
|
||||
'libEPC' => $d . 'lib.epc.php',
|
||||
'epcFilter' => $d . 'lib.epc.filter.php',
|
||||
'epcRecords' => $d . 'lib.epc.records.php',
|
||||
'adminEpcList' => $d . 'lib.epc.pager.php',
|
||||
'enhancePostContent' => $d . 'class.enhancepostcontent.php',
|
||||
'epcFilter' => $d . 'class.epcfilter.php',
|
||||
'epcRecords' => $d . 'class.epcrecords.php',
|
||||
'adminEpcList' => $d . 'class.adminepclist.php',
|
||||
]);
|
||||
|
||||
foreach ($filters as $f) {
|
||||
Clearbricks::lib()->autoload(['epcFilter' . $f => $d . 'lib.epc.filters.php']);
|
||||
Clearbricks::lib()->autoload(['epcFilter' . $f => $d . 'class.epcfilter' . strtolower($f) . '.php']);
|
||||
dcCore::app()->addBehavior('enhancePostContentFilters', ['epcFilter' . $f, 'create']);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ dcCore::app()->url->register(
|
||||
'^epc\.css',
|
||||
function ($args) {
|
||||
$css = [];
|
||||
$filters = libEPC::getFilters();
|
||||
$filters = enhancePostContent::getFilters();
|
||||
|
||||
foreach ($filters as $id => $filter) {
|
||||
if ('' == $filter->class || '' == $filter->style) {
|
||||
|
@ -28,10 +28,10 @@ dcCore::app()->addBehavior('publicHeadContent', function () {
|
||||
});
|
||||
// Filter template blocks content
|
||||
dcCore::app()->addBehavior('publicBeforeContentFilterV2', function ($tag, $args) {
|
||||
$filters = libEPC::getFilters();
|
||||
$filters = enhancePostContent::getFilters();
|
||||
|
||||
foreach ($filters as $id => $filter) {
|
||||
if (!libEPC::testContext($tag, $args, $filter)) {
|
||||
if (!enhancePostContent::testContext($tag, $args, $filter)) {
|
||||
continue;
|
||||
}
|
||||
$filter->publicContent($tag, $args);
|
||||
|
@ -50,7 +50,7 @@ class enhancePostContentWidget
|
||||
'text'
|
||||
);
|
||||
# Type
|
||||
$filters = libEPC::getFilters();
|
||||
$filters = enhancePostContent::getFilters();
|
||||
$types = [];
|
||||
foreach ($filters as $id => $filter) {
|
||||
$types[$filter->name] = $id;
|
||||
@ -63,7 +63,7 @@ class enhancePostContentWidget
|
||||
$types
|
||||
);
|
||||
# Content
|
||||
$contents = libEPC::defaultAllowedWidgetValues();
|
||||
$contents = enhancePostContent::defaultAllowedWidgetValues();
|
||||
foreach ($contents as $k => $v) {
|
||||
$w->epclist->setting(
|
||||
'content' . $v['id'],
|
||||
@ -122,7 +122,7 @@ class enhancePostContentWidget
|
||||
|
||||
# Content
|
||||
$content = '';
|
||||
foreach (libEPC::defaultAllowedWidgetValues() as $k => $v) {
|
||||
foreach (enhancePostContent::defaultAllowedWidgetValues() as $k => $v) {
|
||||
$ns = 'content' . $v['id'];
|
||||
if ($w->$ns && is_callable($v['cb'])) {
|
||||
$content .= call_user_func_array(
|
||||
@ -138,7 +138,7 @@ class enhancePostContentWidget
|
||||
|
||||
# Filter
|
||||
$list = [];
|
||||
$filters = libEPC::getFilters();
|
||||
$filters = enhancePostContent::getFilters();
|
||||
|
||||
if (isset($filters[$w->type])) {
|
||||
$filters[$w->type]->nocase = $w->nocase;
|
||||
|
@ -21,7 +21,7 @@ __('search results page');
|
||||
__('atom feeds');
|
||||
__('RSS feeds');
|
||||
|
||||
class libEPC
|
||||
class enhancePostContent
|
||||
{
|
||||
protected static $default_filters = null;
|
||||
public static $epcFilterLimit = [];
|
||||
@ -56,15 +56,15 @@ class libEPC
|
||||
$rs = new arrayObject([
|
||||
'entry excerpt' => [
|
||||
'id' => 'entryexcerpt',
|
||||
'cb' => ['libEPC','widgetContentEntryExcerpt'],
|
||||
'cb' => ['enhancePostContent','widgetContentEntryExcerpt'],
|
||||
],
|
||||
'entry content' => [
|
||||
'id' => 'entrycontent',
|
||||
'cb' => ['libEPC','widgetContentEntryContent'],
|
||||
'cb' => ['enhancePostContent','widgetContentEntryContent'],
|
||||
],
|
||||
'comment content' => [
|
||||
'id' => 'commentcontent',
|
||||
'cb' => ['libEPC','widgetContentCommentContent'],
|
||||
'cb' => ['enhancePostContent','widgetContentCommentContent'],
|
||||
],
|
||||
]);
|
||||
|
||||
@ -164,7 +164,7 @@ class libEPC
|
||||
$tags = implode('|', $ignore_tags);
|
||||
}
|
||||
if (!empty($tags)) {
|
||||
$s = preg_replace_callback('#(<(' . $tags . ')[^>]*?>)(.*?)(</\\2>)#s', ['libEPC', 'removeTags'], $s);
|
||||
$s = preg_replace_callback('#(<(' . $tags . ')[^>]*?>)(.*?)(</\\2>)#s', ['enhancePostContent', 'removeTags'], $s);
|
||||
}
|
||||
# Remove words inside html tag (class, title, alt, href, ...)
|
||||
$s = preg_replace('#(ççççç(' . $p . '(s|))ççççç)(?=[^<]+>)#s' . $i, '$2$4', $s);
|
||||
|
@ -20,7 +20,7 @@ dcPage::check(dcCore::app()->auth->makePermissions([
|
||||
|
||||
# -- Prepare queries and object --
|
||||
|
||||
$_filters = libEPC::getFilters();
|
||||
$_filters = enhancePostContent::getFilters();
|
||||
|
||||
$filters_id = $filters_combo = [];
|
||||
foreach ($_filters as $id => $filter) {
|
||||
@ -196,7 +196,7 @@ echo '
|
||||
<div class="two-boxes odd">
|
||||
<h4>' . __('Pages to be filtered') . '</h4>';
|
||||
|
||||
foreach (libEPC::blogAllowedPubPages() as $k => $v) {
|
||||
foreach (enhancePostContent::blogAllowedPubPages() as $k => $v) {
|
||||
echo '
|
||||
<p><label for="filter_pubPages' . $v . '">' .
|
||||
form::checkbox(
|
||||
@ -228,7 +228,7 @@ form::number('filter_limit', ['min' => 0, 'max' => 99, 'default' => (int) $filte
|
||||
</div><div class="two-boxes odd">
|
||||
<h4>' . __('Contents to be filtered') . '</h4>';
|
||||
|
||||
foreach (libEPC::blogAllowedTplValues() as $k => $v) {
|
||||
foreach (enhancePostContent::blogAllowedTplValues() as $k => $v) {
|
||||
echo '
|
||||
<p><label for="filter_tplValues' . $v . '">' .
|
||||
form::checkbox(
|
||||
|
Loading…
Reference in New Issue
Block a user