• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Activity\IManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OCP\Activity\IManager的典型用法代码示例。如果您正苦于以下问题:PHP IManager类的具体用法?PHP IManager怎么用?PHP IManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $app = $this->getUniqueID('MailQueueHandlerTest');
     $this->userManager = $this->getMock('OCP\\IUserManager');
     $connection = \OC::$server->getDatabaseConnection();
     $query = $connection->prepare('INSERT INTO `*PREFIX*activity_mq` ' . ' (`amq_appid`, `amq_subject`, `amq_subjectparams`, `amq_affecteduser`, `amq_timestamp`, `amq_type`, `amq_latest_send`) ' . ' VALUES(?, ?, ?, ?, ?, ?, ?)');
     $query->execute(array($app, 'Test data', 'Param1', 'user1', 150, 'phpunit', 152));
     $query->execute(array($app, 'Test data', 'Param1', 'user1', 150, 'phpunit', 153));
     $query->execute(array($app, 'Test data', 'Param1', 'user2', 150, 'phpunit', 150));
     $query->execute(array($app, 'Test data', 'Param1', 'user2', 150, 'phpunit', 151));
     $query->execute(array($app, 'Test data', 'Param1', 'user3', 150, 'phpunit', 154));
     $query->execute(array($app, 'Test data', 'Param1', 'user3', 150, 'phpunit', 155));
     $event = $this->getMockBuilder('OCP\\Activity\\IEvent')->disableOriginalConstructor()->getMock();
     $event->expects($this->any())->method('setApp')->willReturnSelf();
     $event->expects($this->any())->method('setType')->willReturnSelf();
     $event->expects($this->any())->method('setAffectedUser')->willReturnSelf();
     $event->expects($this->any())->method('setTimestamp')->willReturnSelf();
     $event->expects($this->any())->method('setSubject')->willReturnSelf();
     $this->activityManager = $this->getMockBuilder('OCP\\Activity\\IManager')->disableOriginalConstructor()->getMock();
     $this->activityManager->expects($this->any())->method('generateEvent')->willReturn($event);
     $this->dataHelper = $this->getMockBuilder('OCA\\Activity\\DataHelper')->disableOriginalConstructor()->getMock();
     $this->dataHelper->expects($this->any())->method('getParameters')->willReturn([]);
     $this->message = $this->getMockBuilder('OC\\Mail\\Message')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMock('OCP\\Mail\\IMailer');
     $this->mailer->expects($this->any())->method('createMessage')->willReturn($this->message);
     $this->mailQueueHandler = new MailQueueHandler($this->getMock('\\OCP\\IDateTimeFormatter'), $connection, $this->dataHelper, $this->mailer, $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock(), $this->userManager, $this->activityManager);
 }
开发者ID:arietimmerman,项目名称:activity,代码行数:28,代码来源:mailqueuehandlertest.php


示例2: show

 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function show()
 {
     try {
         $user = $this->activityManager->getCurrentUserId();
         $userLang = $this->config->getUserValue($user, 'core', 'lang');
         // Overwrite user and language in the helper
         $l = Util::getL10N('activity', $userLang);
         $l->forceLanguage($userLang);
         $this->helper->setL10n($l);
         $this->helper->setUser($user);
         $description = (string) $l->t('Personal activity feed for %s', $user);
         $activities = $this->data->read($this->helper, $this->settings, 0, self::DEFAULT_PAGE_SIZE, 'all', $user);
     } catch (\UnexpectedValueException $e) {
         $l = Util::getL10N('activity');
         $description = (string) $l->t('Your feed URL is invalid');
         $activities = [['activity_id' => -1, 'timestamp' => time(), 'subject' => true, 'subjectformatted' => ['full' => $description]]];
     }
     $response = new TemplateResponse('activity', 'rss', ['rssLang' => $l->getLanguageCode(), 'rssLink' => $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show'), 'rssPubDate' => date('r'), 'description' => $description, 'activities' => $activities], '');
     if ($this->request->getHeader('accept') !== null && stristr($this->request->getHeader('accept'), 'application/rss+xml')) {
         $response->addHeader('Content-Type', 'application/rss+xml');
     } else {
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
     }
     return $response;
 }
开发者ID:samj1912,项目名称:repo,代码行数:31,代码来源:feed.php


示例3: testAppActivity

 public function testAppActivity()
 {
     $this->activityManager->expects($this->once())->method('registerExtension')->willReturnCallback(function ($closure) {
         $this->assertInstanceOf('\\Closure', $closure);
         $navigation = $closure();
         $this->assertInstanceOf('\\OCA\\AnnouncementCenter\\ActivityExtension', $navigation);
     });
     include __DIR__ . '/../../appinfo/app.php';
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:9,代码来源:AppTest.php


示例4: getLinkList

 /**
  * Get all items for the users we want to send an email to
  *
  * @return array Notification data (user => array of rows from the table)
  */
 public function getLinkList()
 {
     $topEntries = [['id' => 'all', 'name' => (string) $this->l->t('All Activities'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList')]];
     if ($this->user && $this->userSettings->getUserSetting($this->user, 'setting', 'self')) {
         $topEntries[] = ['id' => 'self', 'name' => (string) $this->l->t('Activities by you'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'self'))];
         $topEntries[] = ['id' => 'by', 'name' => (string) $this->l->t('Activities by others'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'by'))];
     }
     $additionalEntries = $this->activityManager->getNavigation();
     $topEntries = array_merge($topEntries, $additionalEntries['top']);
     return array('top' => $topEntries, 'apps' => $additionalEntries['apps']);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:16,代码来源:navigation.php


示例5: translate

 public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode)
 {
     if ($app !== 'activity_ext') {
         return false;
     }
     $l = $this->getL10N($languageCode);
     if ($this->activityManager->isFormattingFilteredObject()) {
         $translation = $this->translateShort($text, $l, $params);
         if ($translation !== false) {
             return $translation;
         }
     }
     return $this->translateLong($text, $l, $params);
 }
开发者ID:inwinstack,项目名称:owncloud-activity_ext,代码行数:14,代码来源:activity.php


示例6: translation

 /**
  * @brief Translate an event string with the translations from the app where it was send from
  * @param string $app The app where this event comes from
  * @param string $text The text including placeholders
  * @param array $params The parameter for the placeholder
  * @param bool $stripPath Shall we strip the path from file names?
  * @param bool $highlightParams Shall we highlight the parameters in the string?
  *             They will be highlighted with `<strong>`, all data will be passed through
  *             \OCP\Util::sanitizeHTML() before, so no XSS is possible.
  * @return string translated
  */
 public function translation($app, $text, $params, $stripPath = false, $highlightParams = false)
 {
     if (!$text) {
         return '';
     }
     $preparedParams = $this->parameterHelper->prepareParameters($params, $this->parameterHelper->getSpecialParameterList($app, $text), $stripPath, $highlightParams);
     // Allow apps to correctly translate their activities
     $translation = $this->activityManager->translate($app, $text, $preparedParams, $stripPath, $highlightParams, $this->l->getLanguageCode());
     if ($translation !== false) {
         return $translation;
     }
     $l = Util::getL10N($app, $this->l->getLanguageCode());
     return $l->t($text, $preparedParams);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:25,代码来源:datahelper.php


示例7: getDefaultTypes

 /**
  * Get the default selection of types for a method
  *
  * @param string $method Should be one of 'stream' or 'email'
  * @return array Array of strings
  */
 public function getDefaultTypes($method)
 {
     $settings = array();
     if ($method === 'stream') {
         $settings[] = Data::TYPE_SHARE_CREATED;
         $settings[] = Data::TYPE_SHARE_CHANGED;
         $settings[] = Data::TYPE_SHARE_DELETED;
         //			$settings[] = Data::TYPE_SHARE_RESHARED;
         $settings[] = Data::TYPE_SHARE_RESTORED;
         //			$settings[] = Data::TYPE_SHARE_DOWNLOADED;
     }
     if ($method === 'stream' || $method === 'email') {
         $settings[] = Data::TYPE_SHARED;
         //			$settings[] = Data::TYPE_SHARE_EXPIRED;
         //			$settings[] = Data::TYPE_SHARE_UNSHARED;
         //
         //			$settings[] = Data::TYPE_SHARE_UPLOADED;
         //
         //			$settings[] = Data::TYPE_STORAGE_QUOTA_90;
         //			$settings[] = Data::TYPE_STORAGE_FAILURE;
     }
     // Allow other apps to add notification types to the default setting
     $additionalSettings = $this->manager->getDefaultTypes($method);
     $settings = array_merge($settings, $additionalSettings);
     return $settings;
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:32,代码来源:usersettings.php


示例8: sendEmailToUser

 /**
  * Send a notification to one user
  *
  * @param string $userName Username of the recipient
  * @param string $email Email address of the recipient
  * @param string $lang Selected language of the recipient
  * @param string $timezone Selected timezone of the recipient
  * @param int $maxTime
  */
 public function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime)
 {
     $user = $this->userManager->get($userName);
     if (!$user instanceof IUser) {
         return;
     }
     list($mailData, $skippedCount) = $this->getItemsForUser($userName, $maxTime);
     $l = $this->getLanguage($lang);
     $parser = new PlainTextParser($l);
     $this->dataHelper->setUser($userName);
     $this->dataHelper->setL10n($l);
     $this->activityManager->setCurrentUserId($userName);
     $activityList = array();
     foreach ($mailData as $activity) {
         $event = $this->activityManager->generateEvent();
         $event->setApp($activity['amq_appid'])->setType($activity['amq_type'])->setTimestamp($activity['amq_timestamp'])->setSubject($activity['amq_subject'], []);
         $relativeDateTime = $this->dateFormatter->formatDateTimeRelativeDay($activity['amq_timestamp'], 'long', 'medium', new \DateTimeZone($timezone), $l);
         $activityList[] = array($parser->parseMessage($this->dataHelper->translation($activity['amq_appid'], $activity['amq_subject'], $this->dataHelper->getParameters($event, 'subject', $activity['amq_subjectparams']))), $relativeDateTime);
     }
     $alttext = new Template('activity', 'email.notification', '', false);
     $alttext->assign('username', $user->getDisplayName());
     $alttext->assign('activities', $activityList);
     $alttext->assign('skippedCount', $skippedCount);
     $alttext->assign('owncloud_installation', $this->urlGenerator->getAbsoluteURL('/'));
     $alttext->assign('overwriteL10N', $l);
     $emailText = $alttext->fetchPage();
     $message = $this->mailer->createMessage();
     $message->setTo([$email => $user->getDisplayName()]);
     $message->setSubject((string) $l->t('Activity notification'));
     $message->setPlainBody($emailText);
     $message->setFrom([$this->getSenderData('email') => $this->getSenderData('name')]);
     $this->mailer->send($message);
     $this->activityManager->setCurrentUserId(null);
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:43,代码来源:MailQueueHandler.php


示例9: mapperEvent

 /**
  * @param MapperEvent $event
  */
 public function mapperEvent(MapperEvent $event)
 {
     $tagIds = $event->getTags();
     if ($event->getObjectType() !== 'files' || empty($tagIds) || !in_array($event->getEvent(), [MapperEvent::EVENT_ASSIGN, MapperEvent::EVENT_UNASSIGN]) || !$this->appManager->isInstalled('activity')) {
         // System tags not for files, no tags, not (un-)assigning or no activity-app enabled (save the energy)
         return;
     }
     try {
         $tags = $this->tagManager->getTagsByIds($tagIds);
     } catch (TagNotFoundException $e) {
         // User assigned/unassigned a non-existing tag, ignore...
         return;
     }
     if (empty($tags)) {
         return;
     }
     // Get all mount point owners
     $cache = $this->mountCollection->getMountCache();
     $mounts = $cache->getMountsForFileId($event->getObjectId());
     if (empty($mounts)) {
         return;
     }
     $users = [];
     foreach ($mounts as $mount) {
         $owner = $mount->getUser()->getUID();
         $ownerFolder = $this->rootFolder->getUserFolder($owner);
         $nodes = $ownerFolder->getById($event->getObjectId());
         if (!empty($nodes)) {
             /** @var Node $node */
             $node = array_shift($nodes);
             $path = $node->getPath();
             if (strpos($path, '/' . $owner . '/files/') === 0) {
                 $path = substr($path, strlen('/' . $owner . '/files'));
             }
             // Get all users that have access to the mount point
             $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true));
         }
     }
     $actor = $this->session->getUser();
     if ($actor instanceof IUser) {
         $actor = $actor->getUID();
     } else {
         $actor = '';
     }
     $activity = $this->activityManager->generateEvent();
     $activity->setApp(Extension::APP_NAME)->setType(Extension::APP_NAME)->setAuthor($actor)->setObject($event->getObjectType(), $event->getObjectId());
     foreach ($users as $user => $path) {
         $activity->setAffectedUser($user);
         foreach ($tags as $tag) {
             if ($event->getEvent() === MapperEvent::EVENT_ASSIGN) {
                 $activity->setSubject(Extension::ASSIGN_TAG, [$actor, $path, $this->prepareTagAsParameter($tag)]);
             } else {
                 if ($event->getEvent() === MapperEvent::EVENT_UNASSIGN) {
                     $activity->setSubject(Extension::UNASSIGN_TAG, [$actor, $path, $this->prepareTagAsParameter($tag)]);
                 }
             }
             $this->activityManager->publish($activity);
         }
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:63,代码来源:listener.php


示例10: testCreatePublicity

 public function testCreatePublicity()
 {
     $event = $this->getMockBuilder('OCP\\Activity\\IEvent')->disableOriginalConstructor()->getMock();
     $event->expects($this->once())->method('setApp')->with('announcementcenter')->willReturnSelf();
     $event->expects($this->once())->method('setType')->with('announcementcenter')->willReturnSelf();
     $event->expects($this->once())->method('setAuthor')->with('author')->willReturnSelf();
     $event->expects($this->once())->method('setTimestamp')->with(1337)->willReturnSelf();
     $event->expects($this->once())->method('setSubject')->with('announcementsubject#10', ['author'])->willReturnSelf();
     $event->expects($this->once())->method('setMessage')->with('announcementmessage#10', ['author'])->willReturnSelf();
     $event->expects($this->once())->method('setObject')->with('announcement', 10)->willReturnSelf();
     $event->expects($this->exactly(5))->method('setAffectedUser')->willReturnSelf();
     $notification = $this->getMockBuilder('OC\\Notification\\INotification')->disableOriginalConstructor()->getMock();
     $notification->expects($this->once())->method('setApp')->with('announcementcenter')->willReturnSelf();
     $dateTime = new \DateTime();
     $dateTime->setTimestamp(1337);
     $notification->expects($this->once())->method('setDateTime')->with($dateTime)->willReturnSelf();
     $notification->expects($this->once())->method('setSubject')->with('announced', ['author'])->willReturnSelf();
     $notification->expects($this->once())->method('setObject')->with('announcement', 10)->willReturnSelf();
     $notification->expects($this->once())->method('setLink')->willReturnSelf();
     $notification->expects($this->exactly(4))->method('setUser')->willReturnSelf();
     $controller = $this->getController();
     $this->activityManager->expects($this->once())->method('generateEvent')->willReturn($event);
     $this->notificationManager->expects($this->once())->method('createNotification')->willReturn($notification);
     $this->userManager->expects($this->once())->method('search')->with('')->willReturn([$this->getUserMock('author', 'User One'), $this->getUserMock('u2', 'User Two'), $this->getUserMock('u3', 'User Three'), $this->getUserMock('u4', 'User Four'), $this->getUserMock('u5', 'User Five')]);
     $this->activityManager->expects($this->exactly(5))->method('publish');
     $this->notificationManager->expects($this->exactly(4))->method('notify');
     $this->invokePrivate($controller, 'createPublicity', [10, 'author', 1337]);
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:28,代码来源:PageControllerTest.php


示例11: translate

 /**
  * The extension can translate a given message to the requested languages.
  * If no translation is available false is to be returned.
  *
  * @param string $app
  * @param string $text
  * @param array $params
  * @param boolean $stripPath
  * @param boolean $highlightParams
  * @param string $languageCode
  * @return string|false
  */
 public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode)
 {
     if ($app === 'announcementcenter') {
         $l = $this->languageFactory->get('announcementcenter', $languageCode);
         list(, $id) = explode('#', $text);
         try {
             $announcement = $this->manager->getAnnouncement($id, $highlightParams);
         } catch (\InvalidArgumentException $e) {
             return (string) $l->t('Announcement does not exist anymore', $params);
         }
         if (strpos($text, 'announcementmessage#') === 0) {
             return $announcement['message'];
         }
         if ($highlightParams) {
             $params[] = '<strong>' . $announcement['subject'] . '</strong>';
         } else {
             $params[] = $announcement['subject'];
         }
         if ($announcement['author'] === $this->activityManager->getCurrentUserId()) {
             array_shift($params);
             return (string) $l->t('You announced %s', $params);
         }
         return (string) $l->t('%s announced %s', $params);
     }
     return false;
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:38,代码来源:activityextension.php


示例12: show

 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function show()
 {
     try {
         $user = $this->activityManager->getCurrentUserId();
         $userLang = $this->config->getUserValue($user, 'core', 'lang');
         // Overwrite user and language in the helper
         $this->l = $this->l10nFactory->get('activity', $userLang);
         $parser = new PlainTextParser($this->l);
         $this->helper->setL10n($this->l);
         $this->helper->setUser($user);
         $description = (string) $this->l->t('Personal activity feed for %s', $user);
         $response = $this->data->get($this->helper, $this->settings, $user, 0, self::DEFAULT_PAGE_SIZE, 'desc', 'all');
         $data = $response['data'];
         $activities = [];
         foreach ($data as $activity) {
             $activity['subject_prepared'] = $parser->parseMessage($activity['subject_prepared']);
             $activity['message_prepared'] = $parser->parseMessage($activity['message_prepared']);
             $activities[] = $activity;
         }
     } catch (\UnexpectedValueException $e) {
         $this->l = $this->l10nFactory->get('activity');
         $description = (string) $this->l->t('Your feed URL is invalid');
         $activities = [['activity_id' => -1, 'timestamp' => time(), 'subject' => true, 'subject_prepared' => $description]];
     }
     $response = new TemplateResponse('activity', 'rss', ['rssLang' => $this->l->getLanguageCode(), 'rssLink' => $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show'), 'rssPubDate' => date('r'), 'description' => $description, 'activities' => $activities], '');
     if ($this->request->getHeader('accept') !== null && stristr($this->request->getHeader('accept'), 'application/rss+xml')) {
         $response->addHeader('Content-Type', 'application/rss+xml');
     } else {
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
     }
     return $response;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:38,代码来源:Feed.php


示例13: mockUserSession

 protected function mockUserSession($user)
 {
     $mockUser = $this->getMockBuilder('\\OCP\\IUser')->disableOriginalConstructor()->getMock();
     $mockUser->expects($this->any())->method('getUID')->willReturn($user);
     $this->session->expects($this->any())->method('isLoggedIn')->willReturn(true);
     $this->session->expects($this->any())->method('getUser')->willReturn($mockUser);
     $this->manager->expects($this->any())->method('getCurrentUserId')->willReturn($user);
 }
开发者ID:ynott,项目名称:activity,代码行数:8,代码来源:feedtest.php


示例14: actorIsCurrentUser

 /**
  * Check if the author is the current user
  *
  * @param string $user Parameter e.g. `<user display-name="admin">admin</user>`
  * @return bool
  */
 protected function actorIsCurrentUser($user)
 {
     try {
         return strip_tags($user) === $this->activityManager->getCurrentUserId();
     } catch (\UnexpectedValueException $e) {
         return false;
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:14,代码来源:Extension.php


示例15: getSpecialParameterList

 /**
  * List with special parameters for the message
  *
  * @param string $app
  * @param string $text
  * @return array
  */
 public function getSpecialParameterList($app, $text)
 {
     $specialParameters = $this->activityManager->getSpecialParameterList($app, $text);
     if ($specialParameters !== false) {
         return $specialParameters;
     }
     return array();
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:15,代码来源:parameterhelper.php


示例16: downloadShare

 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * @param string $token
  * @param string $files
  * @param string $path
  * @return void|RedirectResponse
  */
 public function downloadShare($token, $files = null, $path = '')
 {
     \OC_User::setIncognitoMode(true);
     $linkItem = OCP\Share::getShareByToken($token, false);
     // Share is password protected - check whether the user is permitted to access the share
     if (isset($linkItem['share_with'])) {
         if (!Helper::authenticate($linkItem)) {
             return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate', array('token' => $token)));
         }
     }
     $files_list = null;
     if (!is_null($files)) {
         // download selected files
         $files_list = json_decode($files);
         // in case we get only a single file
         if ($files_list === null) {
             $files_list = array($files);
         }
     }
     $originalSharePath = self::getPath($token);
     // Create the activities
     if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) {
         $originalSharePath = Filesystem::normalizePath($originalSharePath . $path);
         $isDir = \OC\Files\Filesystem::is_dir($originalSharePath);
         $activities = [];
         if (!$isDir) {
             // Single file public share
             $activities[$originalSharePath] = Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
         } else {
             if (!empty($files_list)) {
                 // Only some files are downloaded
                 foreach ($files_list as $file) {
                     $filePath = Filesystem::normalizePath($originalSharePath . '/' . $file);
                     $isDir = \OC\Files\Filesystem::is_dir($filePath);
                     $activities[$filePath] = $isDir ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED;
                 }
             } else {
                 // The folder is downloaded
                 $activities[$originalSharePath] = Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED;
             }
         }
         foreach ($activities as $filePath => $subject) {
             $this->activityManager->publishActivity('files_sharing', $subject, array($filePath), '', array(), $filePath, '', $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM);
         }
     }
     // download selected files
     if (!is_null($files)) {
         // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
         // after dispatching the request which results in a "Cannot modify header information" notice.
         OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
         exit;
     } else {
         // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
         // after dispatching the request which results in a "Cannot modify header information" notice.
         OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD');
         exit;
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:67,代码来源:sharecontroller.php


示例17: authorIsCurrentUser

 /**
  * Check if the author is the current user
  *
  * @param string $user Parameter e.g. `<user display-name="admin">admin</user>`
  * @return bool
  */
 protected function authorIsCurrentUser($user)
 {
     try {
         return strip_tags($user) === $this->activityManager->getCurrentUserId();
     } catch (\UnexpectedValueException $e) {
         // FIXME this is awkward, but we have no access to the current user in emails
         return false;
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:15,代码来源:Extension.php


示例18: getDefaultSetting

 /**
  * Get a good default setting for a preference
  *
  * @param string $method Should be one of 'stream', 'email' or 'setting'
  * @param string $type One of the activity types, 'batchtime', 'self' or 'selfemail'
  * @return bool|int
  */
 public function getDefaultSetting($method, $type)
 {
     if ($method === 'setting') {
         if ($type === 'batchtime') {
             return 3600;
         } else {
             if ($type === 'self') {
                 return true;
             } else {
                 if ($type === 'selfemail') {
                     return false;
                 }
             }
         }
     }
     $settings = $this->manager->getDefaultTypes($method);
     return in_array($type, $settings);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:25,代码来源:usersettings.php


示例19: getLinkList

 /**
  * Get all items for the users we want to send an email to
  *
  * @return array Notification data (user => array of rows from the table)
  */
 public function getLinkList()
 {
     $topEntries = array(array('id' => 'all', 'name' => (string) $this->l->t('All Activities'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList')), array('id' => 'self', 'name' => (string) $this->l->t('Activities by you'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'self'))), array('id' => 'by', 'name' => (string) $this->l->t('Activities by others'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'by'))), array('id' => 'shares', 'name' => (string) $this->l->t('Shares'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'shares'))));
     $appFilterEntries = array(array('id' => 'files', 'name' => (string) $this->l->t('Files'), 'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'files'))));
     $additionalEntries = $this->activityManager->getNavigation();
     $topEntries = array_merge($topEntries, $additionalEntries['top']);
     $appFilterEntries = array_merge($appFilterEntries, $additionalEntries['apps']);
     return array('top' => $topEntries, 'apps' => $appFilterEntries);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:14,代码来源:navigation.php


示例20: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->session = $this->getMockBuilder('OCP\\IUserSession')->disableOriginalConstructor()->getMock();
     $this->config = $this->getMockBuilder('OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->activityHelper = $this->getMockBuilder('OCA\\Files\\ActivityHelper')->disableOriginalConstructor()->getMock();
     $this->activityManager = new \OC\Activity\Manager($this->request, $this->session, $this->config);
     $this->l10nFactory = $this->getMockBuilder('OCP\\L10N\\IFactory')->disableOriginalConstructor()->getMock();
     $deL10n = $this->getMockBuilder('OC_L10N')->disableOriginalConstructor()->getMock();
     $deL10n->expects($this->any())->method('t')->willReturnCallback(function ($argument) {
         return 'translate(' . $argument . ')';
     });
     $this->l10nFactory->expects($this->any())->method('get')->willReturnMap([['files', null, new \OC_L10N('files', 'en')], ['files', 'en', new \OC_L10N('files', 'en')], ['files', 'de', $deL10n]]);
     $this->activityExtension = $activityExtension = new Activity($this->l10nFactory, $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock(), $this->activityManager, $this->activityHelper, \OC::$server->getDatabaseConnection(), $this->config);
     $this->activityManager->registerExtension(function () use($activityExtension) {
         return $activityExtension;
     });
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:19,代码来源:ActivityTest.php



注:本文中的OCP\Activity\IManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP App\IAppManager类代码示例发布时间:2022-05-23
下一篇:
PHP OCP\Util类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap