本文整理汇总了PHP中DiscussRouter::_方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::_方法的具体用法?PHP DiscussRouter::_怎么用?PHP DiscussRouter::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLink
/**
* Retrieves the profile link
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getLink()
{
if (!EB::easydiscuss()->exists()) {
return parent::getLink();
}
$link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->profile->id, false);
return $link;
}
示例2: getFeedURL
public function getFeedURL($url, $atom = false)
{
require_once DISCUSS_HELPERS . '/router.php';
$sef = DiscussRouter::isSefEnabled();
$join = $sef ? '?' : '&';
$url = DiscussRouter::_($url) . $join . 'format=feed';
$url .= $atom ? '&type=atom' : '&type=rss';
return $url;
}
示例3: convert
/**
* Converts a comment into a discussion reply
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function convert()
{
JRequest::checkToken('request') or jexit('Invalid Token');
// Get the Joomla app
$app = JFactory::getApplication();
// Get the comment id from the request.
$id = JRequest::getInt('id');
// Load the comment
$comment = DiscussHelper::getTable('Comment');
$comment->load($id);
if (!$id || !$comment->id) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_COMMENT_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
// Get the post id from the request.
$postId = JRequest::getInt('postId');
$post = DiscussHelper::getTable('Post');
$post->load($postId);
if (!$postId || !$post->id) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
if (!$comment->canConvert()) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_NOT_ALLOWED_TO_CONVERT'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
// Create a new reply.
$reply = DiscussHelper::getTable('Post');
$reply->title = $post->title;
$reply->content = $comment->comment;
$reply->published = 1;
$reply->created = $comment->created;
$reply->parent_id = $post->id;
$reply->user_id = $comment->user_id;
$reply->user_type = 'member';
$reply->category_id = $post->category_id;
$state = $reply->store();
if (!$state) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_ERROR_SAVING_REPLY'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
// Once the reply is stored, delete the comment
$comment->delete();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_SUCCESS_CONVERTED_COMMENT_TO_REPLY'), DISCUSS_QUEUE_SUCCESS);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
示例4: markreadall
/**
* Allows user to mark all their notification items as read
**/
public function markreadall()
{
$my = JFactory::getUser();
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
}
$db = DiscussHelper::getDBO();
$query = 'UPDATE ' . $db->nameQuote('#__discuss_notifications') . ' ' . 'SET ' . $db->nameQuote('state') . '=' . $db->Quote(0) . ' ' . 'WHERE ' . $db->nameQuote('target') . '=' . $db->Quote($my->id);
$db->setQuery($query);
$db->Query();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_ALL_NOTIFICATIONS_MARKED_AS_READ'));
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=notifications', false));
}
示例5: display
function display($tmpl = null)
{
$config = DiscussHelper::getConfig();
if (!$config->get('main_rss')) {
return;
}
$userid = JRequest::getInt('id', null);
$user = JFactory::getUser($userid);
$document = JFactory::getDocument();
$document->link = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $user->id);
$profile = DiscussHelper::getTable('Profile');
$profile->load($user->id);
$document->setTitle($profile->getName());
$document->setDescription($profile->getDescription());
$jConfig = DiscussHelper::getJConfig();
$model = $this->getModel('Posts');
$posts = $model->getPostsBy('user', $profile->id);
$posts = DiscussHelper::formatPost($posts);
foreach ($posts as $row) {
// 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 = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id);
$item->description = $row->content;
$item->date = DiscussHelper::getDate($row->created)->toMySQL();
if (!empty($row->tags)) {
$tagData = array();
foreach ($row->tags as $tag) {
$tagData[] = '<a href="' . JRoute::_('index.php?option=com_easydiscuss&view=tags&id=' . $tag->id) . '">' . $tag->title . '</a>';
}
$row->tags = implode(', ', $tagData);
} else {
$row->tags = '';
}
$item->category = $row->tags;
$item->author = $row->user->getName();
if ($jConfig->get('feed_email') != 'none') {
if ($jConfig->get('feed_email') == 'author') {
$item->authorEmail = $row->user->email;
} else {
$item->authorEmail = $jConfig->get('mailfrom');
}
}
$document->addItem($item);
}
}
示例6: display
public function display($tpl = null)
{
$my = JFactory::getUser();
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
}
$model = $this->getModel('Notification');
$this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_NOTIFICATIONS'));
// Make this configurable?
$limit = 100;
$notifications = $model->getNotifications($my->id, false, $limit);
DiscussHelper::getHelper('Notifications')->format($notifications, true);
$theme = new DiscussThemes();
$theme->set('notifications', $notifications);
echo $theme->fetch('notifications.php');
}
示例7: removeAccess
function removeAccess()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$return = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile', false);
if ($user->id == 0) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_USER_NOT_FOUND'), 'error');
$this->setRedirect($return);
}
$twitter = DiscussHelper::getTable('Twitter');
if (!$twitter->load($user->id)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_DOESNT_EXIST'), 'error');
$this->setRedirect($return);
}
$twitter->delete();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_REQUIRE_AUTHENTICATION'));
$this->setRedirect($return);
}
示例8: listings
public function listings()
{
$app = JFactory::getApplication();
$config = DiscussHelper::getConfig();
$id = JRequest::getInt('id');
if (empty($id)) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=badges', false), JText::_('COM_EASYDISCUSS_INVALID_BADGE'));
$app->close();
}
$badge = DiscussHelper::getTable('Badges');
$badge->load($id);
$this->setPathway(JText::_('COM_EASYDISCUSS_BADGES'), DiscussRouter::_('index.php?option=com_easydiscuss&view=badges'));
$this->setPathway(JText::_($badge->get('title')));
DiscussHelper::setPageTitle(JText::sprintf('COM_EASYDISCUSS_VIEWING_BADGE_TITLE', $this->escape($badge->title)));
$users = $badge->getUsers();
$theme = new DiscussThemes();
$theme->set('badge', $badge);
$theme->set('users', $users);
echo $theme->fetch('badge.php');
}
示例9: defined
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Restricted access');
?>
<div class="fd-cf">
<h2 class="discuss-component-title pull-left"><?php
echo JText::_('COM_EASYDISCUSS_MEMBERS');
?>
</h2>
<div class="discuss-users-search-wrap pull-right">
<div class="input-append">
<form name="discuss-users-search" method="GET" action="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=users');
?>
" style="margin:0;">
<input type="text" class="input-large" placeholder="<?php
echo JText::_('COM_EASYDISCUSS_USERS_SEARCH_PLACEHOLDER');
?>
" name="userQuery" value="<?php
echo DiscussHelper::getHelper('String')->escape($userQuery) ? DiscussHelper::getHelper('String')->escape($userQuery) : '';
?>
" />
<input type="hidden" name="option" value="com_easydiscuss" />
<input type="hidden" name="view" value="users" />
<button class="btn btn-searchbar"><?php
echo JText::_('COM_EASYDISCUSS_SEARCH_BUTTON');
?>
</button>
示例10: getURL
public function getURL($raw = false, $xhtml = false)
{
$url = 'index.php?option=com_easydiscuss&view=profile&id=' . $this->id;
$url = $raw ? $url : DiscussRouter::_($url, $xhtml);
return $url;
}
示例11:
<a class="btn-small" href="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id . '&sort=latest');
?>
#filter-sort">
<?php
echo JText::_('COM_EASYDISCUSS_SORT_LATEST');
?>
</a>
</li>
<li class="<?php
echo $sort == 'oldest' || $sort == 'replylatest' ? 'active' : '';
?>
sortItem secondary-nav">
<a class="btn-small" href="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id . '&sort=oldest');
?>
#filter-sort">
<?php
echo JText::_('COM_EASYDISCUSS_SORT_OLDEST');
?>
</a>
</li>
</ul>
</div>
<?php
echo DiscussHelper::renderModule('easydiscuss-before-replies');
?>
<ul class="unstyled discuss-list clearfix discussionReplies">
<?php
示例12:
?>
"><?php
echo JText::_('COM_EASYDISCUSS_SEE_ALL');
?>
</a>
</div>
</div>
</li>
</ul>
<?php
} else {
?>
<a class="messageLink" href="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation');
?>
">
<i class="icon-envelope-alt"></i>
<span class="label label-notification" id="conversation-count" style="display: <?php
echo $totalMessages > 0 ? 'inline-block' : 'none';
?>
"><?php
echo $totalMessages;
?>
</span>
</a>
<?php
}
?>
示例13: edit
public function edit($tpl = null)
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$my = JFactory::getUser();
$acl = DiscussHelper::getHelper('ACL');
$config = DiscussHelper::getConfig();
// Load post item
$id = JRequest::getInt('id', 0);
if (empty($id)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'));
return;
}
$post = DiscussHelper::getTable('Post');
$post->load($id);
$post->content_raw = $post->content;
$editing = (bool) $post->id;
if (!$editing) {
// try to get from session if there are any.
$this->getSessionData($post);
}
$categoryId = JRequest::getInt('category', $post->category_id);
// Load category item.
$category = DiscussHelper::getTable('Category');
$category->load($categoryId);
// Check if user is allowed to post a discussion, we also need to check against the category acl
if (empty($my->id) && !$acl->allowed('add_question', 0)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_KINDLY_LOGIN_TO_CREATE_A_POST'));
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
$app->close();
return;
}
if ($my->id != 0 && !$acl->allowed('add_question', '0') && !$category->canPost()) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$app->close();
return;
}
// Set the breadcrumbs.
$this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_ASK'));
// Set the page title.
$title = JText::_('COM_EASYDISCUSS_TITLE_ASK');
if ($id && $post->id) {
$title = JText::sprintf('COM_EASYDISCUSS_TITLE_EDIT_QUESTION', $post->getTitle());
}
// Set the page title
DiscussHelper::setPageTitle($title);
if ($editing) {
$isModerator = DiscussHelper::getHelper('Moderator')->isModerator($post->category_id);
if (!DiscussHelper::isMine($post->user_id) && !DiscussHelper::isSiteAdmin() && !$acl->allowed('edit_question') && !$isModerator) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $postid, false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$app->close();
}
$tagsModel = DiscussHelper::getModel('PostsTags');
$post->tags = $tagsModel->getPostTags($post->id);
} else {
if ($categoryId) {
// set the default category
$post->category_id = $categoryId;
}
}
$attachments = $post->getAttachments();
if (isset($post->sessiondata)) {
$attachments = '';
}
$model = DiscussHelper::getModel('Posts');
$postCount = count($model->getPostsBy('user', $my->id));
$onlyPublished = empty($post->id) ? true : false;
// @rule: If there is a category id passed through the query, respect it first.
$showPrivateCat = empty($post->id) && $my->id == 0 ? false : true;
// [model:category]
$categoryModel = $this->getModel('Category');
$defaultCategory = $categoryModel->getDefaultCategory();
if ($categoryId == 0 && $defaultCategory !== false) {
$categoryId = $defaultCategory->id;
}
$nestedCategories = '';
$categories = '';
if ($config->get('layout_category_selection') == 'multitier') {
$categoriesModel = $this->getModel('Categories');
$categories = $categoriesModel->getCategories(array('acl_type' => DISCUSS_CATEGORY_ACL_ACTION_SELECT));
} else {
$nestedCategories = DiscussHelper::populateCategories('', '', 'select', 'category_id', $categoryId, true, $onlyPublished, $showPrivateCat, true);
}
if ($config->get('layout_reply_editor') == 'bbcode') {
// Legacy fix when switching from WYSIWYG editor to bbcode.
$post->content = EasyDiscussParser::html2bbcode($post->content);
}
$editor = '';
if ($config->get('layout_editor') != 'bbcode') {
$editor = JFactory::getEditor($config->get('layout_editor'));
}
// Get list of moderators from the site.
$moderatorList = array();
if ($config->get('main_assign_user')) {
$moderatorList = DiscussHelper::getHelper('Moderator')->getSelectOptions($post->category_id);
}
$composer = new DiscussComposer("editing", $post);
// Set the discussion object.
$access = $post->getAccess($category);
$theme = new DiscussThemes();
//.........这里部分代码省略.........
示例14:
data-editortype="<?php
echo $composer->editorType;
?>
"
data-operation="<?php
echo $composer->operation;
?>
"
>
<div class="alert replyNotification" style="display: none;"></div>
<div class="discuss-story">
<div class="discuss-content">
<form name="dc_submit" autocomplete="off" class="form-horizontal" action="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&controller=posts&task=reply');
?>
" method="post">
<div class="discuss-form">
<?php
if (!$system->my->id) {
?>
<div class="control-group control-group-guest">
<input type="text" name="poster_name" class="input-xlarge" placeholder="<?php
echo JText::_('COM_EASYDISCUSS_GUEST_NAME');
?>
">
<input type="text" name="poster_email" class="input-xlarge" placeholder="<?php
echo JText::_('COM_EASYDISCUSS_GUEST_EMAIL');
示例15: 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;
//.........这里部分代码省略.........