本文整理汇总了PHP中EasyBlogRouter类的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogRouter类的具体用法?PHP EasyBlogRouter怎么用?PHP EasyBlogRouter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EasyBlogRouter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHTML
/**
*
* $filtering
* if index page:
* category_id
* filter
* sort
* query
*/
public function toHTML($viewpage = 'index', $doReplace = false)
{
$data = $this->getData();
if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == '1' || $this->get('pages.total') == 0) {
return false;
}
$queries = '';
if (!empty($data) && $doReplace) {
$curPageLink = 'index.php?option=com_easyblog&view=' . $viewpage . $queries;
foreach ($data->pages as $page) {
if (!empty($page->link)) {
$limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
$page->link = EasyBlogRouter::_($curPageLink . $limitstart);
}
}
// newer link
if (!empty($data->next->link)) {
$limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
$data->next->link = EasyBlogRouter::_($curPageLink . $limitstart);
}
// older link
if (!empty($data->previous->link)) {
$limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
$data->previous->link = EasyBlogRouter::_($curPageLink . $limitstart);
}
}
$theme = new CodeThemes();
$theme->set('data', $data);
return $theme->fetch('blog.pagination.php');
}
示例2: display
function display($tmpl = null)
{
$config = EasyBlogHelper::getConfig();
$id = JRequest::getCmd('id', '0');
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($id);
// private category shouldn't allow to access.
$privacy = $category->checkPrivacy();
if (!$privacy->allowed) {
return;
}
$catIds = array();
$catIds[] = $category->id;
EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
$model = $this->getModel('Blog');
$posts = $model->getBlogsBy('category', $catIds);
$weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
$weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->title)));
$weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=categories&id=' . $id . '&format=weever', false, true));
$weever->set('thisPage', 1);
$weever->set('lastPage', 1);
if ($posts) {
foreach ($posts as $post) {
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($post->id);
$weever->addChild($blog);
}
}
$weever->toJSON(true, JRequest::getVar('callback'));
}
示例3: load
public function load($cid)
{
static $instances = array();
if (!isset($instances[$cid])) {
$this->_item = EasyBlogHelper::getTable('Blog', 'Table');
if (!$this->_item->load($cid)) {
return $this->onLoadArticleError($cid);
}
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($this->_item->created_by);
$this->_item->blogger = $blogger;
$link = 'index.php?option=com_easyblog&view=entry&id=' . $this->getContentId();
// forcefully get item id if request is ajax
$format = JRequest::getString('format', 'html');
if ($format === 'ajax') {
$itemid = JRequest::getInt('pageItemId');
if (!empty($itemid)) {
$link .= '&Itemid=' . $itemid;
}
}
$link = EasyBlogRouter::_($link);
$this->_item->permalink = $this->prepareLink($link);
$instances[$cid] = $this->_item;
}
$this->_item = $instances[$cid];
return $this;
}
示例4: links
function links($rows, $team)
{
?>
<ul class="eblog_entry_links_list">
<?php
for ($i = 1; $i < count($rows); $i++) {
?>
<?php
$item = $rows[$i];
?>
<li>
<a href="<?php
echo EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->id);
?>
">
<?php
echo JString::strlen($item->title) > 30 ? JString::substr(strip_tags($item->title), 0, 30) . '...' : strip_tags($item->title);
?>
</a>
<span><?php
echo JString::strlen($item->content) > 100 ? JString::substr(strip_tags($item->content), 0, 100) . '...' : strip_tags($item->content);
?>
</span>
</li>
<?php
}
//end for
?>
</ul>
<?php
}
示例5: addCard
public static function addCard(&$blog, $rawIntroText)
{
$cfg = EasyBlogHelper::getConfig();
// @rule: Check if user really wants to append the opengraph tags on the headers.
if (!$cfg->get('main_twitter_cards')) {
return false;
}
// Get the absolute permalink for this blog item.
$url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
// Get the image of the blog post.
$image = self::getImage($blog, $rawIntroText);
// @task: Get Joomla's document object.
$doc = JFactory::getDocument();
// Add card definition.
$doc->addCustomTag('<meta property="twitter:card" content="summary" />');
$doc->addCustomTag('<meta property="twitter:url" content="' . $url . '" />');
$doc->addCustomTag('<meta property="twitter:title" content="' . $blog->title . '" />');
$text = EasyBlogHelper::stripEmbedTags($rawIntroText);
$text = strip_tags($text);
$text = str_ireplace("\r\n", "", $text);
// Remove any " in the content as this would mess up the headers.
$text = str_ireplace('"', '', $text);
$maxLength = 137;
if (!empty($maxLength)) {
$text = JString::strlen($text) > $maxLength ? JString::substr($text, 0, $maxLength) . '...' : $text;
}
$text = EasyBlogStringHelper::escape($text);
$doc->addCustomTag('<meta property="twitter:description" content="' . $text . '" />');
if ($image) {
$doc->addCustomTag('<meta property="twitter:image" content="' . $image . '"/> ');
}
return true;
}
示例6: store
public function store()
{
// @task: Load language file from the front end.
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$this->clear($this->draft_id);
// @rule: Send notification to the author of the post.
$draft = EasyBlogHelper::getTable('Draft');
$draft->load($this->draft_id);
$author = EasyBlogHelper::getTable('Profile');
$author->load($draft->created_by);
$data['blogTitle'] = $draft->title;
$data['blogAuthor'] = $author->getName();
$data['blogAuthorAvatar'] = $author->getAvatar();
$data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true);
$data['blogAuthorEmail'] = $author->user->email;
$data['rejectMessage'] = $this->message;
// If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
$sh404exists = EasyBlogRouter::isSh404Enabled();
if (JFactory::getApplication()->isAdmin() && $sh404exists) {
$data['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id;
}
$emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED');
$obj = new StdClass();
$obj->unsubscribe = false;
$obj->email = $author->user->email;
$emails = array($obj);
$notification = EasyBlogHelper::getHelper('Notification');
$notification->send($emails, $emailTitle, 'email.blog.rejected', $data);
return parent::store();
}
示例7: 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;
}
示例8: display
function display($tmpl = null)
{
$config = EasyBlogHelper::getConfig();
$jConfig = EasyBlogHelper::getJConfig();
if (!$config->get('main_rss')) {
return;
}
$model = $this->getModel('Featured');
$data = $model->getFeaturedBlog();
$document = JFactory::getDocument();
$document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=featured');
$document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE'));
$document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root()));
if (!empty($data)) {
for ($i = 0; $i < count($data); $i++) {
$row =& $data[$i];
$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;
//read more for feed
$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);
$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 = $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);
}
}
}
示例9: getItemId
public function getItemId()
{
$id = '';
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$id = '&Itemid=' . EasyBlogRouter::getItemId('latest');
}
return $id;
}
示例10: mapPost
public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array())
{
$config = EasyBlogHelper::getConfig();
$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;
}
}
$blog->created = $created->toMySQL();
$blog->text = $row->intro . $row->content;
$config->set('max_video_width', 320);
$config->set('max_video_width', 180);
$blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text);
$blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text);
$category = EasyBlogHelper::getTable('Category', 'Table');
$category->load($row->category_id);
$item = new PostSimpleSchema();
$item->textplain = $blog->text;
// @TODO : Take care of a case when strip tags and length are used together
if ($strip_tags) {
$item->textplain = strip_tags($blog->text, $strip_tags);
}
if ($text_length > 0) {
$pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
$item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
}
$image_data = json_decode($blog->image);
$item->postid = $blog->id;
$item->title = $blog->title;
$item->text = $blog->text;
$item->textplain = $this->sanitize($item->textplain);
$item->image = $blog->getImage();
$item->image->url = $image_data->url;
$item->created_date = $blog->created;
$item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created);
$item->author->name = $profile->nickname;
$item->author->photo = JURI::root() . $profile->avatar;
$item->category->categoryid = $category->id;
$item->category->title = $category->title;
$item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/');
// Tags
$modelPT = EasyBlogHelper::getModel('PostTag');
$item->tags = $modelPT->getBlogTags($blog->id);
foreach ($skip as $v) {
unset($item->{$v});
}
return $item;
}
示例11: getFeedURL
/**
* Appends the necessary rss fragments on existing url
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function getFeedURL($url, $atom = false, $type = 'site')
{
if ($this->config->get('main_feedburner') && $type == 'site' && $this->config->get('main_feedburner_url') != '') {
return $this->config->get('main_feedburner_url');
}
$join = EasyBlogRouter::isSefEnabled() ? '?' : '&';
// Append the necessary queries
$url = EBR::_($url) . $join . 'format=feed';
$url .= $atom ? '&type=atom' : '&type=rss';
return $url;
}
示例12: 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');
}
示例13: _getMenuItemId
public static function _getMenuItemId($post, &$params)
{
$itemId = '';
$routeTypeCategory = false;
$routeTypeBlogger = false;
$routeTypeTag = false;
$routingType = $params->get('routingtype', 'default');
if ($routingType != 'default') {
switch ($routingType) {
case 'menuitem':
$itemId = $params->get('menuitemid') ? '&Itemid=' . $params->get('menuitemid') : '';
break;
case 'category':
$routeTypeCategory = true;
break;
case 'blogger':
$routeTypeBlogger = true;
break;
case 'tag':
$routeTypeTag = true;
break;
default:
break;
}
}
if ($routeTypeCategory) {
$xid = EasyBlogRouter::getItemIdByCategories($post->category_id);
} else {
if ($routeTypeBlogger) {
$xid = EasyBlogRouter::getItemIdByBlogger($post->created_by);
} else {
if ($routeTypeTag) {
$tags = self::_getPostTagIds($post->id);
if ($tags !== false) {
foreach ($tags as $tag) {
$xid = EasyBlogRouter::getItemIdByTag($tag);
if ($xid !== false) {
break;
}
}
}
}
}
}
if (!empty($xid)) {
// lets do it, do it, do it, lets override the item id!
$itemId = '&Itemid=' . $xid;
}
return $itemId;
}
示例14: __construct
/**
* Class Constructor
*
* @since 3.7
* @access public
*/
public function __construct($sel_theme = null)
{
$config = EasyBlogHelper::getConfig();
$this->user_theme = $config->get('layout_theme');
// Default theme
$theme = 'default';
if (empty($sel_theme)) {
$theme = $config->get('layout_theme');
} elseif ($sel_theme == 'dashboard') {
$theme = $config->get('layout_dashboard_theme');
$this->dashboard = true;
}
$this->_theme = $theme;
$obj = new stdClass();
$obj->config = EasyBlogHelper::getConfig();
$obj->my = JFactory::getUser();
$obj->admin = EasyBlogHelper::isSiteAdmin();
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($obj->my->id);
$profile->setUser($obj->my);
$obj->profile = $profile;
$currentTheme = $this->_theme;
if (JRequest::getVar('theme', '') != '') {
$currentTheme = JRequest::getVar('theme');
}
// Legacy fix
if ($currentTheme == 'hako - new') {
$currentTheme = 'default';
}
// @rule: Set the necessary parameters here.
$rawParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.xml';
if (JFile::exists($rawParams) && !$this->dashboard) {
$this->params = EasyBlogHelper::getRegistry();
// @task: Now we bind the default params
$defaultParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.ini';
if (JFile::exists($defaultParams)) {
$this->params->load(JFile::read($defaultParams));
}
$themeConfig = $this->_getThemeConfig($currentTheme);
// @task: Now we override it with the user saved params
if (!empty($themeConfig->params)) {
$extendObj = EasyBlogHelper::getRegistry($themeConfig->params);
EasyBlogRegistryHelper::extend($this->params, $extendObj);
}
}
//is blogger mode flag
$obj->isBloggerMode = EasyBlogRouter::isBloggerMode();
$this->set('system', $obj);
$this->acl = EasyBlogACLHelper::getRuleSet();
}
示例15: request
function request()
{
$mainframe = JFactory::getApplication();
if (!EasyBlogHelper::isLoggedIn()) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
return;
}
$redirect = JRequest::getVar('redirect', '');
$type = JRequest::getCmd('type');
if (!empty($redirect)) {
$redirect = '&redirect=' . $redirect;
}
$userId = JRequest::getVar('id');
// Flickr integration does not require user id.
if (empty($userId)) {
$mainframe->enqueueMessage(JText::_('Error, User not found.'), 'error');
$redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
$this->setRedirect($redirect);
return;
}
$call = JRequest::getWord('call');
$callUri = !empty($call) ? '&call=' . $call . '&id=' . $userId : '&id=' . $userId;
$config = EasyBlogHelper::getConfig();
$key = $config->get('integrations_' . $type . '_api_key');
$secret = $config->get('integrations_' . $type . '_secret_key');
$callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=oauth&task=grant&type=' . $type . $redirect . $callUri;
$consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
$request = $consumer->getRequestToken();
if (empty($request->token) || empty($request->secret)) {
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
$redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
$this->setRedirect($redirect);
return;
}
$oauth = EasyBlogHelper::getTable('Oauth', 'Table');
$oauth->user_id = $userId;
$oauth->type = $type;
$oauth->created = EasyBlogHelper::getDate()->toMySQL();
// Bind the request tokens
$param = EasyBlogHelper::getRegistry('');
$param->set('token', $request->token);
$param->set('secret', $request->secret);
$oauth->request_token = $param->toString();
$oauth->store();
$this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
}