2015-04-25 19:25:03 +00:00
|
|
|
<?php
|
2021-09-11 09:56:57 +00:00
|
|
|
/**
|
|
|
|
* @brief zoneclearFeedServer, a plugin for Dotclear 2
|
2021-11-06 15:30:19 +00:00
|
|
|
*
|
2021-09-11 09:56:57 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-06 15:30:19 +00:00
|
|
|
*
|
2021-09-11 09:56:57 +00:00
|
|
|
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
|
2021-11-06 15:30:19 +00:00
|
|
|
*
|
2021-09-11 09:56:57 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2015-04-25 19:25:03 +00:00
|
|
|
if (!defined('DC_RC_PATH')) {
|
2018-02-15 01:37:19 +00:00
|
|
|
return null;
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Namespace for settings
|
2022-12-10 16:16:41 +00:00
|
|
|
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
|
|
|
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
2015-04-25 19:25:03 +00:00
|
|
|
|
|
|
|
# Widgets
|
2022-11-15 20:05:21 +00:00
|
|
|
require_once __DIR__ . '/_widgets.php';
|
2015-04-25 19:25:03 +00:00
|
|
|
|
2022-11-15 20:05:21 +00:00
|
|
|
dcCore::app()->addBehavior('coreBlogGetPosts', ['zcfsPublicBehaviors', 'coreBlogGetPosts']);
|
2015-04-25 19:25:03 +00:00
|
|
|
|
|
|
|
if (!$s->zoneclearFeedServer_active) {
|
2021-09-11 09:56:57 +00:00
|
|
|
return null;
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
if (1 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
2022-12-01 23:55:43 +00:00
|
|
|
dcCore::app()->addBehavior('publicBeforeDocumentV2', ['zcfsPublicBehaviors', 'publicDocumentV2']);
|
2021-09-12 20:35:57 +00:00
|
|
|
} elseif (2 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
2022-12-01 23:55:43 +00:00
|
|
|
dcCore::app()->addBehavior('publicAfterDocumentV2', ['zcfsPublicBehaviors', 'publicAfterDocumentV2']);
|
2021-09-12 20:35:57 +00:00
|
|
|
} elseif (3 == $s->zoneclearFeedServer_bhv_pub_upd) {
|
2022-11-15 20:05:21 +00:00
|
|
|
dcCore::app()->addBehavior('publicHeadContent', ['zcfsPublicBehaviors', 'publicHeadContent']);
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Take care about tweakurls (thanks Mathieu M.)
|
2022-11-15 20:05:21 +00:00
|
|
|
if (version_compare(dcCore::app()->plugins->moduleInfo('tweakurls', 'version'), '0.8', '>=')) {
|
|
|
|
dcCore::app()->addbehavior('zoneclearFeedServerAfterPostCreate', ['zoneclearFeedServer', 'tweakurlsAfterPostCreate']);
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Register tempalte blocks
|
2021-09-12 20:35:57 +00:00
|
|
|
$tpl_blocks = [
|
2021-09-11 09:56:57 +00:00
|
|
|
'Feeds',
|
|
|
|
'FeedsFooter',
|
|
|
|
'FeedsHeader',
|
2022-11-15 20:05:21 +00:00
|
|
|
'FeedIf',
|
2021-09-12 20:35:57 +00:00
|
|
|
];
|
2021-11-06 15:30:19 +00:00
|
|
|
foreach ($tpl_blocks as $v) {
|
2022-11-15 20:05:21 +00:00
|
|
|
dcCore::app()->tpl->addBlock('zc' . $v, ['zcfsTemplate', $v]);
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Register tempalte values
|
2021-09-12 20:35:57 +00:00
|
|
|
$tpl_values = [
|
2021-09-11 09:56:57 +00:00
|
|
|
'FeedsCount',
|
|
|
|
'FeedsEntriesCount',
|
|
|
|
'FeedEntriesCount',
|
|
|
|
'FeedCategory',
|
|
|
|
'FeedCategoryID',
|
|
|
|
'FeedCategoryURL',
|
|
|
|
'FeedCategoryShortURL',
|
|
|
|
'FeedID',
|
|
|
|
'FeedIfFirst',
|
|
|
|
'FeedIfOdd',
|
|
|
|
'FeedLang',
|
|
|
|
'FeedName',
|
|
|
|
'FeedOwner',
|
|
|
|
'FeedDesc',
|
|
|
|
'FeedSiteURL',
|
2022-11-15 20:05:21 +00:00
|
|
|
'FeedFeedURL',
|
2021-09-12 20:35:57 +00:00
|
|
|
];
|
2021-11-06 15:30:19 +00:00
|
|
|
foreach ($tpl_values as $v) {
|
2022-11-15 20:05:21 +00:00
|
|
|
dcCore::app()->tpl->addValue('zc' . $v, ['zcfsTemplate', $v]);
|
2015-04-25 19:25:03 +00:00
|
|
|
}
|
|
|
|
|
2022-12-10 21:20:42 +00:00
|
|
|
dcCore::app()->addBehavior('publicBreadcrumb', function ($context, $separator) {
|
|
|
|
if ($context == 'zoneclearFeedsPage') {
|
|
|
|
return __('List of feeds');
|
2021-09-11 09:56:57 +00:00
|
|
|
}
|
2022-12-10 21:20:42 +00:00
|
|
|
});
|