fix from phpstan and php-cs-fixer

This commit is contained in:
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.)
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

View File

@ -16,5 +16,5 @@ if (!defined('DC_RC_PATH')) {
class initZoneclearFeedServer
{
public const TABLE_NAME = 'zc_feed';
public const TABLE_NAME = 'zc_feed';
}

View File

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

View File

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

View File

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

View File

@ -709,7 +709,7 @@ class zoneclearFeedServer
# Enable
if ($enable) {
$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');
}
# Disable
@ -724,7 +724,7 @@ class zoneclearFeedServer
* Read and parse external feeds.
*
* @param string $f Feed URL
* @return arrayObject Parsed feed
* @return feedParser|false Parsed feed
*/
public static function readFeed($f)
{
@ -737,7 +737,7 @@ class zoneclearFeedServer
return $feed_reader->parse($f);
} catch (Exception $e) {
return null;
return false;
}
}
@ -909,7 +909,9 @@ class zoneclearFeedServer
*/
public static function tweakurlsAfterPostCreate(cursor $cur, $id)
{
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
dcCore::app()->auth->sudo([dcCore::app()->blog, 'updPost'], $id, $cur);
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
$cur->post_url = tweakUrls::tweakBlogURL($cur->post_url);
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
echo
'<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') .
dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/list.js'))
: '') .
@ -438,7 +438,7 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
}
# 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">';
# show filters
@ -531,34 +531,37 @@ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServe
__('Plugins') => '',
__('Feeds server') => '',
]) .
dcPage::notices() .
dcPage::notices();
'<p class="top-add">' .
'<a class="button add" href="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed']) . '">' .
__('New feed') . '</a></p>';
if (isset($feeds_list)) {
echo
'<p class="top-add">' .
'<a class="button add" href="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed']) . '">' .
__('New feed') . '</a></p>';
$feeds_filter->display(
'admin.plugin.' . basename(__DIR__),
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), ['part' => 'feeds'])
);
$feeds_filter->display(
'admin.plugin.' . basename(__DIR__),
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), ['part' => 'feeds'])
);
$feeds_list->feedsDisplay(
$feeds_filter->page,
$feeds_filter->nb,
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feeds']) . '" method="post" id="form-actions">' .
'%s' .
'<div class="two-cols">' .
'<p class="col checkboxes-helpers"></p>' .
'<p class="col right">' . __('Selected feeds action:') . ' ' .
form::combo(['action'], $feeds_actions_page->getCombo()) .
'<input type="submit" value="' . __('ok') . '" />' .
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), $feeds_filter->values(true)) .
dcCore::app()->formNonce() .
'</p>' .
'</div>' .
'</form>',
$feeds_filter->show()
);
$feeds_list->feedsDisplay(
$feeds_filter->page,
$feeds_filter->nb,
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feeds']) . '" method="post" id="form-actions">' .
'%s' .
'<div class="two-cols">' .
'<p class="col checkboxes-helpers"></p>' .
'<p class="col right">' . __('Selected feeds action:') . ' ' .
form::combo(['action'], $feeds_actions_page->getCombo()) .
'<input type="submit" value="' . __('ok') . '" />' .
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), $feeds_filter->values(true)) .
dcCore::app()->formNonce() .
'</p>' .
'</div>' .
'</form>',
$feeds_filter->show()
);
}
}
echo '</body></html>';