check if plugin is configured
This commit is contained in:
parent
3039ca75e5
commit
d081835649
24
_admin.php
24
_admin.php
@ -18,7 +18,10 @@ dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
|
||||
|
||||
require_once __DIR__ . '/_widgets.php';
|
||||
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
||||
&& '' != dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_user
|
||||
) {
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
__('Feeds server'),
|
||||
dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer'),
|
||||
dcPage::getPF('zoneclearFeedServer/icon.svg'),
|
||||
@ -27,12 +30,9 @@ dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
$_SERVER['REQUEST_URI']
|
||||
),
|
||||
dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
|
||||
);
|
||||
);
|
||||
|
||||
# Delete related info about feed post in meta table
|
||||
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
||||
|
||||
if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)) {
|
||||
if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)) {
|
||||
# Dashboard icon
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['zcfsAdminBehaviors', 'adminDashboardFavoritesV2']);
|
||||
# User pref
|
||||
@ -41,12 +41,16 @@ if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->
|
||||
# Add info about feed on post page sidebar
|
||||
dcCore::app()->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
|
||||
dcCore::app()->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
|
||||
}
|
||||
|
||||
# Take care about tweakurls (thanks Mathieu M.)
|
||||
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
||||
dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
||||
}
|
||||
}
|
||||
|
||||
# Take care about tweakurls (thanks Mathieu M.)
|
||||
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
||||
dcCore::app()->addbehavior('zcfsAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
||||
}
|
||||
# Delete related info about feed post in meta table
|
||||
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_ZONECLEARFEEDSERVER
|
||||
|
@ -395,6 +395,13 @@ class zoneclearFeedServer
|
||||
*/
|
||||
public function checkFeedsUpdate($id = null, $throw = false)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||
|
||||
# Not configured
|
||||
if (!$s->zoneclearFeedServer_active || !$s->zoneclearFeedServer_user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
# Limit to one update at a time
|
||||
try {
|
||||
$this->lockUpdate();
|
||||
@ -408,7 +415,6 @@ class zoneclearFeedServer
|
||||
|
||||
dt::setTZ(dcCore::app()->blog->settings->system->blog_timezone);
|
||||
$time = time();
|
||||
$s = dcCore::app()->blog->settings->zoneclearFeedServer;
|
||||
|
||||
# All feeds or only one (from admin)
|
||||
$f = !$id ?
|
||||
|
15
index.php
15
index.php
@ -23,13 +23,24 @@ dcPage::check(dcAuth::PERMISSION_CONTENT_ADMIN);
|
||||
|
||||
$zcfs = new zoneclearFeedServer();
|
||||
|
||||
# Not configured
|
||||
if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
|
||||
|| !dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_user
|
||||
) {
|
||||
echo
|
||||
'<html><head><title>' . __('Feeds server') . '</title></head><body>' .
|
||||
dcPage::breadcrumb([
|
||||
__('Plugins') => '',
|
||||
__('Feeds server') => '',
|
||||
]) .
|
||||
dcPage::notices();
|
||||
|
||||
############################################################
|
||||
#
|
||||
# One feed
|
||||
#
|
||||
############################################################
|
||||
|
||||
if (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||
} elseif (isset($_REQUEST['part']) && $_REQUEST['part'] == 'feed') {
|
||||
$feed_id = '';
|
||||
$feed_name = '';
|
||||
$feed_desc = '';
|
||||
|
@ -10,5 +10,4 @@
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
dcCore::app()->resources['help']['zoneclearFeedServer'] = __DIR__ . '/help/zoneclearFeedServer.html';
|
||||
|
Loading…
Reference in New Issue
Block a user