activityReport/src/Prepend.php

64 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2021-09-02 22:18:08 +00:00
/**
* @brief activityReport, a plugin for Dotclear 2
2022-11-18 20:24:30 +00:00
*
2021-09-02 22:18:08 +00:00
* @package Dotclear
* @subpackage Plugin
2022-11-18 20:24:30 +00:00
*
2021-09-02 22:18:08 +00:00
* @author Jean-Christian Denis and contributors
2022-11-18 20:24:30 +00:00
*
2021-09-02 22:18:08 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\activityReport;
use dcCore;
2023-08-17 14:25:19 +00:00
use Dotclear\Core\Process;
use Exception;
/**
* Prepend process.
*/
2023-08-17 14:25:19 +00:00
class Prepend extends Process
{
public static function init(): bool
{
2023-08-17 14:25:19 +00:00
return self::status(My::checkContext(My::PREPEND));
}
public static function process(): bool
{
2023-08-17 14:25:19 +00:00
if (!self::status()) {
return false;
}
if (defined('ACTIVITY_REPORT')) {
return true;
}
try {
// launch once activity report stuff
ActivityReport::instance();
// regirster activity feed URL
dcCore::app()->url->register(
My::id(),
'reports',
'^reports/((atom|rss2)/(.+))$',
[UrlHandler::class, 'feed']
);
// declare report open
define('ACTIVITY_REPORT', My::COMPATIBILITY_VERSION);
// register predefined activities scan
ActivityBehaviors::register();
} catch (Exception $e) {
}
return true;
2021-09-03 19:35:13 +00:00
}
2022-11-18 20:24:30 +00:00
}