enhancePostContent/_public.php

40 lines
1.1 KiB
PHP
Raw Normal View History

2021-08-23 23:55:52 +00:00
<?php
2021-09-02 18:35:25 +00:00
/**
* @brief enhancePostContent, a plugin for Dotclear 2
2021-11-01 09:33:43 +00:00
*
2021-09-02 18:35:25 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-01 09:33:43 +00:00
*
2021-09-02 18:35:25 +00:00
* @author Jean-Christian Denis and Contributors
2021-11-01 09:33:43 +00:00
*
2021-09-02 18:35:25 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-08-23 23:55:52 +00:00
if (!defined('DC_RC_PATH')) {
return null;
2021-08-23 23:55:52 +00:00
}
2022-11-13 20:30:48 +00:00
require __DIR__ . '/_widgets.php';
2021-08-23 23:55:52 +00:00
2022-12-12 23:16:35 +00:00
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
2021-08-23 23:55:52 +00:00
2022-12-21 21:27:20 +00:00
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('active')) {
2022-11-30 23:41:34 +00:00
return null;
2021-08-23 23:55:52 +00:00
}
2022-11-30 23:41:34 +00:00
// Add filters CSS to page header
2022-12-07 23:04:35 +00:00
dcCore::app()->addBehavior('publicHeadContent', function () {
2022-11-30 23:41:34 +00:00
echo dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('epccss'));
});
// Filter template blocks content
2022-12-07 23:04:35 +00:00
dcCore::app()->addBehavior('publicBeforeContentFilterV2', function ($tag, $args) {
2022-12-12 22:40:10 +00:00
$filters = enhancePostContent::getFilters();
2022-11-30 23:41:34 +00:00
foreach ($filters as $id => $filter) {
2022-12-12 22:40:10 +00:00
if (!enhancePostContent::testContext($tag, $args, $filter)) {
2022-11-30 23:41:34 +00:00
continue;
}
2022-11-30 23:41:34 +00:00
$filter->publicContent($tag, $args);
}
2022-11-30 23:41:34 +00:00
});