本文整理汇总了PHP中OW_Event::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP OW_Event::setData方法的具体用法?PHP OW_Event::setData怎么用?PHP OW_Event::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW_Event
的用法示例。
在下文中一共展示了OW_Event::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeContentAdd
public function beforeContentAdd(OW_Event $event)
{
$params = $event->getParams();
if ($params["type"] != "link") {
return;
}
if (empty($params["data"])) {
$event->setData(false);
return;
}
$creditsParams = array('pluginKey' => 'links', 'action' => 'add_link');
$credits = OW::getEventManager()->call('usercredits.check_balance', $creditsParams);
if ($credits === false) {
$event->setData(array("error" => OW::getEventManager()->call('usercredits.error_message', $creditsParams)));
return;
}
$attachment = $params["data"];
$thumbnailUrl = empty($attachment['thumbnail_url']) ? null : $attachment['thumbnail_url'];
$title = empty($attachment['title']) ? null : $attachment['title'];
$description = empty($attachment['description']) ? null : $attachment['description'];
$href = $attachment['href'];
$linkId = $this->addLink($params["userId"], $href, $title, $description, $thumbnailUrl, $params["status"]);
if (empty($linkId)) {
$event->setData(false);
return;
}
OW::getEventManager()->call('usercredits.track_action', $creditsParams);
$event->setData(array('entityType' => 'link', 'entityId' => $linkId));
}
示例2: beforeContentAdd
public function beforeContentAdd(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if (!empty($data)) {
return;
}
if (empty($params["status"]) && empty($params["data"])) {
$event->setData(false);
return;
}
$attachId = null;
$content = array();
if (!empty($params["data"])) {
$content = $params["data"];
if ($content['type'] == 'photo' && !empty($content['genId'])) {
$content['url'] = $content['href'] = OW::getEventManager()->call('base.attachment_save_image', array('genId' => $content['genId']));
$attachId = $content['genId'];
}
if ($content['type'] == 'video') {
$content['html'] = BOL_TextFormatService::getInstance()->validateVideoCode($content['html']);
}
}
$status = UTIL_HtmlTag::autoLink($params["status"]);
$out = NEWSFEED_BOL_Service::getInstance()->addStatus(OW::getUser()->getId(), $params['feedType'], $params['feedId'], $params['visibility'], $status, array("content" => $content, "attachmentId" => $attachId));
$event->setData($out);
}
示例3: onGetInfo
public function onGetInfo(OW_Event $event)
{
$params = $event->getParams();
if ($params["entityType"] != self::ENTITY_TYPE) {
return;
}
if (empty($params["entityIds"])) {
return array();
}
$events = $this->service->findByIdList($params["entityIds"]);
$out = array();
/*@var $eventDto EVENT_BOL_Event */
foreach ($events as $eventDto) {
$info = array();
$info["id"] = $eventDto->id;
$info["userId"] = $eventDto->userId;
$info["title"] = $eventDto->title;
$info["description"] = $eventDto->description;
$info["url"] = $this->service->getEventUrl($eventDto->id);
$info["timeStamp"] = $eventDto->createTimeStamp;
$info["startStamp"] = $eventDto->startTimeStamp;
$info["endStamp"] = $eventDto->endTimeStamp;
$info["image"] = array("thumbnail" => $eventDto->getImage() ? $this->service->generateImageUrl($eventDto->getImage(), true) : $this->service->generateDefaultImageUrl(), "preview" => $eventDto->getImage() ? $this->service->generateImageUrl($eventDto->getImage(), false) : null);
$out[$eventDto->id] = $info;
}
$event->setData($out);
return $out;
}
示例4: onGetInfo
public function onGetInfo(OW_Event $event)
{
$params = $event->getParams();
if ($params['entityType'] != self::ENTITY_TYPE) {
return;
}
$photoDao = PHOTO_BOL_PhotoDao::getInstance();
$route = OW::getRouter();
$out = array();
foreach ($photoDao->getPhotoListByIdList($params['entityIds']) as $photo) {
$info = array();
$info['id'] = $photo['id'];
$info['userId'] = $photo['userId'];
$info['description'] = $photo['description'];
$info['url'] = $route->urlForRoute('view_photo', array('id' => $photo['id']));
$info['timeStamp'] = $photo['addDatetime'];
$info['image'] = array('thumbnail' => $photoDao->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_SMALL, $photo['hash'], $photo['dimension']), 'preview' => $photoDao->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_PREVIEW, $photo['hash'], $photo['dimension']), 'view' => $photoDao->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_MAIN, $photo['hash'], $photo['dimension']), 'fullsize' => $photoDao->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_FULLSCREEN, $photo['hash'], $photo['dimension']));
$dimension = json_decode($photo['dimension'], true);
$info['dimension'] = array('thumbnail' => $dimension['small'], 'preview' => $dimension['preview'], 'view' => $dimension['main']);
if (!empty($dimension['fullscreen'])) {
$info['dimension']['fullsize'] = $dimension['fullscreen'];
}
$out[$photo['id']] = $info;
}
$event->setData($out);
return $out;
}
示例5: onItemRender
public function onItemRender(OW_Event $event)
{
$params = $event->getParams();
$data = $params["data"];
if (!in_array($params['entityType'], array(self::TYPE_COMMENT, self::TYPE_LIKE))) {
return;
}
$coverId = null;
if (empty($params["data"]["coverId"])) {
$cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId(OW::getUser()->getId());
if (!empty($cover)) {
$coverId = $cover->id;
}
} else {
$coverId = $params["data"]["coverId"];
}
$url = null;
if (!empty($coverId)) {
$url = UHEADER_MCLASS_NewsfeedBridge::getInstance()->getCoverUrl($coverId);
}
if (!empty($url)) {
$data["url"] = $url;
}
$event->setData($data);
}
示例6: onAfterGetUSEARCH_CMP_QuickSearchInstance
public function onAfterGetUSEARCH_CMP_QuickSearchInstance(OW_Event $event)
{
$params = $event->getParams();
if (!empty($params['className'])) {
$event->setData(new FEMALEREGONLYMEN_CMP_QuickSearch());
}
}
示例7: onGetInfo
public function onGetInfo(OW_Event $event)
{
$params = $event->getParams();
if ($params["entityType"] != self::ENTITY_TYPE) {
return;
}
$entityList = $this->service->findClipByIds($params["entityIds"]);
$out = array();
foreach ($entityList as $entity) {
/* @var $entity VIDEO_BOL_Clip */
$info = array();
$info["id"] = $entity->id;
$info["userId"] = $entity->userId;
$info["title"] = $entity->title;
$info["description"] = $entity->description;
$info["url"] = $url = OW::getRouter()->urlForRoute('view_clip', array('id' => $entity->id));
$info["html"] = $entity->code;
$info["timeStamp"] = $entity->addDatetime;
$info["provider"] = $entity->provider;
$info["image"] = array("thumbnail" => $this->service->getClipThumbUrl($entity->id));
if ($info["image"]["thumbnail"] == "undefined") {
$info["image"]["thumbnail"] = $this->service->getClipDefaultThumbUrl();
}
$info["status"] = $entity->status == "approved" ? BOL_ContentService::STATUS_ACTIVE : BOL_ContentService::STATUS_APPROVAL;
$out[$entity->id] = $info;
}
$event->setData($out);
return $out;
}
示例8: getMapItemListCmp
public function getMapItemListCmp(OW_Event $event)
{
$params = $event->getParams();
if (!empty($params['className']) && $params['className'] == 'GOOGLELOCATION_CMP_MapUserList') {
$event->setData(new GOOGLELOCATION_MCMP_MapUserList($params['arguments'][0], $params['arguments'][1], $params['arguments'][2], $params['arguments'][3]));
}
}
示例9: onDublicate
public function onDublicate(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params['entityType'], array(self::TYPE_COMMENT, self::TYPE_LIKE))) {
return;
}
$data = $event->getData();
$oldData = $params['oldData'];
if (in_array($data['userIds'][0], $oldData['userIds'])) {
$event->setData($oldData);
return;
}
$data['userIds'] = array_merge($oldData['userIds'], $data['userIds']);
$users = $oldData['users'];
array_unshift($users, $data['users'][0]);
$userCount = count($users);
if ($userCount == 2) {
$data['string']['key'] = $params['entityType'] == self::TYPE_COMMENT ? 'uheader+notifications_comment_2' : 'uheader+notifications_like_2';
$data['string']['vars'] = array('user1' => '<a href="' . $users[0]['userUrl'] . '">' . $users[0]['userName'] . '</a>', 'user2' => '<a href="' . $users[1]['userUrl'] . '">' . $users[1]['userName'] . '</a>');
}
if ($userCount > 2) {
$data['string']['key'] = 'uheader+notifications_comment_many';
$data['string']['key'] = $params['entityType'] == self::TYPE_COMMENT ? 'uheader+notifications_comment_many' : 'uheader+notifications_like_many';
$data['string']['vars'] = array('user1' => '<a href="' . $users[0]['userUrl'] . '">' . $users[0]['userName'] . '</a>', 'user2' => '<a href="' . $users[1]['userUrl'] . '">' . $users[1]['userName'] . '</a>', 'otherCount' => $userCount - 1);
}
$data['users'] = $users;
$event->setData($data);
}
示例10: ping
public function ping(OW_Event $originalEvent)
{
$data = $originalEvent->getParams();
$event = new BASE_CLASS_ConsoleDataEvent('console.ping', $data, $data);
$this->defaultPing($event);
OW::getEventManager()->trigger($event);
$data = $event->getData();
$originalEvent->setData($data);
}
示例11: onItemRender
public function onItemRender(OW_Event $event)
{
$params = $event->getParams();
$data = $params["data"];
if (!in_array($params['entityType'], array(self::TYPE_TAG_ME, self::TYPE_TAG_MY_PHOTO))) {
return;
}
$event->setData($data);
}
示例12: isUserAdded
public function isUserAdded(OW_Event $event)
{
$params = $event->getParams();
$userId = $params["userId"];
$userDto = $this->service->findUserById($userId);
$data = $userDto !== null;
$event->setData($data);
return $data;
}
示例13: gheader_disable_formats
function gheader_disable_formats(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array(GHEADER_CLASS_CommentsBridge::ENTITY_TYPE))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例14: onFeedItemRenderDisableActions
public function onFeedItemRenderDisableActions(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array('link'))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例15: onFeedItemRenderDisableActions
public function onFeedItemRenderDisableActions(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array(GROUPS_BOL_Service::FEED_ENTITY_TYPE, "groups-join", "groups-status"))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}