auth->check( dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id ); return static::$init; } public static function process(): bool { if (!static::$init) { return false; } dcCore::app()->addBehavior('adminPostsActions', function (dcPostsActions $pa) { $pa->addAction( [ __('Comments') => [ __('Mark as opened') => 'commentsopen', __('Mark as closed') => 'commentsclose', __('Delete all comments') => 'commentsdelete', ], __('Trackbacks') => [ __('Mark as opened') => 'trackbacksopen', __('Mark as closed') => 'trackbacksclose', __('Delete all trackbacks') => 'trackbacksdelete', ], ], function (dcPostsActions $pa, ArrayObject $post) { $actions = [ 'commentsopen', 'commentsclose', 'commentsdelete', 'trackbacksopen', 'trackbacksclose', 'trackbacksdelete', ]; if (in_array($pa->getAction(), $actions)) { BackendBehaviors::{$pa->getAction()}($pa, $post); } } ); }); return true; } }