本文整理汇总了PHP中EasyBlogHelper::formatBlog方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::formatBlog方法的具体用法?PHP EasyBlogHelper::formatBlog怎么用?PHP EasyBlogHelper::formatBlog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::formatBlog方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tmpl = null)
{
$my = JFactory::getUser();
if ($my->id < 1) {
EasyBlogHelper::showLogin();
return;
}
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$acl = EasyBlogACLHelper::getRuleSet();
$config = EasyBlogHelper::getConfig();
$sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($my->id);
// set meta tags for blogger
EasyBlogHelper::setMeta($my->id, META_ID_BLOGGERS);
if (!EasyBlogRouter::isCurrentActiveMenu('myblog', $my->id)) {
$this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger'));
$this->setPathway($blogger->getName());
}
$model = $this->getModel('Blog');
$data = $model->getBlogsBy('blogger', $blogger->id, $sort);
$pagination = $model->getPagination();
$pageNumber = $pagination->get('pages.current');
$pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
$document->setTitle($blogger->getName() . $pageText . EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE')));
$data = EasyBlogHelper::formatBlog($data, false, true, true, true);
if ($config->get('layout_showcomment', false)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$maxComment = $config->get('layout_showcommentcount', 3);
$comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
$comments = EasyBlogHelper::formatBlogCommentsLite($comments);
$row->comments = $comments;
}
}
$rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
//twitter follow me link
$twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id);
$theme = new CodeThemes();
$theme->set('rssURL', $rssURL);
$theme->set('blogger', $blogger);
$theme->set('sort', $sort);
$theme->set('blogs', $data);
$theme->set('currentURL', 'index.php?option=com_easyblog&view=latest');
$theme->set('pagination', $pagination->getPagesLinks());
$theme->set('twitterFollowMelink', $twitterFollowMelink);
$theme->set('my', $my);
$theme->set('acl', $acl);
echo $theme->fetch('blog.blogger.php');
}
示例2: statistic
function statistic()
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
// Add noindex for tags view by default.
$document->setMetadata('robots', 'noindex,follow');
$sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
$bId = JRequest::getCmd('id', '0');
//stats type
$statType = JRequest::getString('stat', '');
$statId = $statType == 'tag' ? JRequest::getString('tagid', '') : JRequest::getString('catid', '');
$statObject = null;
if ($statType == 'category') {
$statObject = EasyBlogHelper::getTable('Category', 'Table');
$statObject->load($statId);
} else {
JTable::addIncludePath(EBLOG_TABLES);
$statObject = EasyBlogHelper::getTable('Tag', 'Table');
$statObject->load($statId);
}
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($bId);
// set meta tags for blogger
if ($acl->rules->allow_seo) {
EasyBlogHelper::setMeta($blogger->id, META_TYPE_BLOGGER, true);
}
if (!EasyBlogRouter::isCurrentActiveMenu('blogger')) {
$this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger'));
}
if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) {
$this->setPathway($blogger->getName());
}
$model = $this->getModel('Blog');
$data = $model->getBlogsBy('blogger', $blogger->id, $sort);
$pagination = $model->getPagination();
$data = EasyBlogHelper::formatBlog($data);
$rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
if ($config->get('layout_showcomment', false)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$maxComment = $config->get('layout_showcommentcount', 3);
$comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
$comments = EasyBlogHelper::formatBlogCommentsLite($comments);
$row->comments = $comments;
}
}
$twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id);
if ($config->get('main_rss')) {
if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger')) {
$document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
} else {
// Add rss feed link
$document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
$document->addHeadLink($blogger->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
}
}
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$pageNumber = $pagination->get('pages.current');
$pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
$statTitle = '';
if (isset($statType)) {
if ($statType == 'tag') {
$statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_TAG', $statObject->title);
} else {
$statTitle = ' - ' . JText::sprintf('COM_EASYBLOG_BLOGGER_STAT_CATEGORY', $statObject->title);
}
}
$document->setTitle($blogger->getName() . $statTitle . $pageText . $pageTitle);
$tpl = new CodeThemes();
$tpl->set('blogger', $blogger);
$tpl->set('sort', $sort);
$tpl->set('blogs', $data);
$tpl->set('config', $config);
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('twitterFollowMelink', $twitterFollowMelink);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('currentURL', ltrim('/', JRequest::getURI()));
$tpl->set('statType', $statType);
$tpl->set('statObject', $statObject);
echo $tpl->fetch('blog.blogger.php');
}
示例3: display
function display($tmpl = null)
{
$config = EasyBlogHelper::getConfig();
$jConfig = EasyBlogHelper::getJConfig();
if (!$config->get('main_rss')) {
return;
}
$mainframe = JFactory::getApplication();
$menuParams = $mainframe->getParams();
$date = EasyBlogHelper::getDate();
$sort = 'latest';
$model = $this->getModel('Archive');
$year = $model->getArchiveMinMaxYear();
$defaultYear = $menuParams->get('es_archieve_year', empty($year['maxyear']) ? $date->toFormat('%Y') : $year['maxyear']);
$defaultMonth = $menuParams->get('es_archieve_month', $date->toFormat('%m'));
$archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST');
$archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST');
$data = EasyBlogHelper::formatBlog($model->getArchive($archiveYear, $archiveMonth));
$pagination = $model->getPagination();
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$document = JFactory::getDocument();
$viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-01');
$document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=archive');
$document->setTitle(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_TITLE', $viewDate->toFormat('%B %Y')));
$document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_ARCHIVE_DESC', $viewDate->toFormat('%B %Y')));
if (!empty($data)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($row->id);
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($row->created_by);
$created = EasyBlogDateHelper::dateWithOffSet($row->created);
$formatDate = true;
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
$langCode = EasyBlogStringHelper::getLangCode();
if ($langCode != 'en-GB' || $langCode != 'en-US') {
$formatDate = false;
}
}
//$row->created = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat();
$row->created = $created->toMySQL();
if ($config->get('main_rss_content') == 'introtext') {
$row->text = !empty($row->intro) ? $row->intro : $row->content;
$row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
} else {
$row->text = $row->intro . $row->content;
}
$row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text);
$row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text);
$image = '';
if ($blog->getImage()) {
$image = '<img src="' . $blog->getImage()->getSource('frontpage') . '" />';
}
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($row->category_id);
// Assign to feed item
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
$item->description = $image . $row->text;
$item->date = $row->created;
$item->category = $category->title;
$item->author = $profile->getName();
if ($jConfig->get('feed_email') == 'author') {
$item->authorEmail = $profile->user->email;
} else {
$item->authorEmail = $jConfig->get('mailfrom');
}
$document->addItem($item);
}
}
}
示例4: tab
public function tab()
{
// always reset the limitstart.
JRequest::setVar('limitstart', 0);
$type = JRequest::getVar('type');
$profileId = JRequest::getVar('id');
$ajax = DiscussHelper::getHelper('ajax');
$model = DiscussHelper::getModel('Posts');
$tagsModel = DiscussHelper::getModel('Tags');
$config = DiscussHelper::getConfig();
$template = new DiscussThemes();
$html = '';
$pagination = null;
switch ($type) {
case 'tags':
$tags = $tagsModel->getTagCloud('', '', '', $profileId);
$template->set('tags', $tags);
$html = $template->fetch('profile.tags.php');
break;
case 'questions':
$posts = $model->getPostsBy('user', $profileId);
$posts = DiscussHelper::formatPost($posts);
$pagination = $model->getPagination();
$template->set('posts', $posts);
$html = $template->fetch('profile.questions.php');
break;
case 'unresolved':
$posts = $model->getUnresolvedFromUser($profileId);
$posts = DiscussHelper::formatPost($posts);
$pagination = $model->getPagination();
$posts = Discusshelper::getPostStatusAndTypes($posts);
$template->set('posts', $posts);
$html = $template->fetch('profile.unresolved.php');
break;
case 'favourites':
if (!$config->get('main_favorite')) {
return false;
}
$posts = $model->getData(true, 'latest', null, 'favourites', '', null, 'all', $profileId);
$posts = DiscussHelper::formatPost($posts);
$posts = Discusshelper::getPostStatusAndTypes($posts);
$template->set('posts', $posts);
$html = $template->fetch('profile.favourites.php');
break;
case 'replies':
$posts = $model->getRepliesFromUser($profileId);
$posts = DiscussHelper::formatPost($posts);
$pagination = $model->getPagination();
$posts = Discusshelper::getPostStatusAndTypes($posts);
$template->set('posts', $posts);
$html = $template->fetch('profile.replies.php');
break;
case 'tabEasyBlog':
$helperFile = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
if (!JFile::exists($helperFile)) {
$html = JText::_('COM_EASYDISCUSS_EASYBLOG_DOES_NOT_EXIST');
} else {
require_once $helperFile;
require_once JPATH_ROOT . '/components/com_easyblog/router.php';
$blogModel = EasyBlogHelper::getModel('Blog');
$blogs = $blogModel->getBlogsBy('blogger', $profileId);
$blogs = EasyBlogHelper::formatBlog($blogs);
$ebConfig = EasyBlogHelper::getConfig();
$user = JFactory::getUser($profileId);
$template->set('user', $user);
$template->set('ebConfig', $ebConfig);
$template->set('blogs', $blogs);
// Load EasyBlog's language file
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$html = $template->fetch('profile.blogs.php');
}
break;
case 'tabKomento':
$helperFile = JPATH_ROOT . '/components/com_komento/helpers/helper.php';
if (!JFile::exists($helperFile)) {
$html = JText::_('COM_EASYDISCUSS_KOMENTO_DOES_NOT_EXIST');
} else {
require_once $helperFile;
$commentsModel = Komento::getModel('comments');
$commentHelper = Komento::getHelper('comment');
$options = array('sort' => 'latest', 'userid' => $profileId, 'threaded' => 0);
$comments = $commentsModel->getComments('all', 'all', $options);
foreach ($comments as &$comment) {
$comment = $commentHelper->process($comment);
}
$feedUrl = Komento::getHelper('router')->getFeedUrl('all', 'all', $profileId);
JFactory::getLanguage()->load('com_komento', JPATH_ROOT);
$template->set('feedUrl', $feedUrl);
$template->set('comments', $comments);
$html = $template->fetch('profile.comments.php');
}
break;
case 'subscriptions':
$subModel = DiscussHelper::getModel('subscribe');
$rows = $subModel->getSubscriptions();
$subs = array();
if ($rows) {
foreach ($rows as $row) {
$obj = new stdClass();
$obj->id = $row->id;
//.........这里部分代码省略.........
示例5: calendar
function calendar($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
//setting pathway
$pathway = $mainframe->getPathway();
if (!EasyBlogRouter::isCurrentActiveMenu('archive')) {
$pathway->addItem(JText::_('COM_EASYBLOG_ARCHIVE_BREADCRUMB'), '');
}
EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=archive');
$menuParams = $mainframe->getParams();
$defaultYear = $menuParams->get('es_archieve_year', 0);
$defaultMonth = $menuParams->get('es_archieve_month', 0);
$archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST');
$archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST');
$archiveDay = JRequest::getVar('archiveday', 0, 'REQUEST');
$itemId = JRequest::getInt('Itemid', 0);
if (empty($archiveYear) || empty($archiveMonth)) {
// @task: Set the page title
$title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE'));
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
$tpl = new CodeThemes();
$tpl->set('itemId', $itemId);
echo $tpl->fetch('calendar.php');
return;
}
$date = EasyBlogHelper::getDate();
$sort = 'latest';
$model = $this->getModel('Archive');
$year = $model->getArchiveMinMaxYear();
$data = $model->getArchive($archiveYear, $archiveMonth, $archiveDay);
$pagination = $model->getPagination();
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$data = EasyBlogHelper::formatBlog($data);
//if day is empty
if (empty($archiveDay)) {
$archiveDay = '01';
$dateformat = '%B %Y';
$emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_MONTH');
} else {
$dateformat = '%d %B %Y';
$emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_DAY');
}
$archiveDay = strlen($archiveDay) < 2 ? '0' . $archiveDay : $archiveDay;
$viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-' . $archiveDay);
$formatedDate = $viewDate->toFormat($dateformat);
$archiveTitle = JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate);
// @task: Set the page title
$title = EasyBlogHelper::getPageTitle(JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate));
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
// set meta tags for featured view
EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
// set meta tags for featured view
EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
$tpl = new CodeThemes();
$tpl->set('data', $data);
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('archiveYear', $archiveYear);
$tpl->set('archiveMonth', $archiveMonth);
$tpl->set('archiveDay', $archiveDay);
$tpl->set('config', $config);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('archiveTitle', $archiveTitle);
$tpl->set('emptyPostMsg', $emptyPostMsg);
echo $tpl->fetch('blog.archive.php');
}
示例6: listings
function listings()
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
$catId = JRequest::getCmd('id', '0');
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($catId);
if ($category->id == 0) {
$category->title = JText::_('COM_EASYBLOG_UNCATEGORIZED');
}
// Set the meta description for the category
EasyBlogHelper::setMeta($category->id, META_TYPE_CATEGORY);
// Set the meta description for the category
// $doc->setMetadata( 'description' , strip_tags( $category->description ) );
//setting pathway
$pathway = $app->getPathway();
$privacy = $category->checkPrivacy();
$addRSS = true;
if (!$privacy->allowed) {
if ($my->id == 0 && !$config->get('main_allowguestsubscribe')) {
$addRSS = false;
}
}
if ($addRSS) {
// Add rss feed link
$doc->addHeadLink($category->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
$doc->addHeadLink($category->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
}
if (!EasyBlogRouter::isCurrentActiveMenu('categories', $category->id)) {
if (!EasyBlogRouter::isCurrentActiveMenu('categories')) {
$this->setPathway(JText::_('COM_EASYBLOG_CATEGORIES_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=categories'));
}
//add the pathway for category
$this->setPathway($category->title, '');
}
//get the nested categories
$category->childs = null;
EasyBlogHelper::buildNestedCategories($category->id, $category, false, true);
// TODO: Parameterize initial subcategories to display. Ability to configure from backend.
$nestedLinks = '';
$initialLimit = $app->getCfg('list_limit') == 0 ? 5 : $app->getCfg('list_limit');
if (count($category->childs) > $initialLimit) {
$initialNestedLinks = '';
$initialRow = new stdClass();
$initialRow->childs = array_slice($category->childs, 0, $initialLimit);
EasyBlogHelper::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');
$moreNestedLinks = '';
$moreRow = new stdClass();
$moreRow->childs = array_slice($category->childs, $initialLimit);
EasyBlogHelper::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');
// Hide more nested links until triggered
$nestedLinks .= $initialNestedLinks;
$nestedLinks .= '<span class="more-subcategories-toggle"> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript: void(0);onclick="eblog.categories.loadMore( this );">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $initialLimit) . '</a></span>';
$nestedLinks .= '<span class="more-subcategories" style="display: none;">, ' . $moreNestedLinks . '</span>';
} else {
EasyBlogHelper::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', ');
}
$catIds = array();
$catIds[] = $category->id;
EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
$category->nestedLink = $nestedLinks;
$modelC = $this->getModel('Category');
$category->cnt = $modelC->getTotalPostCount($category->id);
$modelPT = $this->getModel('PostTag');
$model = $this->getModel('Blog');
$modelCat = $this->getModel('Category');
$data = $model->getBlogsBy('category', $catIds, $sort, null, null, null, null, array(), null, null, null, array(), array(), null, EBLOG_PAGINATION_CATEGORIES);
$pagination = $model->getPagination();
$allowCat = $modelCat->allowAclCategory($category->id);
//for trigger
$params = $app->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
if (!empty($data)) {
$data = EasyBlogHelper::formatBlog($data, false, true, true, true);
if ($config->get('layout_showcomment', false)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$maxComment = $config->get('layout_showcommentcount', 3);
$comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
$comments = EasyBlogHelper::formatBlogCommentsLite($comments);
$row->comments = $comments;
}
}
}
$teamBlogCount = $modelCat->getTeamBlogCount($category->id);
$title = EasyBlogHelper::getPageTitle(JText::_($category->title));
// @task: Set the page title
parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend'));
$themes = new CodeThemes();
$themes->set('allowCat', $allowCat);
$themes->set('category', $category);
$themes->set('sort', $sort);
$themes->set('blogs', $data);
$themes->set('currentURL', 'index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id);
$themes->set('pagination', $pagination->getPagesLinks());
$themes->set('config', $config);
//.........这里部分代码省略.........
示例7: entries
function entries()
{
$mainframe = JFactory::getApplication();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$config = EasyBlogHelper::getConfig();
$document = JFactory::getDocument();
// @rule: Test if the user is currently logged in.
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::showLogin();
return;
}
$title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_ENTRIES_PAGE_TITLE'));
// @task: Set the page title
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
$user = EasyBlogHelper::getTable('Profile', 'Table');
$user->load($my->id);
if (!EasyBlogRouter::isCurrentActiveMenu('dashboard')) {
$this->setPathway(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard'));
}
$this->setPathway(JText::_('COM_EASYBLOG_DASHBOARD_ENTRIES_BREADCRUMB'), '');
$model = $this->getModel('Blogs');
$blogModel = $this->getModel('Blog');
$oauthModel = $this->getModel('Oauth');
$filter = JRequest::getWord('filter', 'all', 'REQUEST');
$search = JRequest::getVar('post-search', false);
// determine whether this user should retrive all blog posts from other bloggers as well or not.
$queryType = 'blogger';
$queryID = $my->id;
if (!empty($acl->rules->moderate_entry)) {
$queryType = '';
$queryID = '';
}
// Detect the current post type.
$postType = JRequest::getVar('postType', 'posts');
$entries = $blogModel->getBlogsBy($queryType, $queryID, 'latest', 0, $filter, $search, '', '', '', true, true, array(), array(), $postType);
$entries = EasyBlogHelper::formatBlog($entries);
$pagination = $blogModel->getPagination();
// @rule: Retrieve total standard blog posts
$postCount = $blogModel->getBlogPostsCount($my->id);
// @rule: Retrieve total micro posts
$microPostCount = $blogModel->getMicroPostsCount($my->id);
// Social sharing
$consumers = array();
$users = array('twitter' => $my->id, 'facebook' => $my->id, 'linkedin' => $my->id);
JTable::addIncludePath(EBLOG_TABLES);
foreach ($users as $type => $id) {
$consumer = EasyBlogHelper::getTable('Oauth', 'Table');
$consumer->loadByUser($id, $type);
$consumers[] = $consumer;
}
echo $this->showToolbar(__FUNCTION__, $user);
$urlType = '';
if (!is_null($postType)) {
$urlType = '&postType=' . $postType;
}
$tpl = new CodeThemes('dashboard');
// Add the breadcrumbs
$breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_POSTS') => '');
$tpl->set('breadcrumbs', $breadcrumbs);
$tpl->set('postType', $postType);
$tpl->set('urlType', $urlType);
$tpl->set('postCount', $postCount);
$tpl->set('microPostCount', $microPostCount);
$tpl->set('consumers', $consumers);
$tpl->set('filter', $filter);
$tpl->set('user', $user);
$tpl->set('entries', $entries);
$tpl->set('pagination', $pagination);
$tpl->set('search', $search);
$tpl->set('config', $config);
echo $tpl->fetch('dashboard.entries.php');
}
示例8: tag
/**
* Display specific tag from the site.
**/
function tag()
{
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$id = JRequest::getVar('id', '', 'REQUEST');
JTable::addIncludePath(EBLOG_TABLES);
// Add noindex for tags view by default.
$document->setMetadata('robots', 'noindex,follow');
$tag = EasyBlogHelper::getTable('Tag', 'Table');
$tag->load($id);
$title = EasyBlogHelper::getPageTitle($tag->title);
// @task: Set the page title
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
// set meta tags for tags view
EasyBlogHelper::setMeta(META_ID_TAGS, META_TYPE_VIEW, JText::_($tag->title) . ' - ' . EasyBlogHelper::getPageTitle($config->get('main_title')));
if (!EasyBlogRouter::isCurrentActiveMenu('tags')) {
$this->setPathway(JText::_('COM_EASYBLOG_TAGS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=tags'));
}
$this->setPathway(JText::_($tag->title));
$blogModel = $this->getModel('Blog');
$tagModel = $this->getModel('Tags');
$rows = $blogModel->getTaggedBlogs($id);
$pagination = $blogModel->getPagination();
$privateBlogCount = 0;
$teamBlogCount = 0;
if ($my->id == 0) {
$privateBlogCount = $tagModel->getTagPrivateBlogCount($id);
}
if (!$config->get('main_includeteamblogpost')) {
$teamBlogCount = $tagModel->getTeamBlogCount($id);
}
//for trigger only
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
if (!empty($rows)) {
$rows = EasyBlogHelper::formatBlog($rows, true, true, true, true);
for ($i = 0; $i < count($rows); $i++) {
$row =& $rows[$i];
$row->category = $blogModel->getCategoryName($row->category_id);
// $row->readmore = JText::_('COM_EASYBLOG_CONTINUE_READING');
if ($config->get('layout_showcomment', false)) {
$maxComment = $config->get('layout_showcommentcount', 3);
$comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
$comments = EasyBlogHelper::formatBlogCommentsLite($comments);
$row->comments = $comments;
}
}
}
$theme = new CodeThemes();
$theme->set('tag', $tag);
$theme->set('rows', $rows);
$theme->set('pagination', $pagination);
$theme->set('currentURL', 'index.php?option=com_easyblog&view=tags&layout=tag&id=' . $tag->id);
$theme->set('privateBlogCount', $privateBlogCount);
$theme->set('teamBlogCount', $teamBlogCount);
echo $theme->fetch('blog.tags.php');
}
示例9:
// Include the engine file.
require_once $file;
// Check if Foundry exists
if (!FD::exists()) {
FD::language()->loadSite();
echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
return;
}
// Include EasyBlog's library
require_once JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
$my = FD::user();
// Load up the module engine
$modules = FD::modules('mod_easysocial_easyblog_posts');
$model = EasyBlogHelper::getModel('Blog');
// Get the module options
$total = (int) $params->get('total', 5);
$sorting = $params->get('sorting', 'latest');
// Let's load the list of posts now
$posts = $model->getBlogsBy('latest', '', $sorting, $total);
// We need to format the blog post accordingly.
$posts = EasyBlogHelper::formatBlog($posts, false, true, true, true);
// Get the author of the blog posts
foreach ($posts as $post) {
$post->user = FD::user($post->created_by);
}
// We need these packages
$modules->addDependency('css', 'javascript');
// Get the layout to use.
$layout = $params->get('layout', 'default');
$suffix = $params->get('suffix', '');
require JModuleHelper::getLayoutPath('mod_easysocial_easyblog_posts', $layout);