本文整理汇总了PHP中DiscussRouter::getPostRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::getPostRoute方法的具体用法?PHP DiscussRouter::getPostRoute怎么用?PHP DiscussRouter::getPostRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::getPostRoute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addOpenGraph
public function addOpenGraph(DiscussPost $post)
{
// Use facebook developer tools to check the result
// https://developers.facebook.com/tools/debug/og
$doc = JFactory::getDocument();
$config = DiscussHelper::getConfig();
// Search for an image in the content
$image = self::searchImage($post->content);
if ($image) {
$doc->addCustomTag('<meta property="og:image" content="' . $image . '" />');
}
if ($config->get('integration_facebook_like')) {
$appId = $config->get('integration_facebook_like_appid');
if ($appId) {
$doc->addCustomTag('<meta property="fb:app_id" content="' . $appId . '" />');
}
$adminId = $config->get('integration_facebook_like_admin');
if ($adminId) {
$doc->addCustomTag('<meta property="fb:admins" content="' . $adminId . '" />');
}
}
// Add post title info here.
$doc->addCustomTag('<meta property="og:title" content="' . $post->title . '" />');
// Add post content.
$maxContent = 350;
// Remove bbcode tags from the content.
$content = EasyDiscussParser::removeCodes($post->content);
$content = strip_tags($post->content);
if (JString::strlen($content) > $maxContent) {
$content = JString::substr($content, 0, $maxContent) . '...';
}
// Add content to description
$doc->addCustomTag('<meta property="og:description" content="' . $content . '" />');
// Add the type of the og tag.
$doc->addCustomTag('<meta property="og:type" content="article" />');
// Add the URL for this page.
$url = DiscussRouter::getRoutedURL(DiscussRouter::getPostRoute($post->id, false, true));
$doc->addCustomTag('<meta property="og:url" content="' . $url . '" />');
$doc->setTitle($post->title);
$doc->setDescription($content);
return true;
}
示例2:
?>
<?php
} else {
?>
<?php
echo $post->reply->poster_name;
?>
<?php
}
?>
<?php
$lastReply = DiscussHelper::getModel('Posts')->getLastReply($post->id);
?>
<a class="ml-5" href="<?php
echo DiscussRouter::getPostRoute($post->id) . '#' . JText::_('MOD_EASYDISCUSS_REPLY_PERMALINK') . '-' . $lastReply->id;
?>
" title="<?php
echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY');
?>
"><?php
echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY');
?>
</a>
<?php
}
?>
</div>
</div><!-- ft -->
示例3: base64_encode
</li>
</ul>
<?php
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
?>
<input type="hidden" value="com_users" name="option">
<input type="hidden" value="user.login" name="task">
<input type="hidden" name="return" value="<?php
echo base64_encode(DiscussRouter::getPostRoute($post->id, false));
?>
" />
<?php
} else {
?>
<input type="hidden" value="com_user" name="option">
<input type="hidden" value="login" name="task">
<input type="hidden" name="return" value="<?php
echo base64_encode(DiscussRouter::getPostRoute($post->id, false));
?>
" />
<?php
}
?>
<?php
echo JHTML::_('form.token');
?>
</form>
</div>
</div>
</div>
示例4:
"></a>
<div class="discuss-item discussQuestion mt-10 <?php
echo $post->islock ? ' is-locked' : '';
echo !empty($post->password) ? ' is-protected' : '';
echo $post->isresolve ? ' is-resolved' : '';
echo $post->isFeatured() ? ' is-featured' : '';
echo $post->isPollLocked() ? ' is-poll-lock' : '';
?>
" data-id="<?php
echo $post->id;
?>
">
<!-- Discussion title -->
<div class="discuss-item-hd">
<a href="<?php
echo DiscussRouter::getPostRoute($post->id);
?>
" class="">
<h2 class="discuss-post-title pull-left">
<i data-original-title="<?php
echo JText::_('COM_EASYDISCUSS_LOCKED_DESC');
?>
" data-placement="top" rel="ed-tooltip" class="icon-lock"></i>
<?php
if (!empty($post->password)) {
?>
<i data-original-title="<?php
echo JText::_('COM_EASYDISCUSS_PROTECTED_DESC');
?>
" data-placement="top" rel="ed-tooltip" class="icon-key"></i>
<?php
示例5: setPageHeaders
private function setPageHeaders($post)
{
// Set page title.
DiscussHelper::setPageTitle($post->getTitle());
$doc = JFactory::getDocument();
$doc->setMetadata('keywords', $post->title);
$doc->setMetadata('description', preg_replace('/\\s+/', ' ', substr(strip_tags(EasyDiscussParser::bbcode($post->content)), 0, 160)));
// Set canonical link to avoid URL duplication.
$doc->addHeadLink(DISCUSS_JURIROOT . DiscussRouter::getPostRoute($post->id), 'canonical', 'rel');
}
示例6: submit
public function submit()
{
$config = DiscussHelper::getConfig();
$my = JFactory::getUser();
$id = JRequest::getInt('id');
$app = JFactory::getApplication();
$post = DiscussHelper::getTable('Post');
$state = $post->load($id);
$acl = DiscussHelper::getHelper('ACL');
if (!$post->id || !$state) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
// Get the URL to the discussion.
$url = DiscussRouter::getPostRoute($post->id, false);
if ($post->isReply()) {
$url = DiscussRouter::getPostRoute($post->parent_id, false);
}
if (!$acl->allowed('send_report')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_YOU_DO_NOT_HAVE_PERMISION_TO_SUBMIT_REPORT'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
if (!$config->get('main_report')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_HAS_BEEN_DISABLED_BY_ADMINISTRATOR'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
$message = JRequest::getString('reporttext', '');
if (empty($message)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_EMPTY_TEXT'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
$date = DiscussHelper::getDate();
$report = DiscussHelper::getTable('Report');
$report->created_by = $my->id;
$report->post_id = $post->id;
$report->reason = $message;
$report->created = $date->toMySQL();
if (!$report->store()) {
DiscussHelper::setMessageQueue($report->getError(), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
// Mark post as reported.
$report->markPostReport();
$threshold = $config->get('main_reportthreshold', 15);
$totalReports = $report->getReportCount();
$redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED');
// Check if the number of reports for this post exceeded the threshold.
if ($totalReports > $reportThreshold) {
$owner = $post->getOwner();
$date = DiscussHelper::getDate($post->created);
$emailData = array();
$emailData['postContent'] = $post->content;
$emailData['postAuthor'] = $owner->name;
$emailData['postAuthorAvatar'] = $owner->avatar;
$emailData['postDate'] = $date->toFormat();
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_REPORT_REQUIRED_YOUR_ATTENTION', JString::substr($postTbl->content, 0, 15)) . '...';
$emailData['emailTemplate'] = 'email.post.attention.php';
if ($post->isReply()) {
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id, false, true);
}
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
$redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED_BUT_POST_MARKED_AS_REPORT');
}
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED'), DISCUSS_QUEUE_SUCCESS);
$app->redirect($url);
}
示例7:
<?php
if ($system->config->get('layout_profile_roles') && $post->user->getRole()) {
?>
<span class="discuss-role<?php
echo ' ' . $post->user->getRoleLabelClassname();
?>
"><?php
echo $this->escape($post->user->getRole());
?>
</span>
<?php
}
?>
<div>
<a href="<?php
echo DiscussRouter::getPostRoute($post->parent_id) . '#' . JText::_('COM_EASYDISCUSS_REPLY_PERMALINK') . '-' . $post->id;
?>
" title="<?php
echo JText::_('COM_EASYDISCUSS_REPLY_PERMALINK_TO');
?>
" class="muted" style="text-decoration: none;">
<time datetime="<?php
echo $this->formatDate($system->config->get('layout_dateformat', '%A, %B %d %Y, %I:%M %p'), $post->created);
?>
">
<?php
echo $this->formatDate($system->config->get('layout_dateformat', '%A, %B %d %Y, %I:%M %p'), $post->created);
?>
</time>
</a>
</div>
示例8: saveReply
//.........这里部分代码省略.........
// Process custom fields.
$fieldIds = JRequest::getVar('customFields');
if (!empty($fieldIds)) {
foreach ($fieldIds as $fieldId) {
$fields = JRequest::getVar('customFieldValue_' . $fieldId);
if (!empty($fields)) {
// Cater for custom fields select list
// To detect if there is no value selected for the select list custom fields
if (in_array('defaultList', $fields)) {
$tempKey = array_search('defaultList', $fields);
$fields[$tempKey] = '';
}
}
$postTable->bindCustomFields($fields, $fieldId);
}
}
}
// @trigger: onAfterSave
DiscussEventsHelper::onContentAfterSave('post', $postTable, $isNew);
//get parent post
$parentId = $postTable->parent_id;
$parentTable = DiscussHelper::getTable('Post');
$parentTable->load($parentId);
// filtering badwords
$postTable->title = DiscussHelper::wordFilter($postTable->title);
$postTable->content = DiscussHelper::wordFilter($postTable->content);
//all access control goes here.
$canDelete = false;
if (DiscussHelper::isSiteAdmin() || $acl->allowed('delete_reply', '0') || $postTable->user_id == $user->id) {
$canDelete = true;
}
// @rule: URL References
$postTable->references = $postTable->getReferences();
// set for vote status
$voteModel = DiscussHelper::getModel('Votes');
$postTable->voted = $voteModel->hasVoted($postTable->id);
// get total vote for this reply
$postTable->totalVote = $postTable->sum_totalvote;
//load porfile info and auto save into table if user is not already exist in discuss's user table.
$creator = DiscussHelper::getTable('Profile');
$creator->load($postTable->user_id);
$postTable->user = $creator;
//default value
$postTable->isVoted = 0;
$postTable->total_vote_cnt = 0;
$postTable->likesAuthor = '';
$postTable->minimize = 0;
if ($config->get('main_content_trigger_replies')) {
// process content plugins
DiscussEventsHelper::importPlugin('content');
DiscussEventsHelper::onContentPrepare('reply', $postTable);
$postTable->event = new stdClass();
$results = DiscussEventsHelper::onContentBeforeDisplay('reply', $postTable);
$postTable->event->beforeDisplayContent = trim(implode("\n", $results));
$results = DiscussEventsHelper::onContentAfterDisplay('reply', $postTable);
$postTable->event->afterDisplayContent = trim(implode("\n", $results));
}
$theme = new DiscussThemes();
$question = DiscussHelper::getTable('Post');
$question->load($postTable->parent_id);
$recaptcha = '';
$enableRecaptcha = $config->get('antispam_recaptcha');
$publicKey = $config->get('antispam_recaptcha_public');
$skipRecaptcha = $config->get('antispam_skip_recaptcha');
$model = DiscussHelper::getModel('Posts');
$postCount = count($model->getPostsBy('user', $my->id));
if ($enableRecaptcha && !empty($publicKey) && $postCount < $skipRecaptcha) {
require_once DISCUSS_CLASSES . '/recaptcha.php';
$recaptcha = getRecaptchaData($publicKey, $config->get('antispam_recaptcha_theme'), $config->get('antispam_recaptcha_lang'), null, $config->get('antispam_recaptcha_ssl'), 'edit-reply-recaptcha' . $postTable->id);
}
// Get the post access object here.
$category = DiscussHelper::getTable('Category');
$category->load($postTable->category_id);
$access = $postTable->getAccess($category);
$postTable->access = $access;
// Get comments for the post
$commentLimit = $config->get('main_comment_pagination') ? $config->get('main_comment_pagination_count') : null;
$comments = $postTable->getComments($commentLimit);
$postTable->comments = DiscussHelper::formatComments($comments);
$theme->set('question', $question);
$theme->set('post', $postTable);
$theme->set('category', $category);
$html = $theme->fetch('post.reply.item.php');
if ($recaptcha && $public && $private) {
$output['type'] = 'success.captcha';
}
if (!$parentTable->islock) {
$output['type'] = 'locked';
}
$message = $isNew ? JText::_('COM_EASYDISCUSS_POST_STORED') : JText::_('COM_EASYDISCUSS_EDIT_SUCCESS');
$state = 'success';
// Let's set our custom message here.
DiscussHelper::setMessageQueue($message, $state);
$redirect = JRequest::getVar('redirect', '');
if (!empty($redirect)) {
$redirect = base64_decode($redirect);
return $this->setRedirect($redirect);
}
$this->setRedirect(DiscussRouter::getPostRoute($post['parent_id'], false));
}