本文整理汇总了PHP中EasyBlogHelper::addScriptDeclarationBookmarklet方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::addScriptDeclarationBookmarklet方法的具体用法?PHP EasyBlogHelper::addScriptDeclarationBookmarklet怎么用?PHP EasyBlogHelper::addScriptDeclarationBookmarklet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::addScriptDeclarationBookmarklet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTML
public static function getHTML($row)
{
$config = EasyBlogHelper::getConfig();
if (!$config->get('main_tweetmeme')) {
return '';
}
$service = $config->get('main_tweetmeme_url');
$style = $config->get('main_tweetmeme_style');
$source = $config->get('main_tweetmeme_rtsource');
$buttonSize = 'social-button-';
switch ($style) {
case 'normal':
$buttonSize .= 'large';
break;
case 'compact':
default:
$buttonSize .= 'small';
break;
}
$url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $row->id, false, true);
$title = addslashes($row->title);
$placeholder = 'sb-' . rand();
$html = '<div class="social-button ' . $buttonSize . ' tweetmeme"><span id="' . $placeholder . '"></span></div>';
$html .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("tweetMeme", {
service: "' . $service . '",
style: "' . $style . '",
url: "' . $url . '",
title: "' . $title . '",
source: "' . $source . '"
});');
return $html;
}
示例2: googleone
public function googleone()
{
$config = EasyBlogHelper::getConfig();
$document = JFactory::getDocument();
$frontpage = $this->isFrontend;
$pos = $this->position;
$googleone = !$frontpage && $config->get('main_googleone') || $frontpage && $config->get('main_googleone_frontpage', $config->get('social_show_frontpage')) && $config->get('main_googleone');
$socialFrontEnd = $config->get('main_googleone_frontpage', 0);
$html = '';
if ($googleone) {
$size = $config->get('main_googleone_layout');
$dataURL = $this->_getDataURL();
$dataTitle = $this->_getDataTitle();
$buttonSize = 'social-button-';
switch ($size) {
case 'tall':
$buttonSize .= 'large';
break;
case 'medium':
default:
$buttonSize .= 'small';
break;
}
// Add snippet info into headers
$document = JFactory::getDocument();
$meta = EasyBlogHelper::getTable('Meta', 'Table');
$meta->loadByType(META_TYPE_POST, $this->blog->id);
$document->addCustomTag('<meta itemprop="name" content="' . $this->blog->title . '" />');
if (!empty($meta->description)) {
$meta->description = EasyBlogStringHelper::escape($meta->description);
// Remove JFBConnect codes.
$pattern = '/\\{JFBCLike(.*)\\}/i';
$meta->description = preg_replace($pattern, '', $meta->description);
$document->addCustomTag('<meta itemprop="description" content="' . $meta->description . '" />');
} else {
$maxContentLen = 350;
$text = strip_tags($this->blog->intro . $this->blog->content);
$text = JString::strlen($text) > $maxContentLen ? JString::substr($text, 0, $maxContentLen) . '...' : $text;
// Remove JFBConnect codes.
$pattern = '/\\{JFBCLike(.*)\\}/i';
$text = preg_replace($pattern, '', $text);
$text = EasyBlogStringHelper::escape($text);
$document->addCustomTag('<meta itemprop="description" content="' . $text . '" />');
}
$image = EasyBlogHelper::getFirstImage($this->blog->intro . $this->blog->content);
if ($image !== false) {
$document->addCustomTag('<meta itemprop="image" content="' . $image . '" />');
}
$placeholder = 'sb-' . rand();
$html .= '<div class="social-button ' . $buttonSize . ' google-plusone"><span id="' . $placeholder . '"></span></div>';
// TODO: Verify $socialFrontEnd, what is it used for.
// if( ! $socialFrontEnd )
// $googleHTML .= '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
// $googleHTML .= '<g:plusone size="' . $size . '" href="' . $dataURL . '"></g:plusone>';
if ($this->isBottom) {
$html = '<div class="socialbutton-vertical align' . $pos . '">' . $html . '</div>';
}
$html .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("googlePlusOne", {
href: "' . $dataURL . '",
size: "' . $size . '"
});');
}
return $html;
}
示例3: getHTML
public function getHTML($frontpage, $position, $blog, $teamIdLink)
{
$config = EasyBlogHelper::getConfig();
$enabled = !$frontpage && $config->get('main_pinit_button') || $frontpage && $config->get('main_pinit_button_frontpage', $config->get('social_show_frontpage')) && $config->get('main_pinit_button');
if (!$enabled) {
return false;
}
$style = $config->get('main_pinit_button_style');
$url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
// @task: Test for blog image first.
$image = '';
if ($blog->getImage()) {
$image = $blog->getImage()->getSource('frontpage');
}
if (empty($image)) {
// Fetch the first image of the blog post
$image = EasyBlogHelper::getFirstImage($blog->intro . $blog->content);
// @rule: Test if there's any ->images
if (isset($blog->images) && $blog->images) {
$image = $blog->images[0];
}
}
// @rule: If post doesn't contain any images, do not show button.
if (!$image) {
return false;
}
$buttonSize = 'social-button-';
switch ($style) {
case 'vertical':
$buttonSize .= 'large';
break;
case 'horizontal':
$buttonSize .= 'small';
break;
default:
$buttonSize .= 'plain';
break;
}
// @TODO: Configurable maximum length
$contentLength = 350;
$text = $blog->intro . $blog->content;
$text = nl2br($text);
$text = strip_tags($text);
$text = trim(preg_replace('/\\s+/', ' ', $text));
$text = JString::strlen($text) > $contentLength ? JString::substr($text, 0, $contentLength) . '...' : $text;
$theme = new CodeThemes();
$title = $blog->title;
// Urlencode all the necessary properties.
$url = urlencode($url);
$text = urlencode($text);
$image = urlencode($image);
$placeholder = 'sb-' . rand();
$output = '<div class="social-button ' . $buttonSize . ' pinterest"><span id="' . $placeholder . '"></span></div>';
$output .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("pinterest", {
url: "' . $url . '",
style: "' . $style . '",
media: "' . $image . '",
title: "' . $title . '",
description: "' . $text . '"
});');
return $output;
}
示例4: getLikeHTML
public static function getLikeHTML($row)
{
$config = EasyBlogHelper::getConfig();
if (!$config->get('main_facebook_like')) {
return '';
}
$views = JRequest::getCmd('view', '');
$layout = JRequest::getCmd('layout', '');
if (!$config->get('integrations_facebook_show_in_listing')) {
if ($views == 'latest' || $views == 'blogger' || $views == 'teamblog' || $layout == 'tag' || $views == 'categories' && $layout == 'listings') {
return '';
}
}
$document = JFactory::getDocument();
$language = $document->getLanguage();
$language = explode('-', $language);
if (count($language) != 2) {
$language = array('en', 'GB');
}
$layout = $config->get('main_facebook_like_layout');
$faces = $config->get('main_facebook_like_faces') ? 'true' : 'false';
$width = $config->get('main_facebook_like_width');
$verb = $config->get('main_facebook_like_verb');
$theme = $config->get('main_facebook_like_theme');
$send = $config->get('main_facebook_like_send') ? 'true' : 'false';
$sbPosition = $config->get('main_socialbutton_position');
$fbPosition = $config->get('main_facebook_like_position');
if ($fbPosition == '1') {
$faces = false;
}
require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'router.php';
$url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $row->id, true, true);
// if the layout == box_count, the we hard code it to 50 the with.
$height = $faces == 'true' ? '70' : '30';
$width = $layout == 'standard' ? $width : 'auto';
if ($layout != 'standard' && $send == 'true' && $sbPosition != 'right' && $sbPosition != 'left') {
$width = 'auto';
}
$locale = $language[0] . '_' . JString::strtoupper($language[1]);
$html = '';
$placeholder = 'sb-' . rand();
$html = '<span id="' . $placeholder . '"></span>';
$html .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("facebookLike", {
url: "' . $url . '",
send: "' . $send . '",
layout: "' . $layout . '",
verb: "' . $verb . '",
locale: "' . $locale . '",
faces: "' . $faces . '",
theme: "' . $theme . '",
height: "' . $height . '",
width: "' . $width . '"
});');
return $html;
}