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