Compare commits
No commits in common. "ee39711e909507b19e399cd43df2ccd438a878b9" and "2b68c75c681118d7373d4ba1052dbcd7660ce6a2" have entirely different histories.
ee39711e90
...
2b68c75c68
|
@ -1,9 +1,3 @@
|
||||||
zoneclearFeedServer 2023.11.04
|
|
||||||
===========================================================
|
|
||||||
* Require Dotclear 2.28
|
|
||||||
* Require PHP 8.1
|
|
||||||
* Code review (phpstan)
|
|
||||||
|
|
||||||
zoneclearFeedServer 2023.10.18
|
zoneclearFeedServer 2023.10.18
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.28
|
* Require Dotclear 2.28
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.11.04-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/zoneclearFeedServer/releases)
|
[![Release](https://img.shields.io/badge/release-2023.10.18-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/zoneclearFeedServer/releases)
|
||||||
![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg)
|
![Date](https://img.shields.io/badge/date-2023.10.18-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/zoneclearFeedServer)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/zoneclearFeedServer)
|
||||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/zoneclearFeedServer/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/zoneclearFeedServer/src/branch/master/LICENSE)
|
||||||
|
|
|
@ -19,7 +19,7 @@ $this->registerModule(
|
||||||
'Feeds server',
|
'Feeds server',
|
||||||
'Mix your blog with a feeds planet',
|
'Mix your blog with a feeds planet',
|
||||||
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
'Jean-Christian Denis, BG, Pierre Van Glabeke',
|
||||||
'2023.11.04',
|
'2023.10.18',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.28']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => 'My',
|
'permissions' => 'My',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="zoneclearFeedServer">
|
<module id="zoneclearFeedServer">
|
||||||
<name>Feeds server</name>
|
<name>Feeds server</name>
|
||||||
<version>2023.11.04</version>
|
<version>2023.10.18</version>
|
||||||
<author>Jean-Christian Denis, BG, Pierre Van Glabeke</author>
|
<author>Jean-Christian Denis, BG, Pierre Van Glabeke</author>
|
||||||
<desc>Mix your blog with a feeds planet</desc>
|
<desc>Mix your blog with a feeds planet</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/releases/download/v2023.11.04/plugin-zoneclearFeedServer.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/releases/download/v2023.10.18/plugin-zoneclearFeedServer.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/zoneclearFeedServer/issues</da:support>
|
||||||
|
|
|
@ -55,8 +55,6 @@ class BackendBehaviors
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists columns user preference.
|
* Lists columns user preference.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $cols
|
|
||||||
*/
|
*/
|
||||||
public static function adminColumnsListsV2(ArrayObject $cols): void
|
public static function adminColumnsListsV2(ArrayObject $cols): void
|
||||||
{
|
{
|
||||||
|
@ -85,8 +83,6 @@ class BackendBehaviors
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists filter.
|
* Lists filter.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $sorts
|
|
||||||
*/
|
*/
|
||||||
public static function adminFiltersListsV2(ArrayObject $sorts): void
|
public static function adminFiltersListsV2(ArrayObject $sorts): void
|
||||||
{
|
{
|
||||||
|
@ -110,18 +106,14 @@ class BackendBehaviors
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add head column to posts list.
|
* Add head column to posts list.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $cols
|
|
||||||
*/
|
*/
|
||||||
public static function adminPostListHeaderV2(MetaRecord $rs, ArrayObject $cols): void
|
public static function adminPostListHeaderV2(MetaRecord $rs, ArrayObject $cols): void
|
||||||
{
|
{
|
||||||
$cols['feed'] = (new Text('th', __('Feed')))->extra('scope="col"')->render();
|
$cols['feed'] = (new Para(null, 'th'))->text(__('Feed'))->extra('scope="col"')->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add body column to posts list.
|
* Add body column to posts list.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $cols
|
|
||||||
*/
|
*/
|
||||||
public static function adminPostListValueV2(MetaRecord $rs, ArrayObject $cols): void
|
public static function adminPostListValueV2(MetaRecord $rs, ArrayObject $cols): void
|
||||||
{
|
{
|
||||||
|
@ -148,9 +140,6 @@ class BackendBehaviors
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add info about feed on post page sidebar.
|
* Add info about feed on post page sidebar.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $main_items
|
|
||||||
* @param ArrayObject<string, mixed> $sidebar_items
|
|
||||||
*/
|
*/
|
||||||
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, ?MetaRecord $post): void
|
public static function adminPostFormItems(ArrayObject $main_items, ArrayObject $sidebar_items, ?MetaRecord $post): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ use Exception;
|
||||||
class Combo
|
class Combo
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string,string>
|
||||||
*/
|
*/
|
||||||
public static function feedsSortby(): array
|
public static function feedsSortby(): array
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string,string>
|
||||||
*/
|
*/
|
||||||
public static function postsSortby(): array
|
public static function postsSortby(): array
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string,string>
|
||||||
*/
|
*/
|
||||||
public static function feedsStatus(): array
|
public static function feedsStatus(): array
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, int>
|
* @return array<string,int>
|
||||||
*/
|
*/
|
||||||
public static function postsStatus(): array
|
public static function postsStatus(): array
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, int>
|
* @return array<string,int>
|
||||||
*/
|
*/
|
||||||
public static function updateInterval(): array
|
public static function updateInterval(): array
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, int>
|
* @return array<string,int>
|
||||||
*/
|
*/
|
||||||
public static function tagCase(): array
|
public static function tagCase(): array
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, int>
|
* @return array<string,int>
|
||||||
*/
|
*/
|
||||||
public static function pubUpdate(): array
|
public static function pubUpdate(): array
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ class Combo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string,string>
|
||||||
*/
|
*/
|
||||||
public static function postCategories(): array
|
public static function postCategories(): array
|
||||||
{
|
{
|
||||||
|
@ -127,16 +127,17 @@ class Combo
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = App::blog()->getCategories(['post_type' => 'post']);
|
$categories = App::blog()->getCategories(['post_type' => 'post']);
|
||||||
|
if (!is_null($categories)) {
|
||||||
|
while ($categories->fetch()) {
|
||||||
|
$level = is_numeric($categories->f('level')) ? (int) $categories->f('level') : 1;
|
||||||
|
$cat_title = is_string($categories->f('cat_title')) ? $categories->f('cat_title') : '';
|
||||||
|
$cat_id = is_numeric($categories->f('cat_id')) ? (string) $categories->f('cat_id') : '';
|
||||||
|
|
||||||
while ($categories->fetch()) {
|
$combo[
|
||||||
$level = is_numeric($categories->f('level')) ? (int) $categories->f('level') : 1;
|
str_repeat(' ', $level - 1) .
|
||||||
$cat_title = is_string($categories->f('cat_title')) ? $categories->f('cat_title') : '';
|
'• ' . Html::escapeHTML($cat_title)
|
||||||
$cat_id = is_numeric($categories->f('cat_id')) ? (string) $categories->f('cat_id') : '';
|
] = $cat_id;
|
||||||
|
}
|
||||||
$combo[
|
|
||||||
str_repeat(' ', $level - 1) .
|
|
||||||
'• ' . Html::escapeHTML($cat_title)
|
|
||||||
] = $cat_id;
|
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Config extends Process
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Configuration has been successfully updated.')
|
__('Configuration has been successfully updated.')
|
||||||
);
|
);
|
||||||
App::backend()->url()->redirect('admin.plugins', [
|
App::bakcend()->url()->redirect('admin.plugins', [
|
||||||
'module' => My::id(),
|
'module' => My::id(),
|
||||||
'conf' => '1',
|
'conf' => '1',
|
||||||
'redir' => !(App::backend()->__get('list') instanceof ModulesList) ? '' : App::backend()->__get('list')->getRedir(),
|
'redir' => !(App::backend()->__get('list') instanceof ModulesList) ? '' : App::backend()->__get('list')->getRedir(),
|
||||||
|
@ -99,8 +99,9 @@ class Config extends Process
|
||||||
|
|
||||||
$msg = [];
|
$msg = [];
|
||||||
if (!is_writable(App::config()->cacheRoot())) {
|
if (!is_writable(App::config()->cacheRoot())) {
|
||||||
$msg[] = (new Text('p', __('Dotclear cache is not writable or not well configured!')))
|
$msg[] = (new Para())
|
||||||
->class('error');
|
->class('error')
|
||||||
|
->text(__('Dotclear cache is not writable or not well configured!'));
|
||||||
}
|
}
|
||||||
if ($s->pub_active) {
|
if ($s->pub_active) {
|
||||||
$msg[] = (new Para())
|
$msg[] = (new Para())
|
||||||
|
|
|
@ -97,8 +97,8 @@ class FeedsActions extends Actions
|
||||||
|
|
||||||
$feeds = ZoneclearFeedServer::instance()->getFeeds($params);
|
$feeds = ZoneclearFeedServer::instance()->getFeeds($params);
|
||||||
while ($feeds->fetch()) {
|
while ($feeds->fetch()) {
|
||||||
$row = new FeedRow($feeds);
|
$row = new FeedRow($feeds);
|
||||||
$this->entries[(string) $row->id] = $row->name;
|
$this->entries[$row->id] = $row->name;
|
||||||
}
|
}
|
||||||
$this->rs = $feeds;
|
$this->rs = $feeds;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\zoneclearFeedServer;
|
namespace Dotclear\Plugin\zoneclearFeedServer;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use Dotclear\App;
|
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
|
@ -73,8 +72,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable / disable feeds.
|
* Enable / disable feeds.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doEnableFeed(FeedsActions $ap, ArrayObject $post): void
|
public static function doEnableFeed(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -88,7 +85,7 @@ class FeedsDefaultActions
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$ap->zcfs->enableFeed((int) $id, $enable);
|
$ap->zcfs->enableFeed($id, $enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(sprintf(
|
Notices::addSuccessNotice(sprintf(
|
||||||
|
@ -111,8 +108,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete feeds posts.
|
* Delete feeds posts.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doDeletePost(FeedsActions $ap, ArrayObject $post): void
|
public static function doDeletePost(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -158,8 +153,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete feeds.
|
* Delete feeds.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doDeleteFeed(FeedsActions $ap, ArrayObject $post): void
|
public static function doDeleteFeed(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -172,7 +165,7 @@ class FeedsDefaultActions
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$ap->zcfs->deleteFeed((int) $id);
|
$ap->zcfs->deleteFeed($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(sprintf(
|
Notices::addSuccessNotice(sprintf(
|
||||||
|
@ -188,8 +181,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update feeds properties.
|
* Update feeds properties.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doUpdateFeed(FeedsActions $ap, ArrayObject $post): void
|
public static function doUpdateFeed(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -202,7 +193,7 @@ class FeedsDefaultActions
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$ap->zcfs->checkFeedsUpdate((int) $id, true);
|
$ap->zcfs->checkFeedsUpdate($id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(sprintf(
|
Notices::addSuccessNotice(sprintf(
|
||||||
|
@ -214,8 +205,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset feeds update timer.
|
* Reset feeds update timer.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doResetUpdate(FeedsActions $ap, ArrayObject $post): void
|
public static function doResetUpdate(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -231,7 +220,7 @@ class FeedsDefaultActions
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur->clean();
|
$cur->clean();
|
||||||
$cur->setField('feed_upd_last', 0);
|
$cur->setField('feed_upd_last', 0);
|
||||||
$ap->zcfs->updateFeed((int) $id, $cur);
|
$ap->zcfs->updateFeed($id, $cur);
|
||||||
//$ap->zcfs->checkFeedsUpdate($id, true);
|
//$ap->zcfs->checkFeedsUpdate($id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +233,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change feeds categories.
|
* Change feeds categories.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doChangeCategory(FeedsActions $ap, ArrayObject $post): void
|
public static function doChangeCategory(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -264,7 +251,7 @@ class FeedsDefaultActions
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur->clean();
|
$cur->clean();
|
||||||
$cur->setField('cat_id', $cat_id == 0 ? null : $cat_id);
|
$cur->setField('cat_id', $cat_id == 0 ? null : $cat_id);
|
||||||
$ap->zcfs->updateFeed((int) $id, $cur);
|
$ap->zcfs->updateFeed($id, $cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(sprintf(
|
Notices::addSuccessNotice(sprintf(
|
||||||
|
@ -312,8 +299,6 @@ class FeedsDefaultActions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change feeds update interval.
|
* Change feeds update interval.
|
||||||
*
|
|
||||||
* @param ArrayObject<string, mixed> $post
|
|
||||||
*/
|
*/
|
||||||
public static function doChangeInterval(FeedsActions $ap, ArrayObject $post): void
|
public static function doChangeInterval(FeedsActions $ap, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
|
@ -332,7 +317,7 @@ class FeedsDefaultActions
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur->clean();
|
$cur->clean();
|
||||||
$cur->setField('feed_upd_int', $upd_int);
|
$cur->setField('feed_upd_int', $upd_int);
|
||||||
$ap->zcfs->updateFeed((int) $id, $cur);
|
$ap->zcfs->updateFeed($id, $cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(sprintf(
|
Notices::addSuccessNotice(sprintf(
|
||||||
|
|
|
@ -182,7 +182,7 @@ class Manage extends Process
|
||||||
(new Label(__('Selected feeds action:'), Label::OUTSIDE_LABEL_BEFORE))
|
(new Label(__('Selected feeds action:'), Label::OUTSIDE_LABEL_BEFORE))
|
||||||
->for('action'),
|
->for('action'),
|
||||||
(new Select('action'))
|
(new Select('action'))
|
||||||
->items($feeds_actions_page->getCombo() ?? []),
|
->items($feeds_actions_page->getCombo()),
|
||||||
(new Submit('feeds-action'))
|
(new Submit('feeds-action'))
|
||||||
->value(__('ok')),
|
->value(__('ok')),
|
||||||
... My::hiddenFields($feeds_filter->values(true)),
|
... My::hiddenFields($feeds_filter->values(true)),
|
||||||
|
|
|
@ -235,7 +235,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_name'))
|
(new Input('feed_name'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->name),
|
->value($v->name),
|
||||||
]),
|
]),
|
||||||
// feed_owner
|
// feed_owner
|
||||||
|
@ -247,7 +247,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_owner'))
|
(new Input('feed_owner'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->owner),
|
->value($v->owner),
|
||||||
]),
|
]),
|
||||||
// feed_url
|
// feed_url
|
||||||
|
@ -259,7 +259,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_url'))
|
(new Input('feed_url'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->url),
|
->value($v->url),
|
||||||
]),
|
]),
|
||||||
// feed_feed
|
// feed_feed
|
||||||
|
@ -271,7 +271,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_feed'))
|
(new Input('feed_feed'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->feed),
|
->value($v->feed),
|
||||||
]),
|
]),
|
||||||
// feed_desc
|
// feed_desc
|
||||||
|
@ -282,7 +282,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_desc'))
|
(new Input('feed_desc'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->desc),
|
->value($v->desc),
|
||||||
]),
|
]),
|
||||||
// feed_tags
|
// feed_tags
|
||||||
|
@ -293,7 +293,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_tags'))
|
(new Input('feed_tags'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->tags),
|
->value($v->tags),
|
||||||
]),
|
]),
|
||||||
// feed_tweeter
|
// feed_tweeter
|
||||||
|
@ -304,7 +304,7 @@ class ManageFeed extends Process
|
||||||
(new Input('feed_tweeter'))
|
(new Input('feed_tweeter'))
|
||||||
->class('maximal')
|
->class('maximal')
|
||||||
->size(60)
|
->size(60)
|
||||||
->maxlength(255)
|
->maxlenght(255)
|
||||||
->value($v->tweeter),
|
->value($v->tweeter),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
@ -417,7 +417,7 @@ class ManageFeed extends Process
|
||||||
(new Label(__('Selected entries action:'), Label::OUTSIDE_LABEL_BEFORE))
|
(new Label(__('Selected entries action:'), Label::OUTSIDE_LABEL_BEFORE))
|
||||||
->for('action'),
|
->for('action'),
|
||||||
(new Select('action'))
|
(new Select('action'))
|
||||||
->items($posts_actions_page->getCombo() ?? []),
|
->items($posts_actions_page->getCombo()),
|
||||||
(new Submit('feed-action'))
|
(new Submit('feed-action'))
|
||||||
->value(__('ok')),
|
->value(__('ok')),
|
||||||
... My::hiddenFields($post_filter->values()),
|
... My::hiddenFields($post_filter->values()),
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ManageFeedVars
|
||||||
$feed = $z->getFeeds(['feed_id' => $_REQUEST['feed_id']]);
|
$feed = $z->getFeeds(['feed_id' => $_REQUEST['feed_id']]);
|
||||||
|
|
||||||
if ($feed->isEmpty()) {
|
if ($feed->isEmpty()) {
|
||||||
App::error()->add(__('This feed does not exist.'));
|
Ap::error()->add(__('This feed does not exist.'));
|
||||||
$can_view_page = false;
|
$can_view_page = false;
|
||||||
} else {
|
} else {
|
||||||
$row = new FeedRow($feed);
|
$row = new FeedRow($feed);
|
||||||
|
|
|
@ -56,7 +56,7 @@ class PostsFilter extends Filters
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$users = App::blog()->getPostsUsers();
|
$users = App::blog()->getPostsUsers();
|
||||||
if ($users->isEmpty()) {
|
if (is_null($users) || $users->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -89,7 +89,7 @@ class PostsFilter extends Filters
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$categories = App::blog()->getCategories();
|
$categories = App::blog()->getCategories();
|
||||||
if ($categories->isEmpty()) {
|
if (is_null($categories) || $categories->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -143,7 +143,7 @@ class PostsFilter extends Filters
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dates = App::blog()->getDates(['type' => 'month']);
|
$dates = App::blog()->getDates(['type' => 'month']);
|
||||||
if ($dates->isEmpty()) {
|
if (is_null($dates) || $dates->isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
|
@ -30,10 +30,10 @@ class Settings
|
||||||
|
|
||||||
public readonly int $tag_case;
|
public readonly int $tag_case;
|
||||||
|
|
||||||
/** @var array<int, string> */
|
/** @var array<int,string> */
|
||||||
public readonly array $post_full_tpl;
|
public readonly array $post_full_tpl;
|
||||||
|
|
||||||
/** @var array<int, string> */
|
/** @var array<int,string> */
|
||||||
public readonly array $post_title_redir;
|
public readonly array $post_title_redir;
|
||||||
|
|
||||||
public readonly string $user;
|
public readonly string $user;
|
||||||
|
@ -90,7 +90,7 @@ class Settings
|
||||||
{
|
{
|
||||||
$s = My::settings();
|
$s = My::settings();
|
||||||
|
|
||||||
if (property_exists($this, $key) && settype($value, gettype($this->{$key})) === true) {
|
if (!is_null($s) && property_exists($this, $key) && settype($value, gettype($this->{$key})) === true) {
|
||||||
$s->put($key, $value, gettype($this->{$key}));
|
$s->put($key, $value, gettype($this->{$key}));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,9 +19,6 @@ use Dotclear\Helper\L10n;
|
||||||
*/
|
*/
|
||||||
class Template
|
class Template
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function Feeds(ArrayObject $a, string $c): string
|
public static function Feeds(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
$lastn = -1;
|
$lastn = -1;
|
||||||
|
@ -87,9 +84,6 @@ class Template
|
||||||
'App::frontend()->context()->feeds = null; App::frontend()->context()->feeds_params = null; ?>';
|
'App::frontend()->context()->feeds = null; App::frontend()->context()->feeds_params = null; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedIf(ArrayObject $a, string $c): string
|
public static function FeedIf(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
$if = [];
|
$if = [];
|
||||||
|
@ -150,9 +144,6 @@ class Template
|
||||||
'<?php if(' . implode(' ' . $operator . ' ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
'<?php if(' . implode(' ' . $operator . ' ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedIfFirst(ArrayObject $a): string
|
public static function FeedIfFirst(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$ret = Html::escapeHTML(isset($a['return']) && is_string($a['return']) ? $a['return'] : 'first');
|
$ret = Html::escapeHTML(isset($a['return']) && is_string($a['return']) ? $a['return'] : 'first');
|
||||||
|
@ -162,9 +153,6 @@ class Template
|
||||||
"echo '" . addslashes($ret) . "'; } ?>";
|
"echo '" . addslashes($ret) . "'; } ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedIfOdd(ArrayObject $a): string
|
public static function FeedIfOdd(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$ret = Html::escapeHTML(isset($a['return']) && is_string($a['return']) ? $a['return'] : 'odd');
|
$ret = Html::escapeHTML(isset($a['return']) && is_string($a['return']) ? $a['return'] : 'odd');
|
||||||
|
@ -174,65 +162,41 @@ class Template
|
||||||
"echo '" . addslashes($ret) . "'; } ?>";
|
"echo '" . addslashes($ret) . "'; } ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedDesc(ArrayObject $a): string
|
public static function FeedDesc(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_desc');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedOwner(ArrayObject $a): string
|
public static function FeedOwner(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_owner');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_owner');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedCategory(ArrayObject $a): string
|
public static function FeedCategory(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->cat_title');
|
return self::getValue($a, 'App::frontend()->context()->feeds->cat_title');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedCategoryID(ArrayObject $a): string
|
public static function FeedCategoryID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->cat_id');
|
return self::getValue($a, 'App::frontend()->context()->feeds->cat_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedCategoryURL(ArrayObject $a): string
|
public static function FeedCategoryURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::blog()->url().App::url()->getBase(\'category\').\'/\'.Html::sanitizeURL(App::frontend()->context()->feeds->cat_url)');
|
return self::getValue($a, 'App::blog()->url().App::url()->getBase(\'category\').\'/\'.Html::sanitizeURL(App::frontend()->context()->feeds->cat_url)');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedCategoryShortURL(ArrayObject $a): string
|
public static function FeedCategoryShortURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->cat_url');
|
return self::getValue($a, 'App::frontend()->context()->feeds->cat_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedID(ArrayObject $a): string
|
public static function FeedID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_id');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedLang(ArrayObject $a): string
|
public static function FeedLang(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return empty($a['full']) ?
|
return empty($a['full']) ?
|
||||||
|
@ -244,49 +208,31 @@ class Template
|
||||||
'<?php ; } unset($langs); ?>';
|
'<?php ; } unset($langs); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedName(ArrayObject $a): string
|
public static function FeedName(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_name');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedSiteURL(ArrayObject $a): string
|
public static function FeedSiteURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_url');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedFeedURL(ArrayObject $a): string
|
public static function FeedFeedURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getValue($a, 'App::frontend()->context()->feeds->feed_feed');
|
return self::getValue($a, 'App::frontend()->context()->feeds->feed_feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedsHeader(ArrayObject $a, string $c): string
|
public static function FeedsHeader(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (App::frontend()->context()->feeds->isStart()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->feeds->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedsFooter(ArrayObject $a, string $c): string
|
public static function FeedsFooter(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (App::frontend()->context()->feeds->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->feeds->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedsCount(ArrayObject $a): string
|
public static function FeedsCount(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no sources';
|
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no sources';
|
||||||
|
@ -304,9 +250,6 @@ class Template
|
||||||
'} unset($fcount); ?>';
|
'} unset($fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedsEntriesCount(ArrayObject $a): string
|
public static function FeedsEntriesCount(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no entries';
|
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no entries';
|
||||||
|
@ -331,9 +274,6 @@ class Template
|
||||||
'} unset($allfeeds,$fcount); ?>';
|
'} unset($allfeeds,$fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
public static function FeedEntriesCount(ArrayObject $a): string
|
public static function FeedEntriesCount(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no entries';
|
$none = isset($a['none']) && is_string($a['none']) ? addslashes($a['none']) : 'no entries';
|
||||||
|
@ -352,11 +292,8 @@ class Template
|
||||||
'} unset($fcount); ?>';
|
'} unset($fcount); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ArrayObject<string, mixed> $a
|
|
||||||
*/
|
|
||||||
protected static function getValue(ArrayObject $a, string $v): string
|
protected static function getValue(ArrayObject $a, string $v): string
|
||||||
{
|
{
|
||||||
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($a), $v) . '; ?>';
|
return '<?php echo ' . sprintf(App::fontend()->template()->getFilters($a), $v) . '; ?>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class UrlHandler extends Url
|
||||||
|
|
||||||
# Server js
|
# Server js
|
||||||
} elseif ($args == '/zcfsupd.js' && 3 == $s->bhv_pub_upd) {
|
} elseif ($args == '/zcfsupd.js' && 3 == $s->bhv_pub_upd) {
|
||||||
App::frontend()->template()->appendPath(My::path() . '/default-templates');
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), My::path() . '/default-templates');
|
||||||
self::serveDocument(
|
self::serveDocument(
|
||||||
'zcfsupd.js',
|
'zcfsupd.js',
|
||||||
'text/javascript',
|
'text/javascript',
|
||||||
|
@ -84,11 +84,13 @@ class UrlHandler extends Url
|
||||||
if (!is_string($theme)) {
|
if (!is_string($theme)) {
|
||||||
self::p404();
|
self::p404();
|
||||||
}
|
}
|
||||||
$tplset = App::themes()->getDefine(App::blog()->settings()->get('system')->get('theme'))->get('tplset');
|
$tplset = App::themes()->getDefine($theme)->get('tplset');
|
||||||
if (empty($tplset) || !is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
|
$path = My::path() . '/default-templates/';
|
||||||
$tplset = App::config()->defaultTplset();
|
if (!empty($tplset) && is_dir($path . $tplset)) {
|
||||||
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), $path . $tplset);
|
||||||
|
} else {
|
||||||
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), $path . App::config()->defaultTplset());
|
||||||
}
|
}
|
||||||
App::frontend()->template()->appendPath(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
|
|
||||||
self::serveDocument('zcfeeds.html');
|
self::serveDocument('zcfeeds.html');
|
||||||
}
|
}
|
||||||
# Unknow
|
# Unknow
|
||||||
|
|
|
@ -38,7 +38,7 @@ use Exception;
|
||||||
class ZoneclearFeedServer
|
class ZoneclearFeedServer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Net HTTP timeout.
|
* .
|
||||||
*
|
*
|
||||||
* @var int NET_HTTP_TIMEOUT
|
* @var int NET_HTTP_TIMEOUT
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +66,7 @@ class ZoneclearFeedServer
|
||||||
private static $instance;
|
private static $instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings.
|
* .
|
||||||
*
|
*
|
||||||
* @var Settings $settings
|
* @var Settings $settings
|
||||||
*/
|
*/
|
||||||
|
@ -289,8 +289,8 @@ class ZoneclearFeedServer
|
||||||
/**
|
/**
|
||||||
* Get related posts.
|
* Get related posts.
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $params The query params
|
* @param array<string,int|string|array> $params The query params
|
||||||
* @param bool $count_only Return only result count
|
* @param bool $count_only Return only result count
|
||||||
*
|
*
|
||||||
* @return MetaRecord The record instance
|
* @return MetaRecord The record instance
|
||||||
*/
|
*/
|
||||||
|
@ -315,14 +315,16 @@ class ZoneclearFeedServer
|
||||||
|
|
||||||
unset($params['feed_id']);
|
unset($params['feed_id']);
|
||||||
|
|
||||||
return App::blog()->getPosts($params, $count_only, $sql);
|
$rs = App::blog()->getPosts($params, $count_only, $sql);
|
||||||
|
|
||||||
|
return is_null($rs) ? MetaRecord::newFromArray([]) : $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get feed record.
|
* Get feed record.
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $params The query params
|
* @param array<string,int|string|array> $params The query params
|
||||||
* @param bool $count_only Return only result count
|
* @param bool $count_only Return only result count
|
||||||
*
|
*
|
||||||
* @return MetaRecord The record instance
|
* @return MetaRecord The record instance
|
||||||
*/
|
*/
|
||||||
|
@ -771,7 +773,7 @@ class ZoneclearFeedServer
|
||||||
# Enable
|
# Enable
|
||||||
if ($enable) {
|
if ($enable) {
|
||||||
// backup current user
|
// backup current user
|
||||||
if (!App::auth()->userID()) {
|
if (!is_null(App::auth()->userID()) && !is_string(App::auth()->userID())) {
|
||||||
throw new Exception('Unable to backup user');
|
throw new Exception('Unable to backup user');
|
||||||
}
|
}
|
||||||
$this->user = App::auth()->userID();
|
$this->user = App::auth()->userID();
|
||||||
|
|
Loading…
Reference in New Issue