예제 #1
0
 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
0
 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);
 }
 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
0
 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
0
 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);
 }
 public function onAfterGetUSEARCH_CMP_QuickSearchInstance(OW_Event $event)
 {
     $params = $event->getParams();
     if (!empty($params['className'])) {
         $event->setData(new FEMALEREGONLYMEN_CMP_QuickSearch());
     }
 }
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
파일: init.php 프로젝트: vazahat/dudex
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
0
 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
0
 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);
 }
예제 #16
0
 public function onFeedItemRenderDisableActions(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["action"]["entityType"] != "ocsfundraising_project") {
         return;
     }
     $data = $event->getData();
     $data["disabled"] = true;
     $event->setData($data);
 }
예제 #17
0
 public function onGetClassInstance(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params['className'] != 'BASE_MCMP_ProfileHeader') {
         return;
     }
     $arguments = $params['arguments'];
     $cmp = new UHEADER_MCMP_ProfileHeader($arguments[0]);
     $event->setData($cmp);
     return $cmp;
 }
예제 #18
0
 public function isNotificationPermited(OW_Event $event)
 {
     $params = $event->getParams();
     if (!isset($params['userId'], $params['action'])) {
         return;
     }
     $userId = (int) $params['userId'];
     $action = $params['action'];
     $event->setData($this->service->isNotificationPermited($userId, $action));
     return $event->getData();
 }
예제 #19
0
 public function getConfiguration(OW_Event $event)
 {
     $service = FBCONNECT_BOL_Service::getInstance();
     $appId = $service->getFaceBookAccessDetails()->appId;
     if (empty($appId)) {
         return null;
     }
     $data = array("appId" => $appId);
     $event->setData($data);
     return $data;
 }
예제 #20
0
 public function getActionKey(OW_Event $e)
 {
     $params = $e->getParams();
     $authAction = $params['actionName'];
     if ($params['groupName'] != 'photo') {
         return;
     }
     if (!empty($this->authActions[$authAction])) {
         $e->setData($this->authActions[$authAction]);
     }
 }
예제 #21
0
 public function buttonRender(OW_Event $event)
 {
     $params = $event->getParams();
     $key = $params['provider'];
     if (empty($this->providers[$key])) {
         return;
     }
     /* @var $provider CONTACTIMPORTER_CLASS_Provider */
     $provider = $this->providers[$key];
     $data = $provider->prepareButton($params);
     $event->setData($data);
 }
예제 #22
0
 public function onMobileNotificationsRender(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params['entityType'] == 'friends-accept') {
         $data = $params['data'];
         if (isset($data['avatar']['urlInfo'])) {
             $url = OW::getRouter()->urlForRoute($data['avatar']['urlInfo']['routeName'], $data['avatar']['urlInfo']['vars']);
             $displayName = $data['avatar']['title'];
             $data['string']['vars']['receiver'] = '<a href="' . $url . '">' . $displayName . '</a>';
             $event->setData($data);
         }
     }
 }
예제 #23
0
function pcgallery_class_get_instance(OW_Event $event)
{
    $params = $event->getParams();
    if ($params['className'] != 'BASE_CMP_ProfileActionToolbar') {
        return;
    }
    if (!PCGALLERY_CLASS_PhotoBridge::getInstance()->isActive()) {
        return;
    }
    $arguments = $params['arguments'];
    $cmp = new PCGALLERY_CMP_ProfileActionToolbarMock($arguments[0]);
    $event->setData($cmp);
    return $cmp;
}
예제 #24
0
 public function onInfoRender(OW_Event $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     if ($params["key"] != "video-count") {
         return;
     }
     $count = VIDEO_BOL_ClipService::getInstance()->findUserClipsCount($userId);
     $url = OW::getRouter()->urlForRoute("video_user_video_list", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $event->setData($language->text("hint", "info_vide_count", array("count" => $count, "url" => $url)));
 }
예제 #25
0
 public function feedOnProjectAdd(OW_Event $e)
 {
     $params = $e->getParams();
     if ($params['entityType'] != 'ocsfundraising_project') {
         return;
     }
     $service = OCSFUNDRAISING_BOL_Service::getInstance();
     $project = $service->getGoalById($params['entityId']);
     if (!$project) {
         return;
     }
     $content = array("format" => "image_content", "vars" => array("image" => $project['dto']->image ? $service->generateImageUrl($project['dto']->image, false) : null, "thumbnail" => $project['dto']->image ? $service->generateImageUrl($project['dto']->image) : null, "title" => UTIL_String::truncate(strip_tags($project['dto']->name), 100, '...'), "description" => UTIL_String::truncate(strip_tags($project['dto']->description), 150, '...'), "url" => array("routeName" => "ocsfundraising.project", "vars" => array('id' => $project['dto']->id)), "iconClass" => "ow_ic_folder"));
     $data = array('time' => (int) $project['dto']->startStamp, 'ownerId' => $project['dto']->ownerId, 'string' => array('key' => 'ocsfundraising+feed_add_project_label'), 'content' => $content, 'view' => array('iconClass' => 'ow_ic_folder'));
     $e->setData($data);
 }
예제 #26
0
 public function onInfoRender(OW_Event $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     if ($params["key"] != "photo-count") {
         return;
     }
     $count = PHOTO_BOL_PhotoService::getInstance()->countUserPhotos($userId);
     $url = OW::getRouter()->urlForRoute("photo_user_albums", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $event->setData($language->text("hint", "info_photo_count", array("count" => $count, "url" => $url)));
 }
예제 #27
0
 public function getActionKey(OW_Event $e)
 {
     $params = $e->getParams();
     if ($params['groupName'] == 'virtualgifts' && $params['actionName'] == 'send_gift') {
         if (empty($params['extra']['tplId'])) {
             $tpl = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance()->findMinPriceTemplate();
             if (!$tpl) {
                 return;
             }
             $tplId = $tpl->id;
         } else {
             $tplId = $params['extra']['tplId'];
         }
         $e->setData('template_' . $tplId);
     }
 }
예제 #28
0
 public function onInviteRender(OW_Event $event)
 {
     $params = $event->getParams();
     if (!in_array($params['entityType'], array('questions-answer', 'questions-post'))) {
         return;
     }
     EQUESTIONS_Plugin::getInstance()->addStatic(true);
     $data = $params['data'];
     $questionSettings = $data['questionSettings'];
     $uniqId = $data['uniqId'];
     $data['url'] = 'javascript:(function() { QUESTIONS.openQuestion({
         questionId: ' . $questionSettings['questionId'] . ',
         relationId: ' . $questionSettings['relationId'] . ',
         userContext: ' . json_encode($questionSettings['userContext']) . '
     }); return void(0); })()';
     $event->setData($data);
     $js = UTIL_JsGenerator::newInstance();
     $js->jQueryEvent("." . $uniqId, 'click', 'QUESTIONS.openQuestion(e.data.questionSettings); return false;', array('e'), array('questionSettings' => $questionSettings));
     OW::getDocument()->addOnloadScript($js->generateJs());
 }
예제 #29
0
 public function onGetInfo(OW_Event $event)
 {
     $params = $event->getParams();
     $data = null;
     switch ($params["entityType"]) {
         case self::ENTITY_TYPE_PROFILE:
             $data = $this->getProfileInfo($params["entityIds"]);
             break;
         case self::ENTITY_TYPE_COMMENT:
             $data = $this->getCommentInfo($params["entityIds"]);
             break;
         case self::ENTITY_TYPE_AVATAR:
             $data = $this->getAvatarInfo($params["entityIds"]);
             break;
         default:
             return;
     }
     $event->setData($data);
     return $data;
 }
예제 #30
0
 public function onBeforeQuestionAdd(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     if (empty($params['settings']['context']['type']) || $params['settings']['context']['type'] != 'groups') {
         return;
     }
     if (!$this->isActive()) {
         return;
     }
     $context = $params['settings']['context'];
     $service = GROUPS_BOL_Service::getInstance();
     $groupId = (int) $context['id'];
     $group = $service->findGroupById($groupId);
     $url = $service->getGroupUrl($group);
     $title = UTIL_String::truncate(strip_tags($group->title), 100, '...');
     $context['label'] = $title;
     $context['url'] = $url;
     $data['settings']['context'] = $context;
     $data['privacy'] = 'groups';
     $event->setData($data);
 }