예제 #1
0
파일: init.php 프로젝트: vazahat/dudex
function socialsharing_get_sharing_buttons(BASE_CLASS_EventCollector $event)
{
    $params = $event->getParams();
    $entityId = !empty($params['entityId']) ? $params['entityId'] : null;
    $entityType = !empty($params['entityType']) ? $params['entityType'] : null;
    if (!empty($entityId) && !empty($entityType)) {
        $sharingInfoEvent = new OW_Event('socialsharing.get_entity_info', $params, $params);
        OW::getEventManager()->trigger($sharingInfoEvent);
        $data = $sharingInfoEvent->getData();
        $params = array_merge($params, $data);
    }
    $display = isset($params['display']) ? $params['display'] : true;
    if (!$display) {
        return;
    }
    $url = !empty($params['url']) ? $params['url'] : null;
    $description = !empty($params['description']) ? $params['description'] : OW::getDocument()->getDescription();
    $title = !empty($params['title']) ? $params['title'] : OW::getDocument()->getTitle();
    $image = !empty($params['image']) ? $params['image'] : null;
    $class = !empty($params['class']) ? $params['class'] : null;
    $displayBlock = false;
    //isset($params['displayBlock']) ? $params['displayBlock'] : true;
    $cmp = new SOCIALSHARING_CMP_ShareButtons();
    $cmp->setCustomUrl($url);
    $cmp->setDescription($description);
    $cmp->setTitle($title);
    $cmp->setImageUrl($image);
    $cmp->setDisplayBlock($displayBlock);
    if (!empty($class)) {
        $cmp->setBoxClass($class);
    }
    $event->add($cmp->render());
}
 public function __construct(BASE_CLASS_WidgetParameter $paramsObj)
 {
     if (!OW::getConfig()->getValue('socialsharing', 'api_key') || OW::getConfig()->getValue('base', 'guests_can_view') != 1 || OW::getConfig()->getValue('base', 'maintenance')) {
         $this->setVisible(false);
         return;
     }
     $cmp = new SOCIALSHARING_CMP_ShareButtons();
     $cmp->setTitle(OW::getConfig()->getValue('base', 'site_name'));
     $cmp->setDescription(OW::getConfig()->getValue('base', 'site_description'));
     $cmp->setBoxClass('ow_social_sharing_widget');
     $cmp->setDisplayBlock(false);
     $this->addComponent('buttons', $cmp);
 }
 public function __construct(BASE_CLASS_WidgetParameter $paramsObj)
 {
     if (!OW::getConfig()->getValue('socialsharing', 'api_key')) {
         $this->setVisible(false);
         return;
     }
     $userId = $paramsObj->additionalParamList['entityId'];
     $user = BOL_UserService::getInstance()->findUserById($userId);
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     $title = BOL_UserService::getInstance()->getDisplayName($userId);
     $cmp = new SOCIALSHARING_CMP_ShareButtons();
     $cmp->setTitle($title);
     $cmp->setDescription(OW::getConfig()->getValue('base', 'site_description'));
     $cmp->setBoxClass('ow_social_sharing_widget');
     $cmp->setDisplayBlock(false);
     $cmp->setImageUrl($avatarUrl);
     $this->addComponent('buttons', $cmp);
     $this->setTemplate(OW::getPluginManager()->getPlugin('socialsharing')->getCmpViewDir() . 'index_share_buttons_widget.html');
 }