From 9be9f44757ba04be79cf5b4d93118cd9d71f0135 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
' . sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
$fav['large-icon'] = dcPage::getPF('zoneclearFeedServer/icon-big-update.png');
- $fav['url'] = $core->adminurl->get(
+ $fav['url'] = dcCore::app()->adminurl->get(
'admin.plugin.zoneclearFeedServer',
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
);
@@ -136,10 +133,9 @@ class zcfsAdminBehaviors
/**
* User pref columns lists.
*
- * @param dcCore $core dcCore instance
* @param arrayObject $cols Columns
*/
- public static function adminColumnsLists(dcCore $core, $cols)
+ public static function adminColumnsLists($cols)
{
$cols['zcfs_feeds'] = [
__('Feeds server: Feeds'),
@@ -147,40 +143,39 @@ class zcfsAdminBehaviors
'desc' => [true, __('Feed')],
'period' => [true, __('Frequency')],
'update' => [true, __('Last update')],
- 'entries' => [true, __('Entries')]
- ]
+ 'entries' => [true, __('Entries')],
+ ],
];
$cols['zcfs_entries'] = [
__('Feeds server: Entries'),
[
'date' => [true, __('Date')],
'category' => [true, __('Category')],
- 'author' => [true, __('Author')]
- ]
+ 'author' => [true, __('Author')],
+ ],
];
}
/**
* User pref filters options.
*
- * @param dcCore $core dcCore instance
* @param arrayObject $sorts Sort options
*/
- public static function adminFiltersLists(dcCore $core, $sorts)
+ public static function adminFiltersLists($sorts)
{
$sorts['zcfs_feeds'] = [
__('Feeds server: Feeds'),
self::feedsSortbyCombo(),
'lowername',
'asc',
- [__('feeds per page'), 30]
+ [__('feeds per page'), 30],
];
$sorts['zcfs_entries'] = [
__('Feeds server: Entries'),
self::entriesSortbyCombo(),
'post_dt',
'desc',
- [__('entries per page'), 30]
+ [__('entries per page'), 30],
];
}
@@ -207,50 +202,48 @@ class zcfsAdminBehaviors
return null;
}
- global $core;
-
- $url = $core->meta->getMetadata([
+ $url = dcCore::app()->meta->getMetadata([
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_url',
- 'limit' => 1
+ 'limit' => 1,
]);
$url = $url->isEmpty() ? '' : $url->meta_id;
if (!$url) {
return null;
}
- $author = $core->meta->getMetadata([
+ $author = dcCore::app()->meta->getMetadata([
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_author',
- 'limit' => 1
+ 'limit' => 1,
]);
$author = $author->isEmpty() ? '' : $author->meta_id;
- $site = $core->meta->getMetadata([
+ $site = dcCore::app()->meta->getMetadata([
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_site',
- 'limit' => 1
+ 'limit' => 1,
]);
$site = $site->isEmpty() ? '' : $site->meta_id;
- $sitename = $core->meta->getMetadata([
+ $sitename = dcCore::app()->meta->getMetadata([
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_sitename',
- 'limit' => 1
+ 'limit' => 1,
]);
$sitename = $sitename->isEmpty() ? '' : $sitename->meta_id;
$edit = '';
- if ($core->auth->check('admin', $core->blog->id)) {
- $fid = $core->meta->getMetadata([
+ if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)) {
+ $fid = dcCore::app()->meta->getMetadata([
'post_id' => $post->post_id,
'meta_type' => 'zoneclearfeed_id',
- 'limit' => 1
+ 'limit' => 1,
]);
if (!$fid->isEmpty()) {
$edit = sprintf(
'',
- $core->adminurl->get(
+ dcCore::app()->adminurl->get(
'admin.plugin.zoneclearFeedServer',
['part' => 'feed', 'feed_id' => $fid->meta_id]
),
@@ -276,17 +269,15 @@ class zcfsAdminBehaviors
*/
public static function adminBeforePostDelete($post_id)
{
- global $core;
-
- $core->con->execute(
- 'DELETE FROM ' . $core->prefix . 'meta ' .
+ dcCore::app()->con->execute(
+ 'DELETE FROM ' . dcCore::app()->prefix . dcMeta::META_TABLE_NAME . ' ' .
'WHERE post_id = ' . ((int) $post_id) . ' ' .
- 'AND meta_type ' . $core->con->in([
+ 'AND meta_type ' . dcCore::app()->con->in([
'zoneclearfeed_url',
'zoneclearfeed_author',
'zoneclearfeed_site',
'zoneclearfeed_sitename',
- 'zoneclearfeed_id'
+ 'zoneclearfeed_id',
]) . ' '
);
}
diff --git a/_config.php b/_config.php
index 8efce9a..596a447 100644
--- a/_config.php
+++ b/_config.php
@@ -14,11 +14,11 @@ if (!defined('DC_CONTEXT_MODULE')) {
return null;
}
-$redir = empty($_REQUEST['redir']) ? $list->getURL() . '#plugins' : $_REQUEST['redir'];
+$redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
# -- Get settings --
-$core->blog->settings->addNamespace('zoneclearFeedServer');
-$s = $core->blog->settings->zoneclearFeedServer;
+dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
+$s = dcCore::app()->blog->settings->zoneclearFeedServer;
$active = (bool) $s->zoneclearFeedServer_active;
$pub_active = (bool) $s->zoneclearFeedServer_pub_active;
@@ -41,7 +41,7 @@ if (!is_array($post_title_redir)) {
$post_title_redir = [];
}
-$zc = new zoneclearFeedServer($core);
+$zc = new zoneclearFeedServer();
# -- Set settings --
if (!empty($_POST['save'])) {
@@ -72,17 +72,17 @@ if (!empty($_POST['save'])) {
$s->put('zoneclearFeedServer_post_title_redir', serialize($post_title_redir));
$s->put('zoneclearFeedServer_user', $feeduser);
- $core->blog->triggerBlog();
+ dcCore::app()->blog->triggerBlog();
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('Configuration successfully updated.')
);
- $core->adminurl->redirect(
+ dcCore::app()->adminurl->redirect(
'admin.plugins',
- ['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => $list->getRedir()]
+ ['module' => 'zoneclearFeedServer', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
);
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -92,20 +92,20 @@ $combo_pubupd = [
__('Disable') => 0,
__('Before display') => 1,
__('After display') => 2,
- __('Through Ajax') => 3
+ __('Through Ajax') => 3,
];
$combo_status = [
__('Unpublished') => 0,
- __('Published') => 1
+ __('Published') => 1,
];
$combo_tagcase = [
__('Keep source case') => 0,
__('First upper case') => 1,
__('All lower case') => 2,
- __('All upper case') => 3
+ __('All upper case') => 3,
];
-$pub_page_url = $core->blog->url . $core->url->getBase('zoneclearFeedsPage');
+$pub_page_url = dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage');
# -- Display form --
@@ -124,7 +124,7 @@ __('Enable plugin') . '
' . __('Show full content on:') . '