diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4f7ff1..067a149 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,10 +2,11 @@
- [ ] fix disallow self blog feeds
- [ ] add plugin muppet support (request Mathieu M.)
- [ ] add log for errors
-- add generic filters
-- add user pref for columns and filters options
+- add generic filters (dc 2.20)
+- add user pref for columns and filters options (dc 2.20)
- fix redirections, page title, posts feed form
- update translation
+- update to PSR12
2021.09.16
- fix Dotclear 2.19 compatibility
diff --git a/_admin.php b/_admin.php
index 31a49b7..3e552de 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,16 +1,15 @@
addItem(
$core->adminurl->get('admin.plugin.zoneclearFeedServer'),
dcPage::getPF('zoneclearFeedServer/icon.png'),
preg_match(
- '/' . preg_quote($core->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
+ '/' . preg_quote($core->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->check('admin', $core->blog->id)
);
# Delete related info about feed post in meta table
-$core->addBehavior('adminBeforePostDelete',['zcfsAdminBehaviors', 'adminBeforePostDelete']);
+$core->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
if ($core->auth->check('admin', $core->blog->id)) {
@@ -47,7 +46,6 @@ if ($core->auth->check('admin', $core->blog->id)) {
# Take care about tweakurls (thanks Mathieu M.)
if (version_compare($core->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
-
$core->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
}
@@ -107,8 +105,8 @@ class zcfsAdminBehaviors
*/
public static function adminDashboardFavoritesActive($request, $params)
{
- return $request == 'plugin.php'
- && isset($params['p'])
+ return $request == 'plugin.php'
+ && isset($params['p'])
&& $params['p'] == 'zoneclearFeedServer';
}
@@ -127,10 +125,10 @@ class zcfsAdminBehaviors
return null;
}
- $fav['title'] .= '
'.sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
+ $fav['title'] .= '
' . sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
$fav['large-icon'] = dcPage::getPF('zoneclearFeedServer/icon-big-update.png');
- $fav['url'] = $core->adminurl->get(
- 'admin.plugin.zoneclearFeedServer',
+ $fav['url'] = $core->adminurl->get(
+ 'admin.plugin.zoneclearFeedServer',
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
);
}
@@ -146,18 +144,18 @@ class zcfsAdminBehaviors
$cols['zcfs_feeds'] = [
__('Feeds server: Feeds'),
[
- 'desc' => [true, __('Feed')],
- 'period' => [true, __('Frequency')],
- 'update' => [true, __('Last update')],
- 'entries' => [true, __('Entries')]
+ 'desc' => [true, __('Feed')],
+ 'period' => [true, __('Frequency')],
+ 'update' => [true, __('Last update')],
+ 'entries' => [true, __('Entries')]
]
];
$cols['zcfs_entries'] = [
__('Feeds server: Entries'),
[
- 'date' => [true, __('Date')],
- 'category' => [true, __('Category')],
- 'author' => [true, __('Author')]
+ 'date' => [true, __('Date')],
+ 'category' => [true, __('Category')],
+ 'author' => [true, __('Author')]
]
];
}
@@ -188,7 +186,7 @@ class zcfsAdminBehaviors
/**
* Add javascript for toggle to post edition page header.
- *
+ *
* @return string Page header
*/
public static function adminPostHeaders()
@@ -198,7 +196,7 @@ class zcfsAdminBehaviors
/**
* Add form to post sidebar.
- *
+ *
* @param ArrayObject $main_items Main items
* @param ArrayObject $sidebar_items Sidebar items
* @param record $post Post record or null
@@ -253,7 +251,7 @@ class zcfsAdminBehaviors
$edit = sprintf(
'
' . '' . __('feed URL') . ' - ' . @@ -274,7 +271,7 @@ class zcfsAdminBehaviors /** * Delete related info about feed post in meta table. - * + * * @param integer $post_id Post id */ public static function adminBeforePostDelete($post_id) @@ -283,14 +280,14 @@ class zcfsAdminBehaviors $core->con->execute( 'DELETE FROM ' . $core->prefix . 'meta ' . - 'WHERE post_id = ' . ((integer) $post_id) . ' ' . + 'WHERE post_id = ' . ((int) $post_id) . ' ' . 'AND meta_type ' . $core->con->in([ 'zoneclearfeed_url', 'zoneclearfeed_author', 'zoneclearfeed_site', 'zoneclearfeed_sitename', 'zoneclearfeed_id' - ]).' ' + ]) . ' ' ); } -} \ No newline at end of file +} diff --git a/_config.php b/_config.php index 703594a..8efce9a 100644 --- a/_config.php +++ b/_config.php @@ -1,16 +1,15 @@ getURL() . '#plugins' : $_REQUEST['r $core->blog->settings->addNamespace('zoneclearFeedServer'); $s = $core->blog->settings->zoneclearFeedServer; -$active = (boolean) $s->zoneclearFeedServer_active; -$pub_active = (boolean) $s->zoneclearFeedServer_pub_active; -$post_status_new = (boolean) $s->zoneclearFeedServer_post_status_new; -$bhv_pub_upd = (integer) $s->zoneclearFeedServer_bhv_pub_upd; -$update_limit = (integer) $s->zoneclearFeedServer_update_limit; -$keep_empty_feed = (boolean) $s->zoneclearFeedServer_keep_empty_feed; -$tag_case = (integer) $s->zoneclearFeedServer_tag_case; -$post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl); +$active = (bool) $s->zoneclearFeedServer_active; +$pub_active = (bool) $s->zoneclearFeedServer_pub_active; +$post_status_new = (bool) $s->zoneclearFeedServer_post_status_new; +$bhv_pub_upd = (int) $s->zoneclearFeedServer_bhv_pub_upd; +$update_limit = (int) $s->zoneclearFeedServer_update_limit; +$keep_empty_feed = (bool) $s->zoneclearFeedServer_keep_empty_feed; +$tag_case = (int) $s->zoneclearFeedServer_tag_case; +$post_full_tpl = @unserialize($s->zoneclearFeedServer_post_full_tpl); $post_title_redir = @unserialize($s->zoneclearFeedServer_post_title_redir); -$feeduser = (string) $s->zoneclearFeedServer_user; +$feeduser = (string) $s->zoneclearFeedServer_user; if ($update_limit < 1) { $update_limit = 10; @@ -47,16 +46,16 @@ $zc = new zoneclearFeedServer($core); # -- Set settings -- if (!empty($_POST['save'])) { try { - $active = !empty($_POST['active']); - $pub_active = !empty($_POST['pub_active']); - $post_status_new = !empty($_POST['post_status_new']); - $bhv_pub_upd = (integer) $_POST['bhv_pub_upd']; - $limit = abs((integer) $_POST['update_limit']); - $keep_empty_feed = !empty($_POST['keep_empty_feed']); - $tag_case = (integer) $_POST['tag_case']; - $post_full_tpl = $_POST['post_full_tpl']; + $active = !empty($_POST['active']); + $pub_active = !empty($_POST['pub_active']); + $post_status_new = !empty($_POST['post_status_new']); + $bhv_pub_upd = (int) $_POST['bhv_pub_upd']; + $limit = abs((int) $_POST['update_limit']); + $keep_empty_feed = !empty($_POST['keep_empty_feed']); + $tag_case = (int) $_POST['tag_case']; + $post_full_tpl = $_POST['post_full_tpl']; $post_title_redir = $_POST['post_title_redir']; - $feeduser = (string) $_POST['feeduser']; + $feeduser = (string) $_POST['feeduser']; if ($limit < 1) { $limit = 10; @@ -79,7 +78,7 @@ if (!empty($_POST['save'])) { __('Configuration successfully updated.') ); $core->adminurl->redirect( - 'admin.plugins', + 'admin.plugins', ['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => $list->getRedir()] ); } catch (Exception $e) { @@ -111,8 +110,8 @@ $pub_page_url = $core->blog->url . $core->url->getBase('zoneclearFeedsPage'); # -- Display form -- if (!is_writable(DC_TPL_CACHE)) { - echo '
'. __('Dotclear cache is not writable or not well configured!') . '
'; - } + echo '' . __('Dotclear cache is not writable or not well configured!') . '
'; +} echo '' . form::combo('post_status_new', $combo_status, $post_status_new) . '
-' . __('Show full content on:') . '