fix PSR coding style
This commit is contained in:
parent
d416fc3c33
commit
a10ab12580
16 changed files with 283 additions and 268 deletions
|
@ -10,7 +10,6 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +88,7 @@ class epcAdminBehaviors
|
||||||
$allowedpubpages = libEPC::blogAllowedPubPages();
|
$allowedpubpages = libEPC::blogAllowedPubPages();
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<div class="fieldset"><h4 id="epc_params">' . __('Enhance post content') .'</h4>' .
|
'<div class="fieldset"><h4 id="epc_params">' . __('Enhance post content') . '</h4>' .
|
||||||
'<div class="two-cols">' .
|
'<div class="two-cols">' .
|
||||||
'<div class="col">' .
|
'<div class="col">' .
|
||||||
'<p><label class="classic">' .
|
'<p><label class="classic">' .
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
18
_install.php
18
_install.php
|
@ -10,7 +10,6 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -29,15 +28,17 @@ try {
|
||||||
if (!method_exists('dcUtils', 'versionsCompare')
|
if (!method_exists('dcUtils', 'versionsCompare')
|
||||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
||||||
throw new Exception(sprintf(
|
throw new Exception(sprintf(
|
||||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
'%s requires Dotclear %s',
|
||||||
|
$mod_id,
|
||||||
|
$dc_min
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
$s = new dbStruct($core->con, $core->prefix);
|
$s = new dbStruct($core->con, $core->prefix);
|
||||||
$s->epc
|
$s->epc
|
||||||
->epc_id ('bigint', 0, false)
|
->epc_id('bigint', 0, false)
|
||||||
->blog_id ('varchar', 32, false)
|
->blog_id('varchar', 32, false)
|
||||||
->epc_type('varchar', 32, false, "'epc'")
|
->epc_type('varchar', 32, false, "'epc'")
|
||||||
->epc_filter('varchar', 64, false)
|
->epc_filter('varchar', 64, false)
|
||||||
->epc_key('varchar', 255, false)
|
->epc_key('varchar', 255, false)
|
||||||
|
@ -58,7 +59,7 @@ try {
|
||||||
$core->blog->settings->addNamespace($mod_id);
|
$core->blog->settings->addNamespace($mod_id);
|
||||||
$s = $core->blog->settings->enhancePostContent;
|
$s = $core->blog->settings->enhancePostContent;
|
||||||
|
|
||||||
$s->put('enhancePostContent_active', false,'boolean', 'Enable enhancePostContent', false, true);
|
$s->put('enhancePostContent_active', false, 'boolean', 'Enable enhancePostContent', false, true);
|
||||||
$s->put('enhancePostContent_list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
$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_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_list_nb', 20, 'integer', 'Admin records list nb per page', false, true);
|
||||||
|
@ -67,7 +68,7 @@ try {
|
||||||
|
|
||||||
# Filters settings
|
# Filters settings
|
||||||
$filters = libEPC::getFilters();
|
$filters = libEPC::getFilters();
|
||||||
foreach($filters as $id => $filter) {
|
foreach ($filters as $id => $filter) {
|
||||||
# Only editable options
|
# Only editable options
|
||||||
$opt = [
|
$opt = [
|
||||||
'nocase' => $filter->nocase,
|
'nocase' => $filter->nocase,
|
||||||
|
@ -78,11 +79,12 @@ try {
|
||||||
'pubPages' => $filter->pubPages
|
'pubPages' => $filter->pubPages
|
||||||
];
|
];
|
||||||
$s->put('enhancePostContent_' . $id, serialize($opt), 'string', 'Settings for ' . $id, false, true);
|
$s->put('enhancePostContent_' . $id, serialize($opt), 'string', 'Settings for ' . $id, false, true);
|
||||||
/* # only tables
|
/* # only tables
|
||||||
if (isset($filter['list'])) {
|
if (isset($filter['list'])) {
|
||||||
$s->put('enhancePostContent_' . $id . 'List', serialize($filter['list']), 'string', 'List for ' . $id, false, true);
|
$s->put('enhancePostContent_' . $id . 'List', serialize($filter['list']), 'string', 'List for ' . $id, false, true);
|
||||||
}
|
}
|
||||||
*/ }
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
# Update old versions
|
# Update old versions
|
||||||
if ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
if ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +34,7 @@ $__autoload['epcFilter'] = $d . 'lib.epc.filter.php';
|
||||||
$__autoload['epcRecords'] = $d . 'lib.epc.records.php';
|
$__autoload['epcRecords'] = $d . 'lib.epc.records.php';
|
||||||
$__autoload['adminEpcList'] = $d . 'lib.epc.pager.php';
|
$__autoload['adminEpcList'] = $d . 'lib.epc.pager.php';
|
||||||
|
|
||||||
foreach($filters as $f) {
|
foreach ($filters as $f) {
|
||||||
$__autoload['epcFilter' . $f] = $d . 'lib.epc.filters.php';
|
$__autoload['epcFilter' . $f] = $d . 'lib.epc.filters.php';
|
||||||
$core->addBehavior('enhancePostContentFilters', ['epcFilter' . $f, 'create']);
|
$core->addBehavior('enhancePostContentFilters', ['epcFilter' . $f, 'create']);
|
||||||
}
|
}
|
||||||
|
|
13
_public.php
13
_public.php
|
@ -10,7 +10,6 @@
|
||||||
* @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')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +19,6 @@ require dirname(__FILE__) . '/_widgets.php';
|
||||||
$core->blog->settings->addNamespace('enhancePostContent');
|
$core->blog->settings->addNamespace('enhancePostContent');
|
||||||
|
|
||||||
if ($core->blog->settings->enhancePostContent->enhancePostContent_active) {
|
if ($core->blog->settings->enhancePostContent->enhancePostContent_active) {
|
||||||
|
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'publicHeadContent',
|
'publicHeadContent',
|
||||||
['publicEnhancePostContent', 'publicHeadContent']
|
['publicEnhancePostContent', 'publicHeadContent']
|
||||||
|
@ -53,23 +51,22 @@ class publicEnhancePostContent
|
||||||
$css = [];
|
$css = [];
|
||||||
$filters = libEPC::getFilters();
|
$filters = libEPC::getFilters();
|
||||||
|
|
||||||
foreach($filters as $id => $filter) {
|
foreach ($filters as $id => $filter) {
|
||||||
if ('' != $filter->class || '' != $filter->style) {
|
if ('' != $filter->class || '' != $filter->style) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = '';
|
$res = '';
|
||||||
foreach($filter->class as $k => $class) {
|
foreach ($filter->class as $k => $class) {
|
||||||
$styles = $filter->style;
|
$styles = $filter->style;
|
||||||
$style = html::escapeHTML(trim($styles[$k]));
|
$style = html::escapeHTML(trim($styles[$k]));
|
||||||
if ('' != $style) {
|
if ('' != $style) {
|
||||||
$res .= $class . " {" . $style . "} ";
|
$res .= $class . ' {' . $style . '} ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($res)) {
|
if (!empty($res)) {
|
||||||
$css[] =
|
$css[] = '/* CSS for enhancePostContent ' . $id . " */ \n" . $res . "\n";
|
||||||
"/* CSS for enhancePostContent " . $id . " */ \n" . $res . "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +88,7 @@ class publicEnhancePostContent
|
||||||
{
|
{
|
||||||
$filters = libEPC::getFilters();
|
$filters = libEPC::getFilters();
|
||||||
|
|
||||||
foreach($filters as $id => $filter) {
|
foreach ($filters as $id => $filter) {
|
||||||
if (!libEPC::testContext($tag, $args, $filter)) {
|
if (!libEPC::testContext($tag, $args, $filter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,49 +10,72 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
||||||
if (!defined('DC_CONTEXT_ADMIN')){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ __('delete all settings')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ __('delete plugin files')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$this->addUserAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ __('delete the version number')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'settings',
|
/* type */
|
||||||
/* action */ 'delete_all',
|
'settings',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ sprintf(__('delete all %s settings'), 'enhancePostContent')
|
'delete_all',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
sprintf(__('delete all %s settings'), 'enhancePostContent')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'plugins',
|
/* type */
|
||||||
/* action */ 'delete',
|
'plugins',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ sprintf(__('delete %s plugin files'), 'enhancePostContent')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
sprintf(__('delete %s plugin files'), 'enhancePostContent')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$this->addDirectAction(
|
||||||
/* type */ 'versions',
|
/* type */
|
||||||
/* action */ 'delete',
|
'versions',
|
||||||
/* ns */ 'enhancePostContent',
|
/* action */
|
||||||
/* description */ sprintf(__('delete %s version number'), 'enhancePostContent')
|
'delete',
|
||||||
|
/* ns */
|
||||||
|
'enhancePostContent',
|
||||||
|
/* description */
|
||||||
|
sprintf(__('delete %s version number'), 'enhancePostContent')
|
||||||
);
|
);
|
16
_widgets.php
16
_widgets.php
|
@ -10,7 +10,6 @@
|
||||||
* @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')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ class enhancePostContentWidget
|
||||||
# Type
|
# Type
|
||||||
$filters = libEPC::getFilters();
|
$filters = libEPC::getFilters();
|
||||||
$types = [];
|
$types = [];
|
||||||
foreach($filters as $id => $filter) {
|
foreach ($filters as $id => $filter) {
|
||||||
$types[$filter->name] = $id;
|
$types[$filter->name] = $id;
|
||||||
}
|
}
|
||||||
$w->epclist->setting(
|
$w->epclist->setting(
|
||||||
|
@ -67,7 +66,7 @@ class enhancePostContentWidget
|
||||||
);
|
);
|
||||||
# Content
|
# Content
|
||||||
$contents = libEPC::defaultAllowedWidgetValues();
|
$contents = libEPC::defaultAllowedWidgetValues();
|
||||||
foreach($contents as $k => $v) {
|
foreach ($contents as $k => $v) {
|
||||||
$w->epclist->setting(
|
$w->epclist->setting(
|
||||||
'content' . $v['id'],
|
'content' . $v['id'],
|
||||||
sprintf(__('Enable filter on %s'), __($k)),
|
sprintf(__('Enable filter on %s'), __($k)),
|
||||||
|
@ -127,7 +126,7 @@ class enhancePostContentWidget
|
||||||
|
|
||||||
# Content
|
# Content
|
||||||
$content = '';
|
$content = '';
|
||||||
foreach(libEPC::defaultAllowedWidgetValues() as $k => $v) {
|
foreach (libEPC::defaultAllowedWidgetValues() as $k => $v) {
|
||||||
$ns = 'content' . $v['id'];
|
$ns = 'content' . $v['id'];
|
||||||
if ($w->$ns && is_callable($v['cb'])) {
|
if ($w->$ns && is_callable($v['cb'])) {
|
||||||
$content .= call_user_func_array(
|
$content .= call_user_func_array(
|
||||||
|
@ -157,14 +156,13 @@ class enhancePostContentWidget
|
||||||
|
|
||||||
# Parse result
|
# Parse result
|
||||||
$res = '';
|
$res = '';
|
||||||
foreach($list as $line) {
|
foreach ($list as $line) {
|
||||||
if (empty($line['matches'][0]['match'])) {
|
if (empty($line['matches'][0]['match'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res .=
|
$res .= '<li>' . $line['matches'][0]['match'] .
|
||||||
'<li>' . $line['matches'][0]['match'] .
|
($w->show_total ? ' (' . $line['total'] . ')' : '') .
|
||||||
($w->show_total ? ' (' . $line['total'] .')' : '') .
|
|
||||||
'</li>';
|
'</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +173,7 @@ class enhancePostContentWidget
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
$w->content_only,
|
$w->content_only,
|
||||||
$w->class,
|
$w->class,
|
||||||
'id="epc_' . $w->type .'"',
|
'id="epc_' . $w->type . '"',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||||
($w->text ? '<p>' . html::escapeHTML($w->text) . '</p>' : '') .
|
($w->text ? '<p>' . html::escapeHTML($w->text) . '</p>' : '') .
|
||||||
'<ul>' . $res . '</ul>'
|
'<ul>' . $res . '</ul>'
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class epcFilter
|
abstract class epcFilter
|
||||||
{
|
{
|
||||||
public $core;
|
public $core;
|
||||||
|
@ -84,11 +83,12 @@ abstract class epcFilter
|
||||||
final protected function setProperties($property, $value = null): bool
|
final protected function setProperties($property, $value = null): bool
|
||||||
{
|
{
|
||||||
$properties = is_array($property) ? $property : [$property => $value];
|
$properties = is_array($property) ? $property : [$property => $value];
|
||||||
foreach($properties as $k => $v) {
|
foreach ($properties as $k => $v) {
|
||||||
if (isset($this->properties[$k])) {
|
if (isset($this->properties[$k])) {
|
||||||
$this->properties[$k] = $v;
|
$this->properties[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,11 +100,12 @@ abstract class epcFilter
|
||||||
final protected function setSettings($setting, $value = null): bool
|
final protected function setSettings($setting, $value = null): bool
|
||||||
{
|
{
|
||||||
$settings = is_array($setting) ? $setting : [$setting => $value];
|
$settings = is_array($setting) ? $setting : [$setting => $value];
|
||||||
foreach($settings as $k => $v) {
|
foreach ($settings as $k => $v) {
|
||||||
if (isset($this->settings[$k])) {
|
if (isset($this->settings[$k])) {
|
||||||
$this->settings[$k] = $v;
|
$this->settings[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class epcFilterTag extends epcFilter
|
class epcFilterTag extends epcFilter
|
||||||
{
|
{
|
||||||
protected function init(): string
|
protected function init(): string
|
||||||
|
@ -43,7 +42,7 @@ class epcFilterTag extends epcFilter
|
||||||
|
|
||||||
$metas = $this->core->meta->getMetadata(['meta_type' => 'tag']);
|
$metas = $this->core->meta->getMetadata(['meta_type' => 'tag']);
|
||||||
|
|
||||||
while($metas->fetch()) {
|
while ($metas->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$metas->meta_id,
|
$metas->meta_id,
|
||||||
sprintf($this->replace, $this->core->blog->url . $this->core->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
|
sprintf($this->replace, $this->core->blog->url . $this->core->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
|
||||||
|
@ -63,7 +62,7 @@ class epcFilterTag extends epcFilter
|
||||||
|
|
||||||
$metas = $this->core->meta->getMetadata(['meta_type' => 'tag']);
|
$metas = $this->core->meta->getMetadata(['meta_type' => 'tag']);
|
||||||
|
|
||||||
while($metas->fetch()) {
|
while ($metas->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$metas->meta_id,
|
$metas->meta_id,
|
||||||
sprintf($this->widget, $this->core->blog->url . $this->core->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
|
sprintf($this->widget, $this->core->blog->url . $this->core->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
|
||||||
|
@ -109,7 +108,7 @@ class epcFilterSearch extends epcFilter
|
||||||
|
|
||||||
$searchs = explode(' ', $GLOBALS['_search']);
|
$searchs = explode(' ', $GLOBALS['_search']);
|
||||||
|
|
||||||
foreach($searchs as $k => $v) {
|
foreach ($searchs as $k => $v) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$v,
|
$v,
|
||||||
sprintf($this->replace, '\\1'),
|
sprintf($this->replace, '\\1'),
|
||||||
|
@ -149,7 +148,7 @@ class epcFilterAcronym extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -163,7 +162,7 @@ class epcFilterAcronym extends epcFilter
|
||||||
|
|
||||||
public function widgetList($content, $w, &$list)
|
public function widgetList($content, $w, &$list)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -203,7 +202,7 @@ class epcFilterAbbreviation extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -217,7 +216,7 @@ class epcFilterAbbreviation extends epcFilter
|
||||||
|
|
||||||
public function widgetList($content, $w, &$list)
|
public function widgetList($content, $w, &$list)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -257,7 +256,7 @@ class epcFilterDefinition extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -271,7 +270,7 @@ class epcFilterDefinition extends epcFilter
|
||||||
|
|
||||||
public function widgetList($content, $w, &$list)
|
public function widgetList($content, $w, &$list)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -312,7 +311,7 @@ class epcFilterCitation extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -326,7 +325,7 @@ class epcFilterCitation extends epcFilter
|
||||||
|
|
||||||
public function widgetList($content, $w, &$list)
|
public function widgetList($content, $w, &$list)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
|
||||||
|
@ -366,7 +365,7 @@ class epcFilterLink extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, '\\1', $this->records()->epc_value, '\\1'),
|
sprintf($this->replace, '\\1', $this->records()->epc_value, '\\1'),
|
||||||
|
@ -380,7 +379,7 @@ class epcFilterLink extends epcFilter
|
||||||
|
|
||||||
public function widgetList($content, $w, &$list)
|
public function widgetList($content, $w, &$list)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$list[] = libEPC::matchString(
|
$list[] = libEPC::matchString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->widget, $this->records()->epc_value, $this->records()->epc_value, '\\1'),
|
sprintf($this->widget, $this->records()->epc_value, $this->records()->epc_value, '\\1'),
|
||||||
|
@ -421,7 +420,7 @@ class epcFilterReplace extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, $this->records()->epc_value, '\\2'),
|
sprintf($this->replace, $this->records()->epc_value, '\\2'),
|
||||||
|
@ -462,7 +461,7 @@ class epcFilterUpdate extends epcFilter
|
||||||
|
|
||||||
public function publicContent($tag, $args)
|
public function publicContent($tag, $args)
|
||||||
{
|
{
|
||||||
while($this->records()->fetch()) {
|
while ($this->records()->fetch()) {
|
||||||
$args[0] = libEPC::replaceString(
|
$args[0] = libEPC::replaceString(
|
||||||
$this->records()->epc_key,
|
$this->records()->epc_key,
|
||||||
sprintf($this->replace, '\\1', $this->records()->epc_value),
|
sprintf($this->replace, '\\1', $this->records()->epc_value),
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +21,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
*/
|
*/
|
||||||
class adminEpcList extends adminGenericList
|
class adminEpcList extends adminGenericList
|
||||||
{
|
{
|
||||||
public function display($filter, $pager_url, $enclose_block='')
|
public function display($filter, $pager_url, $enclose_block = '')
|
||||||
{
|
{
|
||||||
if ($this->rs->isEmpty()) {
|
if ($this->rs->isEmpty()) {
|
||||||
if ($filter->show()) {
|
if ($filter->show()) {
|
||||||
|
@ -47,12 +46,12 @@ class adminEpcList extends adminGenericList
|
||||||
'date' => '<th scope="col">' . __('Date') . '</th>'
|
'date' => '<th scope="col">' . __('Date') . '</th>'
|
||||||
];
|
];
|
||||||
|
|
||||||
$html_block =
|
$html_block = '<div class="table-outer"><table><caption>' .
|
||||||
'<div class="table-outer"><table><caption>' .
|
(
|
||||||
($filter->show() ?
|
$filter->show() ?
|
||||||
sprintf(__('List of %s records matching the filter.'), $this->rs_count) :
|
sprintf(__('List of %s records matching the filter.'), $this->rs_count) :
|
||||||
sprintf(__('List of %s records.'), $this->rs_count)
|
sprintf(__('List of %s records.'), $this->rs_count)
|
||||||
). '</caption>' .
|
) . '</caption>' .
|
||||||
'<tr>' . implode($cols) . '</tr>%s</table>%s</div>';
|
'<tr>' . implode($cols) . '</tr>%s</table>%s</div>';
|
||||||
|
|
||||||
if ($enclose_block) {
|
if ($enclose_block) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# l10n
|
# l10n
|
||||||
__('entry excerpt');__('entry content');__('comment content');
|
__('entry excerpt');__('entry content');__('comment content');
|
||||||
__('home page');__('post page');__('category page');__('search results page');
|
__('home page');__('post page');__('category page');__('search results page');
|
||||||
|
@ -109,8 +108,8 @@ class libEPC
|
||||||
try {
|
try {
|
||||||
$core->callBehavior('enhancePostContentFilters', $filters, $core);
|
$core->callBehavior('enhancePostContentFilters', $filters, $core);
|
||||||
|
|
||||||
foreach($filters as $filter) {
|
foreach ($filters as $filter) {
|
||||||
if ($filter instanceOf epcFilter && !isset($final[$filter->id()])) {
|
if ($filter instanceof epcFilter && !isset($final[$filter->id()])) {
|
||||||
$sort[$filter->id()] = $filter->priority;
|
$sort[$filter->id()] = $filter->priority;
|
||||||
$final[$filter->id()] = $filter;
|
$final[$filter->id()] = $filter;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +127,7 @@ class libEPC
|
||||||
public static function testContext($tag, $args, $filter)
|
public static function testContext($tag, $args, $filter)
|
||||||
{
|
{
|
||||||
return is_array($filter->pubPages)
|
return is_array($filter->pubPages)
|
||||||
&& in_array($GLOBALS['_ctx']->current_tpl,$filter->pubPages)
|
&& in_array($GLOBALS['_ctx']->current_tpl, $filter->pubPages)
|
||||||
&& is_array($filter->tplValues)
|
&& is_array($filter->tplValues)
|
||||||
&& in_array($tag, $filter->tplValues)
|
&& in_array($tag, $filter->tplValues)
|
||||||
&& $args[0] != '' //content
|
&& $args[0] != '' //content
|
||||||
|
@ -192,12 +191,13 @@ class libEPC
|
||||||
# Build array
|
# Build array
|
||||||
$m = [];
|
$m = [];
|
||||||
$loop = 0;
|
$loop = 0;
|
||||||
foreach($matches[1] as $match) {
|
foreach ($matches[1] as $match) {
|
||||||
$m[$loop]['key'] = $match;
|
$m[$loop]['key'] = $match;
|
||||||
$m[$loop]['match'] = preg_replace('#(' . $p . '(s|))#s' . $i, $r, $match, -1, $count);
|
$m[$loop]['match'] = preg_replace('#(' . $p . '(s|))#s' . $i, $r, $match, -1, $count);
|
||||||
$m[$loop]['num'] = $count;
|
$m[$loop]['num'] = $count;
|
||||||
$loop++;
|
$loop++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['total' => $t, 'matches' => $m];
|
return ['total' => $t, 'matches' => $m];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,9 +226,10 @@ class libEPC
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = '';
|
$r = '';
|
||||||
foreach($a as $k => $v) {
|
foreach ($a as $k => $v) {
|
||||||
$r .= $k . ':' . $v . ';';
|
$r .= $k . ':' . $v . ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ class libEPC
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($s as $cpl) {
|
foreach ($s as $cpl) {
|
||||||
$cur = explode(':', $cpl);
|
$cur = explode(':', $cpl);
|
||||||
|
|
||||||
if (!is_array($cur) || !isset($cur[1])) {
|
if (!is_array($cur) || !isset($cur[1])) {
|
||||||
|
@ -263,6 +264,7 @@ class libEPC
|
||||||
|
|
||||||
$r[$key] = $val;
|
$r[$key] = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class epcRecords
|
class epcRecords
|
||||||
{
|
{
|
||||||
public $core;
|
public $core;
|
||||||
|
@ -35,14 +34,12 @@ class epcRecords
|
||||||
if (!empty($params['columns']) && is_array($params['columns'])) {
|
if (!empty($params['columns']) && is_array($params['columns'])) {
|
||||||
$content_req .= implode(', ', $params['columns']) . ', ';
|
$content_req .= implode(', ', $params['columns']) . ', ';
|
||||||
}
|
}
|
||||||
$strReq =
|
$strReq = 'SELECT E.epc_id, E.blog_id, E.epc_type, E.epc_upddt, ' .
|
||||||
'SELECT E.epc_id, E.blog_id, E.epc_type, E.epc_upddt, ' .
|
|
||||||
$content_req .
|
$content_req .
|
||||||
'E.epc_filter, E.epc_key, E.epc_value ';
|
'E.epc_filter, E.epc_key, E.epc_value ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strReq .=
|
$strReq .= 'FROM ' . $this->table . ' E ';
|
||||||
'FROM ' . $this->table . ' E ';
|
|
||||||
|
|
||||||
if (!empty($params['from'])) {
|
if (!empty($params['from'])) {
|
||||||
$strReq .= $params['from'] . ' ';
|
$strReq .= $params['from'] . ' ';
|
||||||
|
@ -70,7 +67,7 @@ class epcRecords
|
||||||
|
|
||||||
if (!empty($params['epc_id'])) {
|
if (!empty($params['epc_id'])) {
|
||||||
if (is_array($params['epc_id'])) {
|
if (is_array($params['epc_id'])) {
|
||||||
array_walk($params['epc_id'], function(&$v, $k) { if ($v !==null) { $v = (integer) $v; }});
|
array_walk($params['epc_id'], function (&$v, $k) { if ($v !== null) { $v = (integer) $v; }});
|
||||||
} else {
|
} else {
|
||||||
$params['epc_id'] = [(integer) $params['epc_id']];
|
$params['epc_id'] = [(integer) $params['epc_id']];
|
||||||
}
|
}
|
||||||
|
@ -121,6 +118,7 @@ class epcRecords
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
|
@ -141,7 +139,7 @@ class epcRecords
|
||||||
|
|
||||||
$cur->epc_upddt = date('Y-m-d H:i:s');
|
$cur->epc_upddt = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
$cur->update("WHERE epc_id = " . $id . " AND blog_id = '" . $this->blog . "' ");
|
$cur->update('WHERE epc_id = ' . $id . " AND blog_id = '" . $this->blog . "' ");
|
||||||
$this->trigger();
|
$this->trigger();
|
||||||
|
|
||||||
# --BEHAVIOR-- enhancePostContentAfterUpdRecord
|
# --BEHAVIOR-- enhancePostContentAfterUpdRecord
|
||||||
|
@ -170,7 +168,7 @@ class epcRecords
|
||||||
|
|
||||||
$this->con->execute(
|
$this->con->execute(
|
||||||
'DELETE FROM ' . $this->table . ' ' .
|
'DELETE FROM ' . $this->table . ' ' .
|
||||||
'WHERE epc_id = ' . $id .' ' .
|
'WHERE epc_id = ' . $id . ' ' .
|
||||||
"AND blog_id = '" . $this->blog . "' "
|
"AND blog_id = '" . $this->blog . "' "
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,15 @@
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# Move old filters lists from settings to database
|
# Move old filters lists from settings to database
|
||||||
if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
|
if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
|
||||||
$f = $core->con->select("SELECT * FROM " . $core->prefix . "setting WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL ");
|
$f = $core->con->select('SELECT * FROM ' . $core->prefix . "setting WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL ");
|
||||||
|
|
||||||
while ($f->fetch()) {
|
while ($f->fetch()) {
|
||||||
if (preg_match('#enhancePostContent_(.*?)List#', $f->setting_id, $m)) {
|
if (preg_match('#enhancePostContent_(.*?)List#', $f->setting_id, $m)) {
|
||||||
$curlist = @unserialize($f->setting_value);
|
$curlist = @unserialize($f->setting_value);
|
||||||
if (is_array($curlist)) {
|
if (is_array($curlist)) {
|
||||||
foreach($curlist as $k => $v) {
|
foreach ($curlist as $k => $v) {
|
||||||
$cur = $core->con->openCursor($core->prefix . 'epc');
|
$cur = $core->con->openCursor($core->prefix . 'epc');
|
||||||
$core->con->writeLock($core->prefix . 'epc');
|
$core->con->writeLock($core->prefix . 'epc');
|
||||||
|
|
||||||
|
@ -33,19 +32,19 @@ if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
|
||||||
$core->con->unlock();
|
$core->con->unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$core->con->execute("DELETE FROM " . $core->prefix . "setting WHERE setting_id='" . $f->setting_id . "' AND setting_ns='enhancePostContent' AND blog_id='" . $f->blog_id . "' ");
|
$core->con->execute('DELETE FROM ' . $core->prefix . "setting WHERE setting_id='" . $f->setting_id . "' AND setting_ns='enhancePostContent' AND blog_id='" . $f->blog_id . "' ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move old filter name to filter id
|
# Move old filter name to filter id
|
||||||
} elseif ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
} elseif ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
|
||||||
$rs = $core->con->select('SELECT epc_id, epc_filter FROM ' . $core->prefix . 'epc');
|
$rs = $core->con->select('SELECT epc_id, epc_filter FROM ' . $core->prefix . 'epc');
|
||||||
while($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$cur = $core->con->openCursor($core->prefix . 'epc');
|
$cur = $core->con->openCursor($core->prefix . 'epc');
|
||||||
|
|
||||||
$cur->epc_filter = strtolower($rs->epc_filter);
|
$cur->epc_filter = strtolower($rs->epc_filter);
|
||||||
|
|
||||||
$cur->update("WHERE epc_id = " . $rs->epc_id . " ");
|
$cur->update('WHERE epc_id = ' . $rs->epc_id . ' ');
|
||||||
$core->blog->triggerBlog();
|
$core->blog->triggerBlog();
|
||||||
}
|
}
|
||||||
}
|
}
|
24
index.php
24
index.php
|
@ -10,7 +10,6 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +21,7 @@ dcPage::check('contentadmin');
|
||||||
$_filters = libEPC::getFilters();
|
$_filters = libEPC::getFilters();
|
||||||
|
|
||||||
$filters_id = $filters_combo = [];
|
$filters_id = $filters_combo = [];
|
||||||
foreach($_filters as $id => $filter) {
|
foreach ($_filters as $id => $filter) {
|
||||||
$filters_id[$id] = $filter->name;
|
$filters_id[$id] = $filter->name;
|
||||||
$filters_combo[$filter->name] = $id;
|
$filters_combo[$filter->name] = $id;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +106,7 @@ try {
|
||||||
if ($action == 'deleterecords' && $filter->has_list
|
if ($action == 'deleterecords' && $filter->has_list
|
||||||
&& !empty($_POST['epc_id']) && is_array($_POST['epc_id'])
|
&& !empty($_POST['epc_id']) && is_array($_POST['epc_id'])
|
||||||
) {
|
) {
|
||||||
foreach($_POST['epc_id'] as $id) {
|
foreach ($_POST['epc_id'] as $id) {
|
||||||
$records->delRecord($id);
|
$records->delRecord($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +126,7 @@ try {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,12 +144,11 @@ if ($filter->has_list) {
|
||||||
$list = $records->getRecords($params);
|
$list = $records->getRecords($params);
|
||||||
$counter = $records->getRecords($params, true);
|
$counter = $records->getRecords($params, true);
|
||||||
$pager = new adminEpcList($core, $list, $counter->f(0));
|
$pager = new adminEpcList($core, $list, $counter->f(0));
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$core->error->add($e->getMessage());
|
$core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = $sorts->js($core->adminurl->get('admin.plugin.enhancePostContent', ['part' => $part], '&').'#record');
|
$header = $sorts->js($core->adminurl->get('admin.plugin.enhancePostContent', ['part' => $part], '&') . '#record');
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Display page --
|
# -- Display page --
|
||||||
|
@ -196,7 +194,7 @@ echo '
|
||||||
<div class="two-boxes odd">
|
<div class="two-boxes odd">
|
||||||
<h4>' . __('Pages to be filtered') . '</h4>';
|
<h4>' . __('Pages to be filtered') . '</h4>';
|
||||||
|
|
||||||
foreach(libEPC::blogAllowedPubPages() as $k => $v) {
|
foreach (libEPC::blogAllowedPubPages() as $k => $v) {
|
||||||
echo '
|
echo '
|
||||||
<p><label for="filter_pubPages' . $v . '">' .
|
<p><label for="filter_pubPages' . $v . '">' .
|
||||||
form::checkbox(
|
form::checkbox(
|
||||||
|
@ -228,7 +226,7 @@ form::number('filter_limit', ['min' => 0, 'max' => 99, 'default' => (integer) $f
|
||||||
</div><div class="two-boxes odd">
|
</div><div class="two-boxes odd">
|
||||||
<h4>' . __('Contents to be filtered') . '</h4>';
|
<h4>' . __('Contents to be filtered') . '</h4>';
|
||||||
|
|
||||||
foreach(libEPC::blogAllowedTplValues() as $k => $v) {
|
foreach (libEPC::blogAllowedTplValues() as $k => $v) {
|
||||||
echo '
|
echo '
|
||||||
<p><label for="filter_tplValues' . $v . '">' .
|
<p><label for="filter_tplValues' . $v . '">' .
|
||||||
form::checkbox(
|
form::checkbox(
|
||||||
|
@ -243,12 +241,12 @@ echo '
|
||||||
</div><div class="two-boxes even">
|
</div><div class="two-boxes even">
|
||||||
<h4>' . __('Style') . '</h4>';
|
<h4>' . __('Style') . '</h4>';
|
||||||
|
|
||||||
foreach($filter->class as $k => $v) {
|
foreach ($filter->class as $k => $v) {
|
||||||
echo '
|
echo '
|
||||||
<p><label for="filter_style' . $k . '">' .
|
<p><label for="filter_style' . $k . '">' .
|
||||||
sprintf(__('Class "%s":'), $v) . '</label>' .
|
sprintf(__('Class "%s":'), $v) . '</label>' .
|
||||||
form::field(
|
form::field(
|
||||||
['filter_style[]', 'filter_style'.$k],
|
['filter_style[]', 'filter_style' . $k],
|
||||||
60,
|
60,
|
||||||
255,
|
255,
|
||||||
html::escapeHTML($filter->style[$k])
|
html::escapeHTML($filter->style[$k])
|
||||||
|
@ -279,14 +277,16 @@ form::hidden(['part'], $part) . '
|
||||||
|
|
||||||
# Filter records list
|
# Filter records list
|
||||||
if ($filter->has_list) {
|
if ($filter->has_list) {
|
||||||
$pager_url = $core->adminurl->get('admin.plugin.enhancePostContent', array_diff_key($sorts->values(true), ['page' => ''])).'&page=%s#record';
|
$pager_url = $core->adminurl->get('admin.plugin.enhancePostContent', array_diff_key($sorts->values(true), ['page' => ''])) . '&page=%s#record';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="multi-part" id="record" title="' . __('Records') . '">';
|
<div class="multi-part" id="record" title="' . __('Records') . '">';
|
||||||
|
|
||||||
$sorts->display(['admin.plugin.enhancePostContent', '#record'], form::hidden('p', 'enhancePostContent') . form::hidden('part', $part));
|
$sorts->display(['admin.plugin.enhancePostContent', '#record'], form::hidden('p', 'enhancePostContent') . form::hidden('part', $part));
|
||||||
|
|
||||||
$pager->display($sorts, $pager_url,
|
$pager->display(
|
||||||
|
$sorts,
|
||||||
|
$pager_url,
|
||||||
'<form action="' . $core->adminurl->get('admin.plugin.enhancePostContent') . '#record" method="post" id="form-records">' .
|
'<form action="' . $core->adminurl->get('admin.plugin.enhancePostContent') . '#record" method="post" id="form-records">' .
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue