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