本文整理汇总了PHP中EB::template方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::template方法的具体用法?PHP EB::template怎么用?PHP EB::template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::template方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderAudioPlayer
/**
* Renders audio player for the blog
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function renderAudioPlayer($uri, $options = array())
{
// Merge the options with the default options
$options = array_replace_recursive(self::$defaultAudioOptions, $options);
// Generate a random uid
$uniqid = uniqid();
$uid = 'audio-' . EBMM::getHash($uri . $uniqid);
// Url to the audio
$url = $this->normalizeURI($uri);
// Get the track if there is no track provided
if (!$options['track']) {
$options['track'] = basename($url);
}
// Set a default artist if artist isn't set
if (!$options['artist']) {
$options['artist'] = JText::_('COM_EASYBLOG_BLOCKS_AUDIO_ARTIST');
}
$template = EB::template();
$template->set('uid', $uid);
$template->set('showTrack', $options['showTrack']);
$template->set('showDownload', $options['showDownload']);
$template->set('showArtist', $options['showArtist']);
$template->set('autoplay', $options['autoplay']);
$template->set('loop', $options['loop']);
$template->set('artist', $options['artist']);
$template->set('track', $options['track']);
$template->set('url', $url);
$output = $template->output('site/blogs/blocks/audio');
return $output;
}
示例2: jomsocialForm
private function jomsocialForm($external, $groupId = '0', $blogSource = '', $isPending = 0)
{
$my = JFactory::getUser();
$file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
//extra checking incase somewhere still passing empty blogSource.
$blogSource = empty($blogSource) ? 'group' : $blogSource;
if (!JFile::exists($file)) {
return false;
}
require_once $file;
$model = CFactory::getModel('groups');
if (EasyBlogHelper::isSiteAdmin() && $isPending) {
$rows = $model->getAllGroups();
} else {
$rows = $model->getGroups($my->id, null, false);
}
$groups = array();
JTable::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'tables');
foreach ($rows as $row) {
$group = JTable::getInstance('Group', 'CTable');
$group->load($row->id);
$data = new stdClass();
$data->id = $group->id;
$data->title = $group->name;
$data->avatar = $group->getAvatar();
$groups[] = $data;
}
$theme = EB::template();
$theme->set('blogSource', $blogSource);
$theme->set('external', $external);
$theme->set('groups', $groups);
$theme->set('groupId', $groupId);
return $theme->output('site/jomsocial/groups');
}
示例3: map
public function map(&$file, $index, &$contents)
{
// Store the file to a temporary location
$file['tmp_name'] = $this->tmp . '/' . md5($file['name']);
JFile::write($file['tmp_name'], $file['data']);
// Load up media manager now
$mm = EB::mediamanager();
$result = $mm->upload($file, 'user:' . $this->authorId);
$title = $file['name'];
$url = $this->absoluteUrl . '/' . $file['name'];
// Get the properties from media manager result
if (is_object($result) && property_exists($result, 'title')) {
$title = $result->title;
$url = $result->url;
}
// Once the attachment is already uploaded, we want to delete the temporary file now
JFile::delete($file['tmp_name']);
// Check if a file id is provided in the email
if (isset($file['id']) && !empty($file['id'])) {
$fileId = $file['id'];
$fileId = str_replace('<', '', $fileId);
$fileId = str_replace('>', '', $fileId);
$patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si');
$replace = array('', '');
$contents = preg_replace($patterns, $replace, $contents);
}
// Now we need to insert the pdf links into the content
$template = EB::template();
$template->set('title', $title);
$template->set('url', $url);
$output = $template->output('site/mailpublishing/template.pdf');
$contents .= $output;
}
示例4: getAjaxTemplate
public function getAjaxTemplate()
{
$files = JRequest::getVar('names', '');
if (empty($files)) {
return false;
}
// Ensure the integrity of each items submitted to be an array.
if (!is_array($files)) {
$files = array($files);
}
$result = array();
$template = EB::template();
foreach ($files as $file) {
$dashboard = explode('/', $file);
if ($dashboard[0] == "dashboard") {
$out = $template->output('site/dashboard/' . $dashboard[1] . '.ejs');
} elseif ($dashboard[0] == "media") {
$out = $template->output('site/media/' . $dashboard[1] . '.ejs');
} else {
$out = $template->output('site/' . $file . '.ejs');
}
$obj = new stdClass();
$obj->name = $file;
$obj->content = $out;
$result[] = $obj;
}
header('Content-type: text/x-json; UTF-8');
$json = new Services_JSON();
echo $json->encode($result);
exit;
}
示例5: html
/**
* Outputs the html code for Facebook button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
// If this is a frontpage, ensure that show in frontpage is enabled
if ($this->frontpage && !$this->config->get('main_facebook_like_frontpage', $this->config->get('social_show_frontpage'))) {
return;
}
// Get the button size
$size = $this->getButtonSize();
// Get standard properties
$locale = $this->getLocale();
$width = $this->config->get('main_facebook_like_width');
$verb = $this->config->get('main_facebook_like_verb');
$fbTheme = $this->config->get('main_facebook_like_theme');
$send = $this->config->get('main_facebook_like_send');
// Get the permalink to the blog post.
$url = $this->post->getExternalPermalink();
// Determines if we should track with analytics
$tracking = $this->config->get('main_facebook_analytics');
// Generate a placeholder
$placeholder = $this->getPlaceholderId();
$theme = EB::template();
$theme->set('size', $size);
$theme->set('placeholder', $placeholder);
$theme->set('url', $url);
$theme->set('locale', $locale);
$theme->set('verb', $verb);
$theme->set('fbTheme', $fbTheme);
$theme->set('send', $send);
$theme->set('tracking', $tracking);
$output = $theme->output('site/socialbuttons/facebook');
return $output;
}
示例6: html
/**
* Outputs the html code for Twitter button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
// If this is a frontpage, ensure that show in frontpage is enabled
if ($this->frontpage && !$this->config->get('main_twitter_button_frontpage', $this->config->get('social_show_frontpage'))) {
return;
}
// Get the button size
$size = $this->getButtonSize();
// Get the via text
$via = $this->config->get('main_twitter_button_via_screen_name', '');
if ($via) {
$via = JString::substr($via, 1);
}
// Get the absolute url to this blog post
$url = $this->getUrl();
// Ge the formatted title to this blog post
$title = $this->getTitle();
// Twitter's sharing shouldn't have urlencoded values
$title = urldecode($title);
// Remove unwanted character inside url to avoid incorrect url sharing
$title = str_replace('"', '', $title);
// Determines if we should track with analytics
$tracking = $this->config->get('main_twitter_analytics');
$placeholder = $this->getPlaceholderId();
$theme = EB::template();
$theme->set('tracking', $tracking);
$theme->set('size', $size);
$theme->set('via', $via);
$theme->set('placeholder', $placeholder);
$theme->set('url', $url);
$theme->set('title', $title);
$output = $theme->output('site/socialbuttons/twitter');
return $output;
}
示例7: html
/**
* Outputs the html code for Twitter button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
if (!$this->isEnabled()) {
return;
}
$this->addScript();
// Get the pinterest button style from the configuration
$size = $this->getButtonSize();
$url = EBR::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $this->post->id, false, true);
// Combine the introtext and the content
$content = $this->post->intro . $this->post->content;
// Get the media
$media = $this->getMedia();
$contentLength = 350;
$text = $this->post->intro . $this->post->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;
$title = $this->post->title;
// Urlencode all the necessary properties.
$url = urlencode($url);
$text = urlencode($text);
$media = urlencode($media);
$placeholder = $this->getPlaceholderId();
$theme = EB::template();
$theme->set('size', $size);
$theme->set('placeholder', $placeholder);
$theme->set('url', $url);
$theme->set('title', $title);
$theme->set('media', $media);
$theme->set('text', $text);
$output = $theme->output('site/socialbuttons/pinterest');
return $output;
}
示例8: data
public function data()
{
$theme = EB::template();
$content = $theme->output('site/composer/blocks/handlers/text/html');
$data = (object) array('content' => $content);
return $data;
}
示例9: html
/**
* Outputs the html code for Twitter button
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html()
{
// If this is a frontpage, ensure that show in frontpage is enabled
if (!$this->isEnabled()) {
return;
}
// The default button size
$size = $this->getButtonSize();
$placeholder = $this->getPlaceholderId();
// Add the script
$this->addScript();
// Get the absolute url to this blog post
$url = $this->getUrl();
// Ge the formatted title to this blog post
$title = $this->getTitle();
// Get the desc
$desc = $this->getDescription();
// Get the blog image
$image = $this->getImage();
$theme = EB::template();
$apiKey = $this->config->get('main_vk_api');
$theme->set('apiKey', $apiKey);
$theme->set('url', $url);
$theme->set('title', $title);
$theme->set('desc', $desc);
$theme->set('image', $image);
$theme->set('size', $size);
$theme->set('placeholder', $placeholder);
$output = $theme->output('site/socialbuttons/vk');
return $output;
}
示例10: voters
/**
* Displays a list of voters
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function voters()
{
// Get the composite keys
$uid = $this->input->get('uid', 0, 'int');
$type = $this->input->get('type', '', 'cmd');
// Get maximum number of voters to show up in the dialog.
$limit = EB::config()->get('main_ratings_display_raters_max');
// Get the ratings
$model = EB::model('Ratings');
$votes = $model->getRatingUsers($uid, $type, $limit);
// Determines the total number of guest votes
$totalGuests = 0;
// Format the votes
if ($votes) {
foreach ($votes as &$vote) {
$vote->user = false;
if ($vote->created_by) {
$user = EB::user($vote->created_by);
$vote->user = $user;
} else {
$totalGuests += 1;
}
}
}
$theme = EB::template();
$theme->set('totalGuests', $totalGuests);
$theme->set('votes', $votes);
$output = $theme->output('site/ratings/dialog.voters');
return $this->ajax->resolve($output);
}
示例11: toHTML
/**
* Displays the pagination links at the bottom of the page.
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function toHTML($view = 'index', $replace = false)
{
// Retrieve the pagination data.
$data = $this->getData();
// If there's no pagination at all, skip this
if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == 1 || $this->get('pages.total') == 0) {
return false;
}
$queries = '';
if (!empty($data) && $replace) {
$currentPageLink = 'index.php?option=com_easyblog&view=' . $view . $queries;
foreach ($data->pages as $page) {
if (!empty($page->link)) {
$limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
$page->link = EBR::_($currentPageLink . $limitstart);
}
}
if (!empty($data->next->link)) {
$limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
$data->next->link = EBR::_($currentPageLink . $limitstart);
}
if (!empyt($data->previous->link)) {
$limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
$data->previous->link = EBR::_($currentPageLink . $limitstart);
}
}
$template = EB::template();
$template->set('data', $data);
return $template->output('site/blogs/pagination/default');
}
示例12: html
/**
* Renders the maps for a blog post
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html(EasyBlogPost &$post)
{
static $loaded = false;
if (!$post->hasLocation()) {
return;
}
$language = $this->config->get('main_locations_blog_language');
if (!$loaded) {
$this->doc->addScript('https://maps.googleapis.com/maps/api/js?sensor=true&language=' . $language);
}
// Get the map configuration
$static = $this->config->get('main_locations_static_maps');
$type = $this->config->get('main_locations_map_type');
$maxZoom = $this->config->get('main_locations_max_zoom_level');
$minZoom = $this->config->get('main_locations_min_zoom_level');
$defaultZoom = $this->config->get('main_locations_default_zoom_level', '17');
// Generate a unique id
$uid = uniqid();
$template = EB::template();
$template->set('uid', $uid);
$template->set('defaultZoom', $defaultZoom);
$template->set('minZoom', $minZoom);
$template->set('maxZoom', $maxZoom);
$template->set('defaultZoom', $defaultZoom);
$template->set('type', $type);
$template->set('language', $language);
$template->set('post', $post);
$namespace = 'site/maps/static';
if (!$this->config->get('main_locations_static_maps')) {
$namespace = 'site/maps/interactive';
}
$output = $template->output($namespace);
return $output;
}
示例13: html
/**
* New method to retrieve ratings form
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function html(EasyBlogPost $post, $elementId, $text = '', $disabled = false)
{
// If ratings has been disabled, do not proceed here.
if (!$this->config->get('main_ratings')) {
return false;
}
// Generate the hash for the current user
$hash = !$this->my->guest ? '' : JFactory::getSession()->getId();
// Determines if the current user has already voted
$voted = $post->hasVoted($this->my->id);
$locked = false;
if ($voted || ($this->my->guest && !$this->config->get('main_ratings_guests') || $disabled)) {
$locked = true;
}
// Get the rating value for the post
$value = $post->getRatings();
// Only display ratings on entry view
$entry = $this->input->get('view', '', 'cmd') == 'entry' ? true : false;
$template = EB::template();
$template->set('entry', $entry);
$template->set('voted', $voted);
$template->set('elementId', $elementId);
$template->set('rating', $value->ratings);
$template->set('total', $value->total);
$template->set('locked', $locked);
$template->set('text', $text);
$template->set('uid', $post->id);
$template->set('type', EASYBLOG_RATINGS_ENTRY);
return $template->output('site/ratings/form');
}
示例14: display
public function display($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
//for trigger
$params = $mainframe->getParams('com_easyblog');
$joomlaVersion = EasyBlogHelper::getJoomlaVersion();
$blogId = $this->input->get('id', 0, 'int');
if (empty($blogId)) {
return JError::raiseError(404, JText::_('COM_EASYBLOG_BLOG_NOT_FOUND'));
}
$my = JFactory::getUser();
$blog = EB::table('Blog');
$blog->load($blogId);
$post = EB::post($blogId);
// Check if blog is password protected.
$protected = $this->isProtected($post);
if ($protected !== false) {
return;
}
// If the blog post is already deleted, we shouldn't let it to be accessible at all.
if ($post->isTrashed()) {
return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
}
// Check if the blog post is trashed
if (!$post->isPublished() && $this->my->id != $post->created_by && !EB::isSiteAdmin()) {
return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
}
// Check for team's privacy
$allowed = $this->checkTeamPrivacy($post);
if ($allowed === false) {
return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY'));
}
// Check if the blog post is accessible.
$accessible = $post->isAccessible();
if (!$accessible->allowed) {
echo $accessible->error;
return;
}
// Format the post
$post = EB::formatter('entry', $post);
$tags = $post->getTags();
$theme = EB::template();
$theme->set('post', $post);
$theme->set('tags', $tags);
$blogHtml = $theme->output('site/blogs/entry/pdf');
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$document->setTitle($post->title . $pageTitle);
$document->setName($post->getPermalink());
// Fix phoca pdf plugin.
if (method_exists($document, 'setArticleText')) {
$document->setArticleText($blogHtml);
}
echo $blogHtml;
return;
}
示例15: getFoundryView
/**
* Retrieves a view file
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getFoundryView($name = '', $type = '', $prefix = '', $config = array())
{
$file = $name;
$parts = explode('/', $file);
$template = EB::template();
$output = $template->output($file, array(), 'ejs');
return $output;
}