fix from phpstan and php-cs-fixer

master
Jean-Christian Paul Denis 2022-12-10 23:02:38 +01:00
parent cfa4bf8119
commit 7c90aea074
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
8 changed files with 45 additions and 42 deletions

View File

@ -48,9 +48,7 @@ if (dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer
} }
# Take care about tweakurls (thanks Mathieu M.) # Take care about tweakurls (thanks Mathieu M.)
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']); dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
}
} }
# Delete related info about feed post in meta table # Delete related info about feed post in meta table

View File

@ -43,7 +43,7 @@ class zcfsPublicBehaviors
return null; return null;
} }
self::publicDocument(); self::publicDocumentV2();
} }
/** /**

View File

@ -56,7 +56,7 @@ class zcfsRsExtPosts extends rsExtPost
$ext = dcCore::app()->__get('beforeZcFeedRsExt'); $ext = dcCore::app()->__get('beforeZcFeedRsExt');
if (null !== $ext && !empty($ext[$type])) { if (null !== $ext && !empty($ext[$type])) {
$func = $ext[$type]; $func = $ext[$type];
} elseif (is_callable('rsExtPostPublic', $type)) { } elseif (is_callable(['rsExtPostPublic', $type])) {
$func = ['rsExtPostPublic', $type]; $func = ['rsExtPostPublic', $type];
} else { } else {
$func = ['rsExtPost', $type]; $func = ['rsExtPost', $type];
@ -117,7 +117,7 @@ class zcfsRsExtPosts extends rsExtPost
/** /**
* Get post content from post to feed. * Get post content from post to feed.
* *
* @param record $rs record instance * @param dcRecord $rs record instance
* @return string Post content * @return string Post content
*/ */
public static function getContent(dcRecord $rs, bool $absolute_urls = false): string public static function getContent(dcRecord $rs, bool $absolute_urls = false): string

View File

@ -46,7 +46,7 @@ class zcfsUrlHandler extends dcUrlHandlers
$zc = new zoneclearFeedServer(); $zc = new zoneclearFeedServer();
if ($zc->checkFeedsUpdate()) { if ($zc->checkFeedsUpdate()) {
$msg = sprintf( $msg = sprintf(
'<status>%s</status><message>s%</message>', '<status>%s</status><message>%s</message>',
'ok', 'ok',
'Feeds updated successfully' 'Feeds updated successfully'
); );
@ -56,7 +56,7 @@ class zcfsUrlHandler extends dcUrlHandlers
} }
if (empty($msg)) { if (empty($msg)) {
$msg = sprintf( $msg = sprintf(
'<status>%s</status><message>s%</message>', '<status>%s</status><message>%s</message>',
'failed', 'failed',
'Failed to update feeds' 'Failed to update feeds'
); );

View File

@ -709,7 +709,7 @@ class zoneclearFeedServer
# Enable # Enable
if ($enable) { if ($enable) {
$this->user = dcCore::app()->auth->userID(); $this->user = dcCore::app()->auth->userID();
if (!dcCore::app()->auth->checkUser($enable)) { if (!dcCore::app()->auth->checkUser($this->user ?? '')) {
throw new Exception('Unable to set user'); throw new Exception('Unable to set user');
} }
# Disable # Disable
@ -724,7 +724,7 @@ class zoneclearFeedServer
* Read and parse external feeds. * Read and parse external feeds.
* *
* @param string $f Feed URL * @param string $f Feed URL
* @return arrayObject Parsed feed * @return feedParser|false Parsed feed
*/ */
public static function readFeed($f) public static function readFeed($f)
{ {
@ -737,7 +737,7 @@ class zoneclearFeedServer
return $feed_reader->parse($f); return $feed_reader->parse($f);
} catch (Exception $e) { } catch (Exception $e) {
return null; return false;
} }
} }
@ -909,7 +909,9 @@ class zoneclearFeedServer
*/ */
public static function tweakurlsAfterPostCreate(cursor $cur, $id) public static function tweakurlsAfterPostCreate(cursor $cur, $id)
{ {
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url); $cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
dcCore::app()->auth->sudo([dcCore::app()->blog, 'updPost'], $id, $cur); dcCore::app()->auth->sudo([dcCore::app()->blog, 'updPost'], $id, $cur);
} }
}
} }

View File

@ -308,7 +308,7 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
# display # display
echo echo
'<html><head><title>' . __('Feeds server') . '</title>' . '<html><head><title>' . __('Feeds server') . '</title>' .
($feed_id && !dcCore::app()->error->flag() ? ($feed_id && isset($post_filter) && !dcCore::app()->error->flag() ?
$post_filter->js(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') . $post_filter->js(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') .
dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/list.js')) dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/list.js'))
: '') . : '') .
@ -438,7 +438,7 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
} }
# entries # entries
if ($feed_id && $can_view_page && !dcCore::app()->error->flag()) { if ($feed_id && $can_view_page && isset($post_filter) && isset($post_list) && isset($posts_actions_page) && !dcCore::app()->error->flag()) {
echo '<div class="multi-part" title="' . __('Entries') . '" id="entries">'; echo '<div class="multi-part" title="' . __('Entries') . '" id="entries">';
# show filters # show filters
@ -531,8 +531,10 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
__('Plugins') => '', __('Plugins') => '',
__('Feeds server') => '', __('Feeds server') => '',
]) . ]) .
dcPage::notices() . dcPage::notices();
if (isset($feeds_list)) {
echo
'<p class="top-add">' . '<p class="top-add">' .
'<a class="button add" href="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed']) . '">' . '<a class="button add" href="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed']) . '">' .
__('New feed') . '</a></p>'; __('New feed') . '</a></p>';
@ -559,6 +561,7 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
'</form>', '</form>',
$feeds_filter->show() $feeds_filter->show()
); );
}
} }
echo '</body></html>'; echo '</body></html>';