public static function email($article, $params, $attribs = array()) { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $template = JFactory::getApplication()->getTemplate(); $link = TZ_Portfolio_PlusHelperRoute::getArticleRoute($article->slug, $article->catid); $link = $base . JRoute::_($link, false); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; if ($params->get('show_cat_icons', 1)) { $icon = 'icon-envelope'; if (count($attribs) && isset($attribs['icon'])) { $icon = $attribs['icon']; unset($attribs['icon']); } $text = '<i class="' . $icon . '"></i> ' . JText::_('JGLOBAL_EMAIL'); } else { $text = JText::_('JGLOBAL_EMAIL'); } $attribs['title'] = JText::_('JGLOBAL_EMAIL'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; }
public static function sendToFriendIcon($imageSrc, $link) { JLoader::register("MailToHelper", JPATH_SITE . '/components/com_mailto/helpers/mailto.php'); $link = rawurldecode($link); $template = JFactory::getApplication()->getTemplate(); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; $attribs = array('title' => JText::_('JGLOBAL_EMAIL'), 'onclick' => "window.open(this.href,'win2','" . $status . "'); return false;"); $text = '<img src="' . $imageSrc . '" alt="' . JText::_('MOD_MVSOCIALBUTTONS_SHARE_WITH_FRIENDS') . '" title="' . JText::_('MOD_MVSOCIALBUTTONS_SHARE_WITH_FRIENDS') . '" />'; $output = JHtml::_('link', $url, $text, $attribs); return $output; }
static function email($contact, $params, $attribs = array()) { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false); $url = 'index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; if ($params->get('show_icons')) { $text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), NULL, true); } else { $text = ' ' . JText::_('JGLOBAL_EMAIL'); } $attribs['title'] = JText::_('JGLOBAL_EMAIL'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; }
/** * Method to generate a link to the email item page for the given request's diet * * @param object $request The request information * @param JRegistry $params The item parameters * @param array $attribs Optional attributes for the link * * @return string The HTML markup for the email item link */ public static function email($request, $attribs = array()) { if ($request->secretkey) { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $uri = JUri::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $template = JFactory::getApplication()->getTemplate(); $link = $base . JRoute::_(SibdietHelperRoute::getRequestRoute($request->id, $request->secretkey), false); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; $text = '<i class="icon-envelope"></i>'; $attribs['class'] = 'email btn hasTooltip'; $attribs['title'] = JText::_('JGLOBAL_EMAIL'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; } }
static function email($article, $params, $attribs = array()) { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $template = JFactory::getApplication()->getTemplate(); $link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; if ($params->get('show_icons')) { //$text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), NULL, true); $text = '<span class="icon-envelope icon-white"></span>'; } else { $text = ' ' . JText::_('JGLOBAL_EMAIL'); } $attribs['title'] = JText::_('JGLOBAL_EMAIL'); $attribs['data-rel'] = 'tooltip'; $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; }
static function email($article, $params, $attribs = array()) { require_once PATH_CORE . '/components/com_mailto/site/helpers/mailto.php'; $base = JURI::getInstance()->toString(array('scheme', 'host', 'port')); $template = App::get('template')->template; $link = $base . Route::url(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language), false); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; /*if ($params->get('show_icons')) { $text = Html::asset('image', 'emailButton.png', Lang::txt('JGLOBAL_EMAIL'), NULL, true); } else { $text = ' '.Lang::txt('JGLOBAL_EMAIL'); }*/ $attribs['title'] = Lang::txt('JGLOBAL_EMAIL'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = '<a href="' . Route::url($url) . '" ' . \Hubzero\Utility\Arr::toString($attribs) . '>' . Lang::txt('JGLOBAL_EMAIL') . '</a>'; return $output; }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $document =& JFactory::getDocument(); $params =& K2HelperUtilities::getParams('com_k2'); $limitstart = JRequest::getInt('limitstart', 0); $view = JRequest::getWord('view'); $task = JRequest::getWord('task'); $db =& JFactory::getDBO(); $jnow =& JFactory::getDate(); $now = $jnow->toMySQL(); $nullDate = $db->getNullDate(); $this->setLayout('item'); // Add link if (K2HelperPermissions::canAddItem()) { $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); } $this->assignRef('addLink', $addLink); // Get item $model =& $this->getModel(); $item = $model->getData(); // Does the item exists? if (!is_object($item) || !$item->id) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Prepare item $item = $model->prepareItem($item, $view, $task); // Plugins $item = $model->execPlugins($item, $view, $task); // User K2 plugins $item->event->K2UserDisplay = ''; if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) { $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart)); $item->event->K2UserDisplay = trim(implode("\n", $results)); } // Access check if ($this->getLayout() == 'form') { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } if (K2_JVERSION == '16') { if (!in_array($item->access, $user->authorisedLevels()) || !in_array($item->category->access, $user->authorisedLevels())) { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } } else { if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } } // Published check if (!$item->published || $item->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_up != $nullDate && $item->publish_up > $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_down != $nullDate && $item->publish_down < $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if (!$item->category->published || $item->category->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Increase hits counter $model->hit($item->id); // Set default image K2HelperUtilities::setDefaultImage($item, $view); // Comments $item->event->K2CommentsCounter = ''; $item->event->K2CommentsBlock = ''; if ($item->params->get('itemComments')) { // Trigger comments events $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart)); $item->event->K2CommentsCounter = trim(implode("\n", $results)); $results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart)); $item->event->K2CommentsBlock = trim(implode("\n", $results)); // Load K2 native comments system only if there are no plugins overriding it if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) { // Load reCAPTCHA script if (!JRequest::getInt('print') && ($item->params->get('comments') == '1' || $item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($item->catid))) { if ($item->params->get('recaptcha') && $user->guest) { $document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js'); $js = ' function showRecaptcha(){ Recaptcha.create("' . $item->params->get('recaptcha_public_key') . '", "recaptcha", { theme: "' . $item->params->get('recaptcha_theme', 'clean') . '" }); } $K2(window).load(function() { showRecaptcha(); }); '; $document->addScriptDeclaration($js); } } // Check for inline comment moderation if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration')) { $inlineCommentsModeration = true; $commentsPublished = false; } else { $inlineCommentsModeration = false; $commentsPublished = true; } $this->assignRef('inlineCommentsModeration', $inlineCommentsModeration); // Flag spammer link $reportSpammerFlag = false; if (K2_JVERSION == '16') { if ($user->authorise('core.admin', 'com_k2')) { $reportSpammerFlag = true; $document =& JFactory::getDocument(); $document->addScriptDeclaration('var K2Language = ["' . JText::_('K2_REPORT_USER_WARNING', true) . '"];'); } } else { if ($user->gid > 24) { $reportSpammerFlag = true; } } $limit = $params->get('commentsLimit'); $comments = $model->getItemComments($item->id, $limitstart, $limit, $commentsPublished); $pattern = "@\\b(https?://)?(([0-9a-zA-Z_!~*'().&=+\$%-]+:)?[0-9a-zA-Z_!~*'().&=+\$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+\$,%#-]+)*/?)@"; for ($i = 0; $i < sizeof($comments); $i++) { $comments[$i]->commentText = nl2br($comments[$i]->commentText); $comments[$i]->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\\0">\\0</a>', $comments[$i]->commentText); $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth')); if ($comments[$i]->userID > 0) { $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID); } else { $comments[$i]->userLink = $comments[$i]->commentURL; } if ($reportSpammerFlag && $comments[$i]->userID > 0) { $comments[$i]->reportUserLink = JRoute::_('index.php?option=com_k2&view=comments&task=reportSpammer&id=' . $comments[$i]->userID . '&format=raw'); } else { $comments[$i]->reportUserLink = false; } } $item->comments = $comments; jimport('joomla.html.pagination'); $total = $item->numOfComments; $pagination = new JPagination($total, $limitstart, $limit); } } // Author's latest items if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') { $model =& $this->getModel('itemlist'); $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by); if (count($authorLatestItems)) { for ($i = 0; $i < sizeof($authorLatestItems); $i++) { $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id . ':' . urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid . ':' . urlencode($authorLatestItems[$i]->categoryalias)))); } $this->assignRef('authorLatestItems', $authorLatestItems); } } // Related items if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) { $model =& $this->getModel('itemlist'); $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params); if (count($relatedItems)) { for ($i = 0; $i < sizeof($relatedItems); $i++) { $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id . ':' . urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid . ':' . urlencode($relatedItems[$i]->categoryalias)))); } $this->assignRef('relatedItems', $relatedItems); } } // Navigation (previous and next item) if ($item->params->get('itemNavigation')) { $model =& $this->getModel('item'); $nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering); if (!is_null($nextItem)) { $item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id . ':' . urlencode($nextItem->alias), $nextItem->catid . ':' . urlencode($item->category->alias)))); $item->nextTitle = $nextItem->title; } $previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering); if (!is_null($previousItem)) { $item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id . ':' . urlencode($previousItem->alias), $previousItem->catid . ':' . urlencode($item->category->alias)))); $item->previousTitle = $previousItem->title; } } // Absolute URL $uri =& JURI::getInstance(); $item->absoluteURL = $uri->toString(); // Email link if (K2_JVERSION == '16') { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $template = $mainframe->getTemplate(); $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($item->absoluteURL)); } else { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($item->absoluteURL)); } // Twitter link (legacy code) if ($params->get('twitterUsername')) { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL) . '&via=' . $params->get('twitterUsername'); } else { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL); } // Social link $item->socialLink = urlencode($item->absoluteURL); // Set page title $menus =& JSite::getMenu(); $menu = $menus->getActive(); if (is_object($menu) && isset($menu->query['view']) && $menu->query['view'] == 'item' && isset($menu->query['id']) && $menu->query['id'] == $item->id) { $menu_params = new JParameter($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', $item->cleanTitle); } } else { $params->set('page_title', $item->cleanTitle); } if (K2_JVERSION == '16') { if ($mainframe->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title')); $params->set('page_title', $title); } elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename')); $params->set('page_title', $title); } } $document->setTitle($params->get('page_title')); // Set pathway $menus =& JSite::getMenu(); $menu = $menus->getActive(); $pathway =& $mainframe->getPathWay(); if ($menu) { if ($menu->query['view'] != 'item' || $menu->query['id'] != $item->id) { if (!isset($menu->query['task']) || $menu->query['task'] != 'category' || $menu->query['id'] != $item->catid) { $pathway->addItem($item->category->name, $item->category->link); } $pathway->addItem($item->cleanTitle, ''); } } // Set metadata if ($item->metadesc) { $document->setDescription($item->metadesc); } else { $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext . ' ' . $item->fulltext); $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150)); $metaDescItem = htmlentities($metaDescItem, ENT_QUOTES, 'utf-8'); $document->setDescription($metaDescItem); } if ($item->metakey) { $document->setMetadata('keywords', $item->metakey); } else { if (isset($item->tags) && count($item->tags)) { $tmp = array(); foreach ($item->tags as $tag) { $tmp[] = $tag->name; } $document->setMetadata('keywords', implode(',', $tmp)); } } // Menu metadata for Joomla! 1.6/1.7 (Overrides the current metadata if set) if (K2_JVERSION == '16') { if ($params->get('menu-meta_description')) { $document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $document->setMetadata('robots', $params->get('robots')); } // Menu page display options if ($params->get('page_heading')) { $params->set('page_title', $params->get('page_heading')); } $params->set('show_page_title', $params->get('show_page_heading')); } if ($mainframe->getCfg('MetaTitle') == '1') { $document->setMetadata('title', $item->title); } if ($mainframe->getCfg('MetaAuthor') == '1' && isset($item->author->name)) { $document->setMetadata('author', $item->author->name); } $mdata = new JParameter($item->metadata); $mdata = $mdata->toArray(); foreach ($mdata as $k => $v) { if ($k == 'robots' || $k == 'author') { if ($v) { $document->setMetadata($k, $v); } } } // Load Facebook meta tag for item image $facebookImage = 'image' . $params->get('facebookImage', 'Small'); if ($item->{$facebookImage}) { $document->setMetaData('image', substr(JURI::root(), 0, -1) . str_replace(JURI::root(true), '', $item->{$facebookImage})); } // Look for template files in component folders $this->_addPath('template', JPATH_COMPONENT . DS . 'templates'); $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (K2 template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (Joomla! template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'default'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2'); // Look for specific K2 theme files if ($item->params->get('theme')) { $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . $item->params->get('theme')); } // Assign data $this->assignRef('item', $item); $this->assignRef('user', $user); $this->assignRef('params', $item->params); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * Creates the email button * * @param string $print_link * @param array $params * @since 1.0 */ static function mailbutton($view, &$params, $slug = null, $itemslug = null, $item = null) { static $initialize = null; static $uri, $base; if (!$params->get('show_email_icon') || JRequest::getCmd('print')) { return; } if ($initialize === null) { if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php')) { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $initialize = true; } else { $initialize = false; } } if ($initialize === false) { return; } //TODO: clean this static stuff (Probs when determining the url directly with subdomains) if ($view == 'category') { $non_sef_link = null; flexicontent_html::createCatLink($slug, $non_sef_link); $link = $base . JRoute::_($non_sef_link); //$link = $base . JRoute::_( 'index.php?view='.$view.'&cid='.$slug, false ); } elseif ($view == FLEXI_ITEMVIEW) { $link = $base . JRoute::_(FlexicontentHelperRoute::getItemRoute($itemslug, $slug, 0, $item)); //$link = $base . JRoute::_( 'index.php?view='.$view.'&cid='.$slug.'&id='.$itemslug, false ); } elseif ($view == 'tags') { $link = $base . JRoute::_(FlexicontentHelperRoute::getTagRoute($itemslug)); //$link = $base . JRoute::_( 'index.php?view='.$view.'&id='.$slug, false ); } else { $link = $base . JRoute::_('index.php?view=' . $view, false); } $mail_to_url = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link)); $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,left=50,width=\'+(screen.width-100)+\',top=20,height=\'+(screen.height-160)+\',directories=no,location=no'; $status = 'left=50,width=\'+((screen.width-100) > 800 ? 800 : (screen.width-100))+\',top=20,height=\'+((screen.width-160) > 800 ? 800 : (screen.width-160))+\',menubar=yes,resizable=yes'; $onclick = ' window.open(this.href,\'win2\',\'' . $status . '\'); return false; '; // This checks template image directory for image, if none found, default image is returned $show_icons = $params->get('show_icons'); if ($show_icons) { $attribs = ''; $image = JHTML::image(FLEXI_ICONPATH . 'emailButton.png', JText::_('FLEXI_EMAIL'), $attribs); } else { $image = ''; } $overlib = JText::_('FLEXI_EMAIL_TIP'); $text = JText::_('FLEXI_EMAIL'); $button_classes = 'fc_mailbutton'; if ($show_icons == 1) { $caption = ''; $button_classes .= ''; } else { $caption = $text; $button_classes .= FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall'; } $button_classes .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $tooltip_title = flexicontent_html::getToolTip($text, $overlib, 0); // emailed link was set above $output = '<a href="' . $mail_to_url . '" class="' . $button_classes . '" title="' . $tooltip_title . '" onclick="' . $onclick . '" >' . $image . $caption . '</a>'; $output = JText::_('FLEXI_ICON_SEP') . $output . JText::_('FLEXI_ICON_SEP'); return $output; }
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display') { if (!in_array($field->field_type, self::$field_types)) { return; } $view = JRequest::getString('view', FLEXI_ITEMVIEW); //if ($view != FLEXI_ITEMVIEW) return; if (JRequest::getCmd('print')) { return; } global $mainframe, $addthis; //$scheme = JURI::getInstance()->getScheme(); // we replaced http(s):// with // $document = JFactory::getDocument(); $lang = $document->getLanguage(); $lang = $item->params->get('language', $lang); $lang = $lang ? $lang : 'en-GB'; $lang = substr($lang, 0, 2); $lang = in_array($lang, array('en', 'es', 'it', 'th')) ? $lang : 'en'; // parameters shortcuts $display_comments = $field->parameters->get('display_comments', 1) && $item->parameters->get('comments', 0); $display_resizer = $field->parameters->get('display_resizer', 1); $display_print = $field->parameters->get('display_print', 1); $display_email = $field->parameters->get('display_email', 1); $display_voice = $field->parameters->get('display_voice', 1); $display_pdf = 0; //$field->parameters->get('display_pdf', 1); $load_css = $field->parameters->get('load_css', 1); $display_social = $field->parameters->get('display_social', 1); $addthis_user = $field->parameters->get('addthis_user', ''); $addthis_pubid = $field->parameters->get('addthis_pubid', $addthis_user); $spacer_size = $field->parameters->get('spacer_size', 21); $module_position = $field->parameters->get('module_position', ''); $default_size = $field->parameters->get('default_size', 12); $default_line = $field->parameters->get('default_line', 16); $target = $field->parameters->get('target', 'flexicontent'); $voicetarget = $field->parameters->get('voicetarget', 'flexicontent'); $spacer = ' style="width:' . $spacer_size . 'px;"'; // define a global variable to be sure the script is loaded only once $addthis = isset($addthis) ? $addthis : 0; if ($load_css) { $document->addStyleSheet(JURI::root(true) . '/plugins/flexicontent_fields/toolbar/toolbar/toolbar.css'); } if ($display_social || $display_comments || $display_email || $display_print) { $item_url = FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug); $server = JURI::getInstance()->toString(array('scheme', 'host', 'port')); $item_link = $server . JRoute::_($item_url); // NOTE: this uses current SSL setting (e.g menu item), and not URL scheme: http/https //$item_link = JRoute::_($item_url, true, -1); } $display = '<div class="flexitoolbar">'; // begin of the toolbar container // comments button if ($display_comments) { $comment_link = $item_link . '#addcomments'; $display .= ' <div class="flexi-react toolbar-element"> <span class="comments-bubble">' . ($module_position ? '<!-- jot ' . $module_position . ' s -->' : '') . $this->_getCommentsCount($item->id) . ($module_position ? '<!-- jot ' . $module_position . ' e -->' : '') . '</span> <span class="comments-legend flexi-legend"><a href="' . $comment_link . '" title="' . JText::_('FLEXI_FIELD_TOOLBAR_COMMENT') . '">' . JText::_('FLEXI_FIELD_TOOLBAR_COMMENT') . '</a></span> </div> <div class="toolbar-spacer"' . $spacer . '></div> '; } // text resizer if ($display_resizer) { $document->addScriptDeclaration('var textsize = ' . $default_size . '; var lineheight = ' . $default_line . '; function fsize(size,line,unit,id){ var vfontsize = document.getElementById(id); if(vfontsize){ vfontsize.style.fontSize = size + unit; vfontsize.style.lineHeight = line + unit; } } function changetextsize(up){ if(up){ textsize = parseFloat(textsize)+2; lineheight = parseFloat(lineheight)+2; }else{ textsize = parseFloat(textsize)-2; lineheight = parseFloat(lineheight)-2; } }'); $display .= ' <div class="flexi-resizer toolbar-element"> <a class="decrease" href="javascript:fsize(textsize,lineheight,\'px\',\'' . $target . '\');" onclick="changetextsize(0);">' . JText::_("FLEXI_FIELD_TOOLBAR_DECREASE") . '</a> <a class="increase" href="javascript:fsize(textsize,lineheight,\'px\',\'' . $target . '\');" onclick="changetextsize(1);">' . JText::_("FLEXI_FIELD_TOOLBAR_INCREASE") . '</a> <span class="flexi-legend">' . JText::_("FLEXI_FIELD_TOOLBAR_SIZE") . '</span> </div> <div class="toolbar-spacer"' . $spacer . '></div> '; } // email button if ($display_email) { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $url = 'index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($item_link); $estatus = 'width=400,height=400,menubar=yes,resizable=yes'; $display .= ' <div class="flexi-email toolbar-element"> <span class="email-legend flexi-legend"><a rel="nofollow" href="' . JRoute::_($url) . '" onclick="window.open(this.href,\'win2\',\'' . $estatus . '\'); return false;" title="' . JText::_('FLEXI_FIELD_TOOLBAR_SEND') . '">' . JText::_('FLEXI_FIELD_TOOLBAR_SEND') . '</a></span> </div> <div class="toolbar-spacer"' . $spacer . '></div> '; } // print button if ($display_print) { $pop = JRequest::getInt('pop'); $pstatus = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; $print_link = $pop ? '#' : $item_link . (strstr($item_link, '?') ? '&' : '?') . 'pop=1&print=1&tmpl=component'; $js_link = $pop ? 'onclick="window.print();return false;"' : 'onclick="window.open(this.href,\'win2\',\'' . $pstatus . '\'); return false;"'; $display .= ' <div class="flexi-print toolbar-element"> <span class="print-legend flexi-legend"><a rel="nofollow" href="' . $print_link . '" ' . $js_link . ' title="' . JText::_('FLEXI_FIELD_TOOLBAR_PRINT') . '">' . JText::_('FLEXI_FIELD_TOOLBAR_PRINT') . '</a></span> </div> <div class="toolbar-spacer"' . $spacer . '></div> '; } // pdf button if ($display_voice) { $display .= "\n\t\t\t<div class=\"flexi-voice toolbar-element\">"; if ($lang == 'th') { // Special case language case, maybe la=laos, and Bhutan languages in the future (NECTEC support these languages) $document->addScript(JURI::root(true) . '/plugins/flexicontent_fields/toolbar/toolbar/th.js'); $display .= "\n\t\t\t\t\t<span class=\"voice-legend flexi-legend\"><a href=\"javascript:void(0);\" onclick=\"openwindow('" . $voicetarget . "','" . $lang . "');\" class=\"mainlevel-toolbar-article-horizontal\" rel=\"nofollow\">" . JTEXT::_('FLEXI_FIELD_TOOLBAR_VOICE') . "</a></span>\n\t\t\t\t\t"; } else { $document->addScript('//vozme.com/get_text.js'); $display .= "\n\t\t\t\t\t<span class=\"voice-legend flexi-legend\"><a href=\"javascript:void(0);\" onclick=\"get_id('" . $voicetarget . "','" . $lang . "','fm');\" class=\"mainlevel-toolbar-article-horizontal\" rel=\"nofollow\">" . JTEXT::_('FLEXI_FIELD_TOOLBAR_VOICE') . "</a></span>\n\t\t\t\t\t"; } $display .= "\n\t\t\t</div>\n\t\t\t<div class=\"toolbar-spacer\"" . $spacer . "></div>\n\t\t\t\t"; } // pdf button if ($display_pdf) { $pdflink = 'index.php?view=items&cid=' . $item->categoryslug . '&id=' . $item->slug . '&format=pdf'; $display .= ' <div class="flexi-pdf toolbar-element"> <span class="pdf-legend flexi-legend"><a href="' . JRoute::_($pdflink) . '" title="' . JText::_('FLEXI_FIELD_TOOLBAR_PDF') . '">' . JText::_('FLEXI_FIELD_TOOLBAR_PDF') . '</a></span> </div> <div class="toolbar-spacer"' . $spacer . '></div> '; } // AddThis social SHARE buttons, also optionally add OPEN GRAPH TAGs if ($display_social) { // *************** // OPEN GRAPH TAGs // *************** // OPEN GRAPH: site name if ($field->parameters->get('add_og_site_name')) { $document->addCustomTag("<meta property=\"og:site_name\" content=\"" . JFactory::getApplication()->getCfg('sitename') . "\" />"); } // OPEN GRAPH: title if ($field->parameters->get('add_og_title')) { $title = flexicontent_html::striptagsandcut($item->title); $document->addCustomTag("<meta property=\"og:title\" content=\"{$title}\" />"); } // OPEN GRAPH: description if ($field->parameters->get('add_og_descr')) { if ($item->metadesc) { $document->addCustomTag('<meta property="og:description" content="' . $item->metadesc . '" />'); } else { $text = flexicontent_html::striptagsandcut($item->text); $document->addCustomTag("<meta property=\"og:description\" content=\"{$text}\" />"); } } // OPEN GRAPH: type $og_type = (int) $field->parameters->get('add_og_type'); if ($og_type) { if ($og_type > 2) { $og_type = 1; } $og_type_names = array(1 => 'article', 2 => 'website'); $document->addCustomTag("<meta property=\"og:type\" content=\"" . $og_type_names[$og_type] . "\">"); } // OPEN GRAPH: image (extracted from item's description text) if ($field->parameters->get('add_og_image')) { $og_image_field = $field->parameters->get('og_image_field'); $og_image_fallback = $field->parameters->get('og_image_fallback'); $og_image_thumbsize = $field->parameters->get('og_image_thumbsize'); if ($og_image_field) { $imageurl = FlexicontentFields::getFieldDisplay($item, $og_image_field, null, 'display_' . $og_image_thumbsize . '_src', 'module'); if ($imageurl) { $img_field = $item->fields[$og_image_field]; if (!$imageurl && $og_image_fallback == 1 || $imageurl && $og_image_fallback == 2 && $img_field->using_default_value) { $imageurl = $this->_extractimageurl($item); } } } else { $imageurl = $this->_extractimageurl($item); } // Add image if fould, making sure it is converted to ABSOLUTE URL if ($imageurl) { $is_absolute = (bool) parse_url($imageurl, PHP_URL_SCHEME); // preg_match("#^http|^https|^ftp#i", $imageurl); $imageurl = $is_absolute ? $imageurl : JURI::root() . $imageurl; $document->addCustomTag("<meta property=\"og:image\" content=\"{$imageurl}\" />"); } } // Add og-URL explicitely as this is required by facebook ? if ($item_link) { $document->addCustomTag("<meta property=\"og:url\" content=\"" . $item_link . "\" />"); } // **************************** // AddThis social SHARE buttons // **************************** $addthis_outside_toolbar = $field->parameters->get('addthis_outside_toolbar', 0); $addthis_custom_code = $field->parameters->get('addthis_custom_code', false); $addthis_custom_predefined = $field->parameters->get('addthis_custom_predefined', false); $addthis_code = ''; if ($addthis_custom_code) { $addthis_code = str_replace('_item_url_', $item_link, $addthis_custom_code); $addthis_code = str_replace('_item_title_', htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'), $addthis_code); } else { switch ($addthis_custom_predefined) { case 1: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style addthis_counter_style" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_button_pinterest_pinit"></a> <a class="addthis_counter addthis_pill_style"></a> </div> <!-- AddThis Button END --> '; break; case 2: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> <a class="addthis_counter addthis_bubble_style"></a> </div> <!-- AddThis Button END --> '; break; default: case 3: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style addthis_16x16_style" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> <a class="addthis_counter addthis_bubble_style"></a> </div> <!-- AddThis Button END --> '; break; case 4: $addthis_code .= ' <!-- AddThis Button BEGIN --> <a class="addthis_button" href="//www.addthis.com/bookmark.php?v=300&pubid=' . $addthis_pubid . '"><img src="//s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="' . JText::_('FLEXI_FIELD_TOOLBAR_SHARE') . '" style="border:0"/></a> <!-- AddThis Button END --> '; break; case 5: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_floating_style addthis_counter_style" style="left:50px;top:50px;" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_facebook_like" fb:like:layout="box_count"></a> <a class="addthis_button_tweet" tw:count="vertical"></a> <a class="addthis_button_google_plusone" g:plusone:size="tall"></a> <a class="addthis_counter"></a> </div> <!-- AddThis Button END --> '; break; case 6: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_floating_style addthis_32x32_style" style="left:50px;top:50px;" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> </div> <!-- AddThis Button END --> '; break; case 7: $addthis_code .= ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_floating_style addthis_16x16_style" style="left:50px;top:50px;" addthis:url="' . $item_link . '" addthis:title="' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> </div> <!-- AddThis Button END --> '; break; } } if ($addthis_outside_toolbar) { $display .= '<div class="flexi-socials-outside">' . $addthis_code . '</div>'; } else { $display .= '<div class="flexi-socials toolbar-element">' . $addthis_code . '</div>'; } if (!$addthis) { $document->addCustomTag(' <script type="text/javascript"> var addthis_config = { services_exclude: "print,email" } </script> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js' . ($addthis_pubid ? '#pubid=' . $addthis_pubid : '') . '"></script> '); $addthis = 1; } } $display .= '</div>'; // end of the toolbar container $field->{$prop} = $display; }
function DefaultViewHelperHeader16($view) { $dispatcher =& JDispatcher::getInstance(); $dispatcher->trigger('onJEventsHeader', array($view)); $cfg =& JEVConfig::getInstance(); $version =& JEventsVersion::getInstance(); $jevtype = JRequest::getVar('jevtype'); $evid = JRequest::getInt('evid'); $pop = JRequest::getInt('pop', 0); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); echo "\n" . '<!-- ' . $version->getLongVersion() . ', ' . utf8_encode(@html_entity_decode($version->getLongCopyright(), ENT_COMPAT, 'ISO-8859-1')) . ', ' . $version->getUrl() . ' -->' . "\n"; // stop crawler and set meta tag JEVHelper::checkRobotsMetaTag(); $lang =& JFactory::getLanguage(); ?> <div class="contentpaneopen jeventpage<?php echo $params->get('pageclass_sfx'); ?> " id="jevents_header"> <?php if ($params->get('show_page_heading', 0)) { ?> <h1> <?php echo $view->escape($params->get('page_heading')); ?> </h1> <?php } ?> <?php $t_headline = ' '; switch ($cfg->get('com_calHeadline', 'comp')) { case 'none': $t_headline = ''; break; case 'menu': $menu2 =& JSite::getMenu(); $menu = $menu2->getActive(); if (isset($menu) && isset($menu->name)) { $t_headline = $menu->name; } break; default: $t_headline = JText::_('JEV_EVENT_CALENDAR'); break; } if ($t_headline != "") { ?> <h2 class="contentheading" ><?php echo $t_headline; ?> </h2> <?php } $task = JRequest::getString("jevtask"); ob_start(); $view->information16(); $info = ob_get_clean(); if ($cfg->get('com_print_icon_view', 1) || $cfg->get('com_email_icon_view', 1) || strpos($info, "<li>") !== false) { ?> <ul class="actions"> <?php if ($cfg->get('com_print_icon_view', 1)) { $print_link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink() . '&pop=1' . '&tmpl=component'; $print_link = JRoute::_($print_link); if ($pop) { ?> <li class="print-icon"> <a href="javascript:void(0);" onclick="javascript:window.print(); return false;" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <?php echo JHTML::_('image.site', 'printButton.png', '/media/system/images/', NULL, NULL, JText::_('JEV_CMN_PRINT')); ?> </a> </li> <?php } else { ?> <li class="print-icon"> <a href="javascript:void(0);" onclick="window.open('<?php echo $print_link; ?> ', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=600,height=600,directories=no,location=no');" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <?php echo JHTML::_('image.site', 'printButton.png', '/media/system/images/', NULL, NULL, JText::_('JEV_CMN_PRINT')); ?> </a> </li> <?php } } if ($cfg->get('com_email_icon_view', 1)) { $task = JRequest::getString("jevtask"); $link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink(); $link = JRoute::_($link); if (strpos($link, "/") === 0) { $link = substr($link, 1); } $link = JURI::root() . $link; require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $url = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link)); ?> <li class="email-icon"> <a href="javascript:void(0);" onclick="javascript:window.open('<?php echo $url; ?> ','emailwin','width=400,height=350,menubar=yes,resizable=yes'); return false;" title="<?php echo JText::_('EMAIL'); ?> "> <?php echo JHTML::_('image.site', 'emailButton.png', '/media/system/images/', NULL, NULL, JText::_('EMAIL')); ?> </a> </li> <?php } echo $info; ?> </ul> <?php } ?> </div> <div class="contentpaneopen jeventpage<?php echo $params->get('pageclass_sfx'); ?> " id="jevents_body"> <?php }
/** * Creates the email button * * @param object $slug * @param $view * @param array $params * * Views: * Category, Event, Venue */ static function mailbutton($slug, $view, $params) { $app = JFactory::getApplication(); $settings = JemHelper::globalattribs(); if ($settings->get('global_show_email_icon')) { # check for print-screen if ($app->input->getInt('print')) { return; } JHtml::_('bootstrap.tooltip'); require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $uri = JUri::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $template = JFactory::getApplication()->getTemplate(); $link = $base . JRoute::_('index.php?option=com_jem&view=' . $view . '&id=' . $slug, false); $url = 'index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; # check for icon-setting if ($settings->get('global_show_icons')) { $text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), NULL, true); } else { $text = JText::_('JGLOBAL_EMAIL'); } $desc = JText::_('COM_JEM_EMAIL_DESC'); $title = JText::_('JGLOBAL_EMAIL'); $tip = JHtml::tooltipText($title, $desc, 0); $attribs = array(); $attribs['title'] = $tip; $attribs['class'] = 'hasTooltip'; $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; } }
public function render($title, $image_url, $item_link, $context) { $twitter_title = str_replace("|", "", $title); JPlugin::loadLanguage('plg_content_b2jsocial', JPATH_ADMINISTRATOR); $doc = JFactory::getDocument(); $preset = $this->params->get('preset', 1); $share_counts = $this->params->get('share_counts', 0); $count_color = $this->params->get('count_color', '#666666'); $include_font = $this->params->get('include_font', 1); if ($include_font) { $doc->addStyleSheet('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'); } $background_color = $this->params->get('background_color', '#999999'); $icon_color = $this->params->get('icon_color', '#ffffff'); $icon_font_size = $this->params->get('icon_font_size', '24'); $buttons = $this->params->get('buttons', 'icons'); $icon_size = $this->params->get('icon_size', '32'); $align = $this->params->get('align', 'left'); $f_pos = $this->params->get('f_pos', 1); $t_pos = $this->params->get('t_pos', 2); $g_pos = $this->params->get('g_pos', 3); $l_pos = $this->params->get('l_pos', 4); $p_pos = $this->params->get('p_pos', 5); $e_pos = $this->params->get('e_pos', 6); $f = $this->params->get('f', 1); $t = $this->params->get('t', 1); $g = $this->params->get('g', 1); $l = $this->params->get('l', 1); $p = $this->params->get('p', 1); $e = $this->params->get('e', 1); $t_name = $this->params->get('t_name', 'bang2joom'); $f_og = $this->params->get('f_og', 1); if ($share_counts) { $buttons = 'icons'; } if ($f_og) { $doc->addCustomTag('<meta property="og:title" content="' . $title . '" />'); $doc->addCustomTag('<meta property="og:type" content="product" />'); if ($image_url != '') { $doc->addCustomTag('<meta property="og:image" content="' . $image_url . '" />'); } $doc->addCustomTag('<meta property="og:url" content="' . JFactory::getURI()->toString() . '" />'); } $preset_name = "preset1"; $offset = 0; if ($preset == 2) { $preset_name = "preset2"; $offset = $icon_size; } if ($preset == 3) { $preset_name = "preset3"; $offset = 2 * $icon_size; } if ($preset == 4) { $preset_name = "preset4"; $offset = 3 * $icon_size; } if ($preset == 5) { $preset_name = "preset5"; $offset = 4 * $icon_size; } if ($preset == 6) { $preset_name = "preset6"; $offset = 6 * $icon_size; } if ($preset == 7) { $preset_name = "preset7"; } if ($preset == 8) { $preset_name = "preset8"; $offset = 7 * $icon_size; } if ($preset == 9) { $preset_name = "preset9"; $offset = 8 * $icon_size; } if ($preset == 10) { $preset_name = "preset10"; $offset = 0; } $js = ''; $css = ''; $css .= 'div.b2jsocial_parent {'; $css .= 'text-align:' . $align . ';'; $css .= '}'; if ($preset != 7 && $preset != 10) { if ($buttons == 'both') { $css .= 'ul.b2jsocial li {'; $css .= 'width:' . ($icon_size + 65) . 'px;'; $css .= 'height:' . ($icon_size + 10) . 'px;'; $css .= '}'; $css .= 'ul.b2jsocial li a{'; $css .= 'width:' . ($icon_size + 65) . 'px;'; $css .= 'height:' . ($icon_size + 10) . 'px;'; $css .= '}'; $css .= 'ul.b2jsocial li span.text{'; $css .= 'display:inline;'; $css .= 'margin-left:15px !important;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.f span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.f.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.t span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 0 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.t.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 0 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.g span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 2 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.g.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 2 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.l span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 3 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.l.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 3 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.e span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 4 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.e.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 4 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.p span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 5 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.p.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 5 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; } if ($buttons == 'text') { $css .= 'ul.b2jsocial li span.text{'; $css .= 'display:inline;'; $css .= '}'; $css .= 'ul.b2jsocial li a{'; $css .= 'text-align:center'; $css .= '}'; } if ($buttons == 'icons') { if ($share_counts) { $extra_width = '36'; $left = '46'; if ($icon_size == 16) { $extra_width = '36'; $left = '27'; } else { if ($icon_size == 32) { $extra_width = '42'; $left = '46'; } else { if ($icon_size == 64) { $extra_width = '40'; $left = '72'; } } } $css .= 'ul.b2jsocial li span.social_count {'; $css .= 'display:block;'; $css .= 'color:' . $count_color . ";"; $css .= 'border-color:' . $count_color . ";"; $css .= 'left:' . $left . 'px;'; $css .= '}'; $css .= 'ul.b2jsocial li span.social_count:before {'; $css .= 'border-left-color:' . $count_color . ";"; $css .= '}'; $css .= 'ul.b2jsocial li span.background {'; $css .= 'left:0'; $css .= '}'; } else { $extra_width = '0'; } $css .= 'ul.b2jsocial li {'; $css .= 'width:' . ($icon_size + 10 + $extra_width) . 'px;'; $css .= 'height:' . ($icon_size + 10) . 'px;'; $css .= '}'; $css .= 'ul.b2jsocial li a{'; $css .= 'width:' . ($icon_size + 10 + $extra_width) . 'px;'; $css .= 'height:' . ($icon_size + 10) . 'px;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.f span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.f.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.t span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 0 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.t.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 0 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.g span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 2 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.g.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 2 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.l span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 3 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.l.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 3 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.e span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 4 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.e.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 4 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; //--// $css .= 'ul.b2jsocial li.p span.background {'; $css .= 'width:' . $icon_size . 'px;'; $css .= 'height:' . $icon_size . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/icons' . $icon_size . '.png") -' . $icon_size * 5 . 'px -' . $offset . 'px no-repeat'; $css .= '}'; $css .= 'ul.b2jsocial li.p.preset5 span.background:hover {'; $css .= 'background-position:-' . $icon_size * 5 . 'px -' . ($offset + $icon_size) . 'px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; } } else { if ($preset == 7) { $css .= 'ul.b2jsocial li.e span.background {'; $css .= 'width:74px;'; $css .= 'height:20px;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= 'background:url("' . JURI::root() . 'plugins/content/b2jsocial/images/email_icon.png") no-repeat'; $css .= '}'; // facebook javascirpt $js .= "(function(d, s, id) {"; $js .= "var js, fjs = d.getElementsByTagName(s)[0];"; $js .= "if (d.getElementById(id)) return;"; $js .= "js = d.createElement(s); js.id = id;"; $js .= "js.src = '//connect.facebook.net/en_GB/all.js#xfbml=1&appId=371410889631698';"; $js .= "fjs.parentNode.insertBefore(js, fjs);"; $js .= '}(document, "script", "facebook-jssdk"));'; // twitter javascirpt $js .= '!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");'; } else { $css .= 'ul.b2jsocial{'; $css .= 'width:100%'; $css .= '}'; $array_true = array($f, $t, $g, $l, $e, $p); $array_true = array_filter($array_true); $elem_count = count($array_true); $array_bootstrap = array(0 => '100', 1 => '100', 2 => '50', 3 => '33.3', 4 => '25', 5 => '20', 6 => '16.6'); $css .= 'ul.b2jsocial li{'; $css .= 'width:' . $array_bootstrap[$elem_count] . '%;'; $css .= 'height:auto;'; $css .= 'transition: all 0.3s ease 0s;'; $css .= 'text-align:center;'; $css .= '-webkit-transition: all 0.3s ease 0s;'; $css .= '}'; $css .= 'ul.b2jsocial li a{'; $css .= 'width:auto;'; $css .= 'height:auto;'; $css .= 'display:block;'; $css .= 'background:' . $background_color . ';'; $css .= 'margin-right:10px;'; $css .= '}'; $css .= 'ul.b2jsocial li a:after{'; $css .= 'font-size:' . $icon_font_size . 'px;'; $css .= 'color:' . $icon_color . ';'; $css .= '}'; } } $uri = JURI::getInstance(); $domain = $uri->toString(array('scheme', 'host', 'port')); $item_url = $domain . $item_link; if ($context == 'redShop') { $item_url = $item_link; } $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $doc->addScriptDeclaration($js); $app = JFactory::getApplication(); $template = $app->getTemplate(); $email_link = JRoute::_('index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($item_url)); if ($preset != 7 && $preset != 10) { // all except default and custom if ($share_counts) { if ($f) { $fb_count = $this->shorten_counts($this->getFBShareCount($item_url)); } else { $fb_count = -1; } if ($t) { $tw_count = $this->shorten_counts($this->getTweetCount($item_url)); } else { $tw_count = -1; } if ($g) { $gp_count = $this->shorten_counts($this->get_plusones($item_url)); } else { $gp_count = -1; } if ($l) { $ld_count = $this->shorten_counts($this->getLinkedInCount($item_url)); } else { $ld_count = -1; } if ($p) { $pt_count = $this->shorten_counts($this->get_pins($item_url)); } else { $pt_count = -1; } } else { $fb_count = -1; $tw_count = -1; $gp_count = -1; $ld_count = -1; $pt_count = -1; } $fb_count_class = ""; $tw_count_class = ""; $gp_count_class = ""; $ld_count_class = ""; $pt_count_class = ""; if ($fb_count < 0) { $fb_count_class = "hide"; } if ($tw_count < 0) { $tw_count_class = "hide"; } if ($gp_count < 0) { $gp_count_class = "hide"; } if ($ld_count < 0) { $ld_count_class = "hide"; } if ($pt_count < 0) { $pt_count_class = "hide"; } $item_url = urlencode($item_url); $f_cont = '<li class="f ' . $preset_name . '"><a class="' . $preset_name . '" href="http://www.facebook.com/sharer.php?u=' . $item_url . '" target="_blank"><span class="text">' . JText::_('PLG_B2J_SOCIAL_FACEBOOK_TEXT') . '</span><span class="background"></span><span class="social_count ' . $fb_count_class . '">' . $fb_count . '</span></a></li>'; $t_cont = '<li class="t ' . $preset_name . '"><a class="' . $preset_name . '" href="http://twitter.com/intent/tweet?text=' . $twitter_title . '&url=' . $item_url . '&via=' . $t_name . '" target="_blank"><span class="text">' . JText::_('PLG_B2J_SOCIAL_TWITTER_TEXT') . '</span><span class="background"></span><span class="social_count ' . $tw_count_class . '">' . $tw_count . '</span></a></li>'; $g_cont = '<li class="g ' . $preset_name . '"><a class="' . $preset_name . '" href="http://plus.google.com/share?url=' . $item_url . '" target="_blank"><span class="text">' . JText::_('PLG_B2J_SOCIAL_GOOGLE_TEXT') . '</span><span class="background"></span><span class="social_count ' . $gp_count_class . '">' . $gp_count . '</span></a></li>'; $l_cont = '<li class="l ' . $preset_name . '"><a class="' . $preset_name . '" href="http://www.linkedin.com/shareArticle?mini=true&url=' . $item_url . '&title=' . $title . '" target="_blank"><span class="text">' . JText::_('PLG_B2J_SOCIAL_LINKEDIN_TEXT') . '</span><span class="background"></span><span class="social_count ' . $ld_count_class . '">' . $ld_count . '</span></a></li>'; $e_cont = '<li class="e ' . $preset_name . '"><a class="' . $preset_name . '" href="' . $email_link . '" onclick="window.open(this.href,\'emailWindow\',\'width=800,height=600,location=no,menubar=no,resizable=no,scrollbars=no\'); return false;"><span class="text">' . JText::_('PLG_B2J_SOCIAL_EMAIL_TEXT') . '</span><span class="background"></span><span class="social_count hide"></span></a></li>'; $p_cont = '<li class="p ' . $preset_name . '"><a class="' . $preset_name . '" href="http://pinterest.com/pin/create/button/?url=' . $item_url . '&media=' . $image_url . '&description=' . $title . '" target="_blank"><span class="text">' . JText::_('PLG_B2J_SOCIAL_PINTEREST_TEXT') . '</span><span class="background"></span><span class="social_count ' . $pt_count_class . '">' . $pt_count . '</span></a></li>'; } else { if ($preset == 7) { // default $f_cont = '<li class="f ' . $preset_name . '"><div class="fb-like" data-href="' . $item_url . '" data-width="450" data-layout="button_count" data-show-faces="true" data-send="false"></div></li>'; $t_cont = '<li class="t ' . $preset_name . '"><a href="https://twitter.com/share" class="twitter-share-button" data-size="small" data-text="' . $twitter_title . '" data-url="' . $item_url . '" data-via="' . $t_name . '" data-lang="en">Tweet</a></li>'; $g_cont = '<li class="g ' . $preset_name . '"><div class="g-plus" data-annotation="bubble" data-action="share" data-height="20"></div><script type="text/javascript">(function() {var po = document.createElement("script"); po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); </script></li>'; $l_cont = '<li class="l ' . $preset_name . '"><script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script><script type="IN/Share" data-url="' . $image_url . '" data-counter="right"></script></li>'; $e_cont = '<li class="e ' . $preset_name . '"><a class="' . $preset_name . '" href="' . $email_link . '" onclick="window.open(this.href,\'emailWindow\',\'width=800,height=600,location=no,menubar=no,resizable=no,scrollbars=no\'); return false;"><span class="background"></span></a></li>'; $p_cont = '<li class="p ' . $preset_name . '"><a data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=' . $item_url . '&media=' . $image_url . '&description=' . $title . '" data-pin-do="buttonPin" ><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a><script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script></li>'; } else { //custom $item_url = urlencode($item_url); $f_cont = '<li class="f ' . $preset_name . '"><a class="' . $preset_name . '" href="http://www.facebook.com/sharer.php?u=' . $item_url . '" target="_blank"></a></li>'; $t_cont = '<li class="t ' . $preset_name . '"><a class="' . $preset_name . '" href="http://twitter.com/intent/tweet?text=' . $twitter_title . '&url=' . $item_url . '&via=' . $t_name . '" target="_blank"></a></li>'; $g_cont = '<li class="g ' . $preset_name . '"><a class="' . $preset_name . '" href="http://plus.google.com/share?url=' . $item_url . '" target="_blank"></a></li>'; $l_cont = '<li class="l ' . $preset_name . '"><a class="' . $preset_name . '" href="http://www.linkedin.com/shareArticle?mini=true&url=' . $item_url . '&title=' . $title . '" target="_blank"></a></li>'; $e_cont = '<li class="e ' . $preset_name . '"><a class="' . $preset_name . '" href="' . $email_link . '" onclick="window.open(this.href,\'emailWindow\',\'width=800,height=600,location=no,menubar=no,resizable=no,scrollbars=no\'); return false;"></a></li>'; $p_cont = '<li class="p ' . $preset_name . '"><a class="' . $preset_name . '" href="http://pinterest.com/pin/create/button/?url=' . $item_url . '&media=' . $image_url . '&description=' . $title . '" target="_blank"></a></li>'; } } $seq = array(); if ($f) { $seq[$f_pos] = $f_cont; } if ($t) { $seq[$t_pos] = $t_cont; } if ($g) { $seq[$g_pos] = $g_cont; } if ($l) { $seq[$l_pos] = $l_cont; } if ($e) { $seq[$e_pos] = $e_cont; } if ($p) { $seq[$p_pos] = $p_cont; } ksort($seq); $social = '<div class="b2jsocial_parent">'; $social .= '<ul class="b2jsocial">'; foreach ($seq as $li) { $social .= $li; } $social .= '</ul>'; $social .= '</div>'; return $social; }
function FlatViewHelperHeader16($view) { $task = JRequest::getString("jevtask"); $view->loadModules("jevprejevents"); $view->loadModules("jevprejevents_" . $task); $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onJEventsHeader', array($view)); $cfg = JEVConfig::getInstance(); $version = JEventsVersion::getInstance(); $jevtype = JRequest::getVar('jevtype'); $evid = JRequest::getInt('evid'); $pop = JRequest::getInt('pop', 0); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $view->copyrightComment(); // stop crawler and set meta tag JEVHelper::checkRobotsMetaTag(); // Call the MetaTag setter function. if (is_callable(array("JEVHelper", "SetMetaTags"))) { JEVHelper::SetMetaTags(); } $lang = JFactory::getLanguage(); ?> <div id="jevents"> <div class="contentpaneopen jeventpage<?php echo $params->get('pageclass_sfx'); echo $params->get("darktemplate", 0) ? " jeventsdark" : " "; echo $lang->isRTL() ? " jevrtl" : " "; ?> jevbootstrap" id="jevents_header"> <?php if ($params->get('show_page_heading', 0)) { ?> <h1> <?php echo $view->escape($params->get('page_heading')); ?> </h1> <?php } ?> <?php $t_headline = ''; switch ($cfg->get('com_calHeadline', 'comp')) { case 'none': $t_headline = ''; break; case 'menu': $menu2 = JFactory::getApplication()->getMenu(); $menu = $menu2->getActive(); if (isset($menu) && isset($menu->title)) { $t_headline = $menu->title; } break; default: $t_headline = JText::_('JEV_EVENT_CALENDAR'); break; } if ($t_headline != "") { ?> <h2 class="contentheading" ><?php echo $t_headline; ?> </h2> <?php } $task = JRequest::getString("jevtask"); $info = ""; if ($cfg->get('com_print_icon_view', 1) || $cfg->get('com_email_icon_view', 1) || strpos($info, "<li>") !== false) { ?> <ul class="actions"> <?php if ($cfg->get('com_print_icon_view', 1)) { $print_link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink() . '&pop=1' . '&tmpl=component'; $print_link = JRoute::_($print_link); if ($pop) { ?> <li class="print-icon"> <a href="javascript:void(0);" onclick="javascript:window.print(); return false;" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <span class="icon-print"> </span> </a> </li> <?php } else { ?> <li class="print-icon"> <a href="javascript:void(0);" onclick="window.open('<?php echo $print_link; ?> ', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=600,height=600,directories=no,location=no');" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <span class="icon-print"> </span> </a> </li> <?php } } if ($cfg->get('com_email_icon_view', 1)) { $task = JRequest::getString("jevtask"); $link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink(); $link = JRoute::_($link); //if (strpos($link,"/")===0) $link = JString::substr($link,1); $uri = JURI::getInstance(JURI::base()); $root = $uri->toString(array('scheme', 'host', 'port')); $link = $root . $link; require_once JPATH_SITE . '/' . 'components' . '/' . 'com_mailto' . '/' . 'helpers' . '/' . 'mailto.php'; $url = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link)); ?> <li class="email-icon"> <a href="javascript:void(0);" onclick="javascript:window.open('<?php echo $url; ?> ','emailwin','width=400,height=350,menubar=yes,resizable=yes'); return false;" title="<?php echo JText::_('EMAIL'); ?> "> <span class="icon-envelope"> </span> </a> </li> <?php } echo $info; ?> </ul> <?php } ?> </div> <div class="jev_clear"></div> <?php $view->loadModules("jevprejevents2"); $view->loadModules("jevprejevents2_" . $task); ?> <div class="contentpaneopen jeventpage<?php echo $params->get('pageclass_sfx'); echo $params->get("darktemplate", 0) ? " jeventsdark" : " "; echo $lang->isRTL() ? " jevrtl" : " "; ?> jevbootstrap" id="jevents_body"> <?php }
public function getEmailLink() { if (!isset($this->emailLink)) { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $application = JFactory::getApplication(); $template = $application->getTemplate(); $this->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($this->url)); } return $this->emailLink; }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $document = JFactory::getDocument(); $params = K2HelperUtilities::getParams('com_k2'); $limitstart = JRequest::getInt('limitstart', 0); $view = JRequest::getWord('view'); $task = JRequest::getWord('task'); $db = JFactory::getDBO(); $jnow = JFactory::getDate(); $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); $nullDate = $db->getNullDate(); $this->setLayout('item'); // Add link if (K2HelperPermissions::canAddItem()) { $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); } $this->assignRef('addLink', $addLink); // Get item $model = $this->getModel(); $item = $model->getData(); $item->event = new stdClass(); // Does the item exists? if (!is_object($item) || !$item->id) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Prepare item $item = $model->prepareItem($item, $view, $task); // Plugins $item = $model->execPlugins($item, $view, $task); // User K2 plugins $item->event->K2UserDisplay = ''; if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart)); $item->event->K2UserDisplay = trim(implode("\n", $results)); $item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8'); } // Access check if ($this->getLayout() == 'form') { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } if (K2_JVERSION != '15') { if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } } else { if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } } // Published check if (!$item->published || $item->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_up != $nullDate && $item->publish_up > $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_down != $nullDate && $item->publish_down < $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if (!$item->category->published || $item->category->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Increase hits counter $model->hit($item->id); // Set default image K2HelperUtilities::setDefaultImage($item, $view); // Comments $item->event->K2CommentsCounter = ''; $item->event->K2CommentsBlock = ''; if ($item->params->get('itemComments')) { // Trigger comments events $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart)); $item->event->K2CommentsCounter = trim(implode("\n", $results)); $results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart)); $item->event->K2CommentsBlock = trim(implode("\n", $results)); // Load K2 native comments system only if there are no plugins overriding it if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) { $limit = $params->get('commentsLimit'); $comments = $model->getItemComments($item->id, $limitstart, $limit); $pattern = "@\\b(https?://)?(([0-9a-zA-Z_!~*'().&=+\$%-]+:)?[0-9a-zA-Z_!~*'().&=+\$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+\$,%#-]+)*/?)@"; for ($i = 0; $i < sizeof($comments); $i++) { $comments[$i]->commentText = nl2br($comments[$i]->commentText); $comments[$i]->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\\0">\\0</a>', $comments[$i]->commentText); $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth')); if ($comments[$i]->userID > 0) { $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID); } else { $comments[$i]->userLink = $comments[$i]->commentURL; } } $item->comments = $comments; jimport('joomla.html.pagination'); $total = $item->numOfComments; $pagination = new JPagination($total, $limitstart, $limit); } } // Author's latest items if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') { $model = $this->getModel('itemlist'); $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by); if (count($authorLatestItems)) { for ($i = 0; $i < sizeof($authorLatestItems); $i++) { $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id . ':' . urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid . ':' . urlencode($authorLatestItems[$i]->categoryalias)))); } $this->assignRef('authorLatestItems', $authorLatestItems); } } // Related items if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) { $model = $this->getModel('itemlist'); $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params); if (count($relatedItems)) { for ($i = 0; $i < sizeof($relatedItems); $i++) { $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id . ':' . urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid . ':' . urlencode($relatedItems[$i]->categoryalias)))); } $this->assignRef('relatedItems', $relatedItems); } } // Navigation (previous and next item) if ($item->params->get('itemNavigation')) { $model = $this->getModel('item'); $nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering); if (!is_null($nextItem)) { $item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id . ':' . urlencode($nextItem->alias), $nextItem->catid . ':' . urlencode($item->category->alias)))); $item->nextTitle = $nextItem->title; } $previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering); if (!is_null($previousItem)) { $item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id . ':' . urlencode($previousItem->alias), $previousItem->catid . ':' . urlencode($item->category->alias)))); $item->previousTitle = $previousItem->title; } } // Absolute URL $uri = JURI::getInstance(); $item->absoluteURL = $uri->toString(); // Email link if (K2_JVERSION != '15') { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $template = $mainframe->getTemplate(); $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($item->absoluteURL)); } else { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($item->absoluteURL)); } // Twitter link (legacy code) if ($params->get('twitterUsername')) { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL) . '&via=' . $params->get('twitterUsername'); } else { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL); } // Social link $item->socialLink = urlencode($item->absoluteURL); // Look for template files in component folders $this->_addPath('template', JPATH_COMPONENT . DS . 'templates'); $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (K2 template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (Joomla! template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'default'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2'); // Look for specific K2 theme files if ($item->params->get('theme')) { $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . $item->params->get('theme')); } // Assign data $this->assignRef('item', $item); $this->assignRef('user', $user); $this->assignRef('params', $item->params); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $document = JFactory::getDocument(); $params = K2HelperUtilities::getParams('com_k2'); $limitstart = JRequest::getInt('limitstart', 0); $view = JRequest::getWord('view'); $task = JRequest::getWord('task'); $db = JFactory::getDBO(); $jnow = JFactory::getDate(); $now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql(); $nullDate = $db->getNullDate(); $this->setLayout('item'); // Add link if (K2HelperPermissions::canAddItem()) { $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); } $this->assignRef('addLink', $addLink); // Get item $model = $this->getModel(); $item = $model->getData(); // Does the item exists? if (!is_object($item) || !$item->id) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Prepare item $item = $model->prepareItem($item, $view, $task); // Plugins $item = $model->execPlugins($item, $view, $task); // User K2 plugins $item->event->K2UserDisplay = ''; if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart)); $item->event->K2UserDisplay = trim(implode("\n", $results)); $item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8'); } // Access check if ($this->getLayout() == 'form') { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } if (K2_JVERSION != '15') { if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } } else { if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } } // Published check if (!$item->published || $item->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_up != $nullDate && $item->publish_up > $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if ($item->publish_down != $nullDate && $item->publish_down < $now) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } if (!$item->category->published || $item->category->trash) { JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND')); } // Increase hits counter $model->hit($item->id); // Set default image K2HelperUtilities::setDefaultImage($item, $view); // Pass the old parameter to the view in order to avoid layout changes if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') { $params->set('recaptcha', true); $item->params->set('recaptcha', true); } else { $params->set('recaptcha', false); $item->params->set('recaptcha', false); } // Comments $item->event->K2CommentsCounter = ''; $item->event->K2CommentsBlock = ''; if ($item->params->get('itemComments')) { // Trigger comments events $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart)); $item->event->K2CommentsCounter = trim(implode("\n", $results)); $results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart)); $item->event->K2CommentsBlock = trim(implode("\n", $results)); // Load K2 native comments system only if there are no plugins overriding it if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) { // Load reCAPTCHA script if (!JRequest::getInt('print') && ($item->params->get('comments') == '1' || $item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($item->catid))) { if ($params->get('recaptcha') && ($user->guest || $params->get('recaptchaForRegistered', 1))) { $document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); $js = ' function showRecaptcha(){ Recaptcha.create("' . $item->params->get('recaptcha_public_key') . '", "recaptcha", { theme: "' . $item->params->get('recaptcha_theme', 'clean') . '" }); } $K2(window).load(function() { showRecaptcha(); }); '; $document->addScriptDeclaration($js); } } // Check for inline comment moderation if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration')) { $inlineCommentsModeration = true; $commentsPublished = false; } else { $inlineCommentsModeration = false; $commentsPublished = true; } $this->assignRef('inlineCommentsModeration', $inlineCommentsModeration); // Flag spammer link $reportSpammerFlag = false; if (K2_JVERSION != '15') { if ($user->authorise('core.admin', 'com_k2')) { $reportSpammerFlag = true; $document = JFactory::getDocument(); $document->addScriptDeclaration('var K2Language = ["' . JText::_('K2_REPORT_USER_WARNING', true) . '"];'); } } else { if ($user->gid > 24) { $reportSpammerFlag = true; } } $limit = $params->get('commentsLimit'); $comments = $model->getItemComments($item->id, $limitstart, $limit, $commentsPublished); for ($i = 0; $i < sizeof($comments); $i++) { $comments[$i]->commentText = nl2br($comments[$i]->commentText); // Convert URLs to links properly $comments[$i]->commentText = preg_replace("/([^\\w\\/])(www\\.[a-z0-9\\-]+\\.[a-z0-9\\-]+)/i", "\$1http://\$2", $comments[$i]->commentText); $comments[$i]->commentText = preg_replace("/([\\w]+:\\/\\/[\\w-?&;#~=\\.\\/\\@]+[\\w\\/])/i", "<a target=\"_blank\" rel=\"nofollow\" href=\"\$1\">\$1</A>", $comments[$i]->commentText); $comments[$i]->commentText = preg_replace("/([\\w-?&;#~=\\.\\/]+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?))/i", "<a href=\"mailto:\$1\">\$1</A>", $comments[$i]->commentText); $comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth')); if ($comments[$i]->userID > 0) { $comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID); } else { $comments[$i]->userLink = $comments[$i]->commentURL; } if ($reportSpammerFlag && $comments[$i]->userID > 0) { $comments[$i]->reportUserLink = JRoute::_('index.php?option=com_k2&view=comments&task=reportSpammer&id=' . $comments[$i]->userID . '&format=raw'); } else { $comments[$i]->reportUserLink = false; } } $item->comments = $comments; if (!isset($item->numOfComments)) { $item->numOfComments = 0; } jimport('joomla.html.pagination'); $total = $item->numOfComments; $pagination = new JPagination($total, $limitstart, $limit); } } // Author's latest items if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '') { $model = $this->getModel('itemlist'); $authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by); if (count($authorLatestItems)) { for ($i = 0; $i < sizeof($authorLatestItems); $i++) { $authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id . ':' . urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid . ':' . urlencode($authorLatestItems[$i]->categoryalias)))); } $this->assignRef('authorLatestItems', $authorLatestItems); } } // Related items if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags)) { $model = $this->getModel('itemlist'); $relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params); if (count($relatedItems)) { for ($i = 0; $i < sizeof($relatedItems); $i++) { $relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id . ':' . urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid . ':' . urlencode($relatedItems[$i]->categoryalias)))); } $this->assignRef('relatedItems', $relatedItems); } } // Navigation (previous and next item) if ($item->params->get('itemNavigation')) { $model = $this->getModel('item'); $nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering); if (!is_null($nextItem)) { $item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id . ':' . urlencode($nextItem->alias), $nextItem->catid . ':' . urlencode($item->category->alias)))); $item->nextTitle = $nextItem->title; $date = JFactory::getDate($item->modified); $timestamp = '?t=' . $date->toUnix(); if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_XS.jpg')) { $item->nextImageXSmall = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_XS.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_S.jpg')) { $item->nextImageSmall = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_S.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_M.jpg')) { $item->nextImageMedium = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_M.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_L.jpg')) { $item->nextImageLarge = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_L.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_XL.jpg')) { $item->nextImageXLarge = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_XL.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $nextItem->id) . '_Generic.jpg')) { $item->nextImageGeneric = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $nextItem->id) . '_Generic.jpg' . $timestamp; } } $previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering); if (!is_null($previousItem)) { $item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id . ':' . urlencode($previousItem->alias), $previousItem->catid . ':' . urlencode($item->category->alias)))); $item->previousTitle = $previousItem->title; $date = JFactory::getDate($item->modified); $timestamp = '?t=' . $date->toUnix(); if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_XS.jpg')) { $item->previousImageXSmall = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_XS.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_S.jpg')) { $item->previousImageSmall = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_S.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_M.jpg')) { $item->previousImageMedium = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_M.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_L.jpg')) { $item->previousImageLarge = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_L.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_XL.jpg')) { $item->previousImageXLarge = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_XL.jpg' . $timestamp; } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $previousItem->id) . '_Generic.jpg')) { $item->previousImageGeneric = JURI::base(true) . '/media/k2/items/cache/' . md5("Image" . $previousItem->id) . '_Generic.jpg' . $timestamp; } } } // Absolute URL $uri = JURI::getInstance(); $item->absoluteURL = $uri->toString(); // Email link if (K2_JVERSION != '15') { require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $template = $mainframe->getTemplate(); $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template=' . $template . '&link=' . MailToHelper::addLink($item->absoluteURL)); } else { require_once JPATH_SITE . DS . 'components' . DS . 'com_mailto' . DS . 'helpers' . DS . 'mailto.php'; $item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($item->absoluteURL)); } // Twitter link (legacy code) if ($params->get('twitterUsername')) { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL) . '&via=' . $params->get('twitterUsername'); } else { $item->twitterURL = 'http://twitter.com/intent/tweet?text=' . urlencode($item->title) . '&url=' . urlencode($item->absoluteURL); } // Social link $item->socialLink = urlencode($item->absoluteURL); // Set page title $menus = $mainframe->getMenu(); $menu = $menus->getActive(); if (is_object($menu) && isset($menu->query['view']) && $menu->query['view'] == 'item' && isset($menu->query['id']) && $menu->query['id'] == $item->id) { if (is_string($menu->params)) { $menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params); } else { $menu_params = $menu->params; } if (!$menu_params->get('page_title')) { $params->set('page_title', $item->cleanTitle); } } else { $params->set('page_title', $item->cleanTitle); } if (K2_JVERSION != '15') { if ($mainframe->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title')); $params->set('page_title', $title); } elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename')); $params->set('page_title', $title); } } $document->setTitle($params->get('page_title')); // Set pathway $menus = $mainframe->getMenu(); $menu = $menus->getActive(); $pathway = $mainframe->getPathWay(); if ($menu) { if (isset($menu->query['view']) && ($menu->query['view'] != 'item' || $menu->query['id'] != $item->id)) { if (!isset($menu->query['task']) || $menu->query['task'] != 'category' || $menu->query['id'] != $item->catid) { $pathway->addItem($item->category->name, $item->category->link); } $pathway->addItem($item->cleanTitle, ''); } } // Set metadata if ($item->metadesc) { $document->setDescription(K2_JVERSION == '15' ? htmlspecialchars($item->metadesc, ENT_QUOTES, 'UTF-8') : $item->metadesc); } else { $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext . ' ' . $item->fulltext); $metaDescItem = strip_tags($metaDescItem); $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150)); $document->setDescription(K2_JVERSION == '15' ? $metaDescItem : html_entity_decode($metaDescItem)); } if ($item->metakey) { $document->setMetadata('keywords', $item->metakey); } else { if (isset($item->tags) && count($item->tags)) { $tmp = array(); foreach ($item->tags as $tag) { $tmp[] = $tag->name; } $document->setMetadata('keywords', implode(',', $tmp)); } } // Menu metadata for Joomla! 2.5+ (overrides the current metadata if set) if (K2_JVERSION != '15') { if ($params->get('menu-meta_description')) { $document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $document->setMetadata('robots', $params->get('robots')); } // Menu page display options if ($params->get('page_heading')) { $params->set('page_title', $params->get('page_heading')); } $params->set('show_page_title', $params->get('show_page_heading')); } if ($mainframe->getCfg('MetaTitle') == '1') { $document->setMetadata('title', $item->cleanTitle); } if ($mainframe->getCfg('MetaAuthor') == '1' && isset($item->author->name)) { $document->setMetadata('author', $item->author->name); } $mdata = class_exists('JParameter') ? new JParameter($item->metadata) : new JRegistry($item->metadata); $mdata = $mdata->toArray(); foreach ($mdata as $k => $v) { if ($k == 'robots' || $k == 'author') { if ($v) { $document->setMetadata($k, $v); } } } // Set Facebook meta data $document = JFactory::getDocument(); $uri = JURI::getInstance(); $document->setMetaData('og:url', $uri->toString()); $document->setMetaData('og:title', K2_JVERSION == '15' ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle()); $document->setMetaData('og:type', 'article'); $facebookImage = 'image' . $params->get('facebookImage', 'Small'); if ($item->{$facebookImage}) { $parts = parse_url($item->{$facebookImage}); if (JFile::exists(JPATH_SITE . $parts['path'])) { $image = substr(JURI::root(), 0, -1) . str_replace(JURI::root(true), '', $item->{$facebookImage}); $document->setMetaData('og:image', $image); $document->setMetaData('image', $image); } } $document->setMetaData('og:description', strip_tags($document->getDescription())); // Look for template files in component folders $this->_addPath('template', JPATH_COMPONENT . DS . 'templates'); $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (K2 template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (Joomla! template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'default'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2'); // Look for specific K2 theme files if ($item->params->get('theme')) { $this->_addPath('template', JPATH_COMPONENT . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . $item->params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . $item->params->get('theme')); } // Assign data $this->assignRef('item', $item); $this->assignRef('user', $user); $this->assignRef('params', $item->params); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * Creates the email button * * @param object $slug * @param $view * @param array $params * * Views: * Category, Event, Venue */ static function mailbutton($slug, $view, $params) { $app = JFactory::getApplication(); $settings = JemHelper::globalattribs(); if ($settings->get('global_show_email_icon')) { if ($app->input->get('print','','int')) { return; } JHtml::_('behavior.tooltip'); require_once JPATH_SITE . '/components/com_mailto/helpers/mailto.php'; $uri = JUri::getInstance(); $base = $uri->toString(array('scheme', 'host', 'port')); $template = JFactory::getApplication()->getTemplate(); $link = $base.JRoute::_('index.php?option=com_jem&view='.$view.'&id='.$slug, false); $url = 'index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; if ($settings->get('global_show_icons')) { $image = JHtml::_('image','system/emailButton.png', JText::_('JGLOBAL_EMAIL'), NULL, true); } else { $image = JText::_('COM_JEM_EMAIL'); } $overlib = JText::_('COM_JEM_EMAIL_DESC'); $text = JText::_('COM_JEM_EMAIL'); $output = '<a href="'. JRoute::_($url) .'" '.JEMOutput::tooltip($text, $overlib, '', 'bottom') . ' onclick="window.open(this.href,\'win2\',\''.$status.'\'); return false;">'.$image.'</a>'; return $output; } }
function FlatViewHelperHeader($view) { if (version_compare(JVERSION, "1.6.0", 'ge')) { return $view->_header16(); } $task = JRequest::getString("jevtask"); $view->loadModules("jevprejevents"); $view->loadModules("jevprejevents_" . $task); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onJEventsHeader', array($view)); $cfg = JEVConfig::getInstance(); $version = JEventsVersion::getInstance(); $jevtype = JRequest::getVar('jevtype'); $evid = JRequest::getInt('evid'); $pop = JRequest::getInt('pop', 0); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); echo "\n" . '<!-- ' . $version->getLongVersion() . ', ' . utf8_encode(@html_entity_decode($version->getLongCopyright(), ENT_COMPAT, 'ISO-8859-1')) . ', ' . $version->getUrl() . ' -->' . "\n"; // stop crawler and set meta tag JEVHelper::checkRobotsMetaTag(); // Call the MetaTag setter function. if (is_callable(array("JEVHelper", "SetMetaTags"))) { JEVHelper::SetMetaTags(); } $lang = JFactory::getLanguage(); ?> <table class="contentpaneopen jeventpage <?php echo $params->get('pageclass_sfx'); echo $params->get("darktemplate", 0) ? " jeventsdark" : "jeventslight"; echo $lang->isRTL() ? " jevrtl" : " "; ?> " id="jevents_header"> <tr> <td class="contentheading" width="100%"> <?php $t_headline = ' '; switch ($cfg->get('com_calHeadline', 'comp')) { case 'none': $t_headline = ' '; break; case 'menu': $menu2 = JFactory::getApplication()->getMenu(); $menu = $menu2->getActive(); if (isset($menu) && isset($menu->name)) { $t_headline = $menu->name; } break; default: $t_headline = JText::_('JEV_EVENT_CALENDAR'); break; } echo $t_headline; ?> </td> <?php $task = JRequest::getString("jevtask"); if ($cfg->get('com_print_icon_view', 1)) { $print_link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink() . '&pop=1' . '&tmpl=component'; $print_link = JRoute::_($print_link); if ($pop) { ?> <td width="20" class="buttonheading" align="right"> <a href="javascript:void(0);" onclick="javascript:window.print(); return false;" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <?php echo JEVHelper::imagesite('printButton.png', JText::_('JEV_CMN_PRINT')); ?> </a> </td> <?php } else { ?> <td width="20" class="buttonheading" align="right"> <a href="javascript:void(0);" onclick="window.open('<?php echo $print_link; ?> ', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=600,height=600,directories=no,location=no');" title="<?php echo JText::_('JEV_CMN_PRINT'); ?> "> <?php echo JEVHelper::imagesite('printButton.png', JText::_('JEV_CMN_PRINT')); ?> </a> </td> <?php } } if ($cfg->get('com_email_icon_view', 1)) { $task = JRequest::getString("jevtask"); $link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . ($evid ? '&evid=' . $evid : '') . ($jevtype ? '&jevtype=' . $jevtype : '') . ($view->year ? '&year=' . $view->year : '') . ($view->month ? '&month=' . $view->month : '') . ($view->day ? '&day=' . $view->day : '') . $view->datamodel->getItemidLink() . $view->datamodel->getCatidsOutLink(); $link = JRoute::_($link); if (strpos($link, "/") === 0) { $link = substr($link, 1); } $link = JURI::root() . $link; require_once JPATH_SITE . '/' . 'components' . '/' . 'com_mailto' . '/' . 'helpers' . '/' . 'mailto.php'; $url = JRoute::_('index.php?option=com_mailto&tmpl=component&link=' . MailToHelper::addLink($link)); $path = version_compare(JVERSION, "1.6.0", 'ge') ? "media/system/images" : '/images/M_images/'; ?> <td width="20" class="buttonheading" align="right"> <a href="javascript:void(0);" onclick="javascript:window.open('<?php echo $url; ?> ','emailwin','width=400,height=350,menubar=yes,resizable=yes'); return false;" title="<?php echo JText::_('EMAIL'); ?> "> <?php echo JEVHelper::imagesite('emailButton.png', JText::_('EMAIL')); ?> </a> </td> <?php } ?> </tr> </table> <div class="jev_month_premods"><?php $view->loadModules("jevprejevents2"); $view->loadModules("jevprejevents2_" . $task); ?> </div> <table class="contentpaneopen jeventpage<?php echo $params->get('pageclass_sfx'); echo $params->get("darktemplate", 0) ? " jeventsdark" : "jeventslight "; echo $lang->isRTL() ? " jevrtl" : " "; ?> " id="jevents_body"> <tr> <td width="100%"> <?php }