auth) || is_null(dcCore::app()->adminurl)) {
return;
}
$favs->register(My::id(), [
'title' => My::name(),
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_USAGE,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),
// update user dashboard favorites icon with nb of updated feeds
'dashboard_cb' => function (ArrayObject $fav): void {
if (is_null(dcCore::app()->adminurl)) {
return;
}
$count = ZoneclearFeedServer::instance()->getFeeds(['feed_status' => '0'], true)->f(0);
if (!$count || !is_numeric($count)) {
return;
}
$fav['title'] .= '
' . sprintf(__('%s feed disabled', '%s feeds disabled', (int) $count), (int) $count);
$fav['large-icon'] = dcPage::getPF(My::id() . '/icon-update.svg');
$fav['url'] = dcCore::app()->adminurl->get(
'admin.plugin.' . My::id(),
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
);
},
]);
}
/**
* Lists columns user preference.
*/
public static function adminColumnsListsV2(ArrayObject $cols): void
{
// feeds
$cols[My::id() . 'feeds'] = [
__('Feeds server: Feeds'),
[
'desc' => [true, __('Feed')],
'period' => [true, __('Frequency')],
'update' => [true, __('Last update')],
'entries' => [true, __('Entries')],
],
];
// feed posts
$cols[My::id() . 'posts'] = [
__('Feeds server: Entries'),
[
'date' => [true, __('Date')],
'category' => [true, __('Category')],
'author' => [true, __('Author')],
],
];
// posts feed
$cols['posts'][1]['feed'] = [true, __('Feed server')];
}
/**
* Lists filter.
*/
public static function adminFiltersListsV2(ArrayObject $sorts): void
{
// feeds
$sorts[My::id() . 'feeds'] = [
__('Feeds server: Feeds'),
Combo::feedsSortby(),
'lowername',
'asc',
[__('feeds per page'), 30],
];
// feed posts
$sorts[My::id() . 'posts'] = [
__('Feeds server: Entries'),
Combo::postsSortby(),
'post_dt',
'desc',
[__('entries per page'), 30],
];
}
/**
* Add head column to posts list.
*/
public static function adminPostListHeaderV2(MetaRecord $rs, ArrayObject $cols): void
{
$cols['feed'] = '