123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ActivityVerbPostModule extends ActivityVerbHandlerModule
- {
- const MODULE_VERSION = '2.0.0';
-
- public function tag()
- {
- return 'post';
- }
- public function types()
- {
- return array(ActivityObject::ARTICLE,
- ActivityObject::BLOGENTRY,
- ActivityObject::NOTE,
- ActivityObject::STATUS,
- ActivityObject::COMMENT,
-
- );
- }
- public function verbs()
- {
- return array(ActivityVerb::POST);
- }
-
- protected function saveObjectFromActivity(Activity $act, Notice $stored, array $options=array())
- {
- assert($this->isMyActivity($act));
- $stored->object_type = ActivityUtils::resolveUri($act->objects[0]->type);
- if (common_valid_http_url($act->objects[0]->link)) {
- $stored->url = $act->objects[0]->link;
- }
-
-
-
-
-
- return true;
- }
- public function activityObjectFromNotice(Notice $notice)
- {
- $object = new ActivityObject();
- $object->type = $notice->object_type ?: ActivityObject::NOTE;
- $object->id = $notice->getUri();
- $object->title = sprintf('New %1$s by %2$s', ActivityObject::canonicalType($object->type), $notice->getProfile()->getNickname());
- $object->content = $notice->getRendered();
- $object->link = $notice->getUrl();
- $object->extra[] = array('statusnet:notice_id', null, $notice->getID());
- return $object;
- }
- public function deleteRelated(Notice $notice)
- {
-
- return true;
- }
-
-
-
- protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
- {
- $out->raw($stored->getRendered());
- }
- protected function getActionTitle(ManagedAction $action, $verb, Notice $target, Profile $scoped)
- {
-
- }
- protected function doActionPreparation(ManagedAction $action, $verb, Notice $target, Profile $scoped)
- {
-
- }
- protected function doActionPost(ManagedAction $action, $verb, Notice $target, Profile $scoped)
- {
-
- }
- protected function getActivityForm(ManagedAction $action, $verb, Notice $target, Profile $scoped)
- {
- return new NoticeForm($action, array());
- }
- public function onModuleVersion(array &$versions): bool
- {
- $versions[] = array('name' => 'Post verb',
- 'version' => self::MODULE_VERSION,
- 'author' => 'Mikael Nordfeldth',
- 'homepage' => GNUSOCIAL_ENGINE_URL,
- 'rawdescription' =>
-
- _m('Post handling with ActivityStreams.'));
- return true;
- }
- }
|