本文整理汇总了PHP中DiscussHelper::getJConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getJConfig方法的具体用法?PHP DiscussHelper::getJConfig怎么用?PHP DiscussHelper::getJConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getJConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$id = JRequest::getInt('id', 0);
$badge = DiscussHelper::getTable('Badges');
$badge->load($id);
if (!$badge->created) {
$date = DiscussHelper::getHelper('Date')->dateWithOffset(DiscussHelper::getDate()->toMySQL());
$badge->created = $date->toMySQL();
}
// There could be some errors here.
if (JRequest::getMethod() == 'POST') {
$badge->bind(JRequest::get('post'));
// Description might contain html codes
$description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
$badge->description = $description;
}
$jConfig = DiscussHelper::getJConfig();
$editor = JFactory::getEditor($jConfig->get('editor'));
$model = $this->getModel('Badges');
$rules = $model->getRules();
$badges = $this->getBadges();
$this->assign('editor', $editor);
$this->assign('badges', $badges);
$this->assign('rules', $rules);
$this->assign('badge', $badge);
parent::display($tpl);
}
示例2: install
public function install()
{
// Request forgeries check
JRequest::checkToken() or die('Invalid Token');
$file = JRequest::getVar('rule', '', 'FILES');
$app = JFactory::getApplication();
$files = array();
// @task: If there's no tmp_name in the $file, we assume that the data sent is corrupted.
if (!isset($file['tmp_name'])) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
// There are various MIME type for compressed file. So let's check the file extension instead.
if ($file['name'] && JFile::getExt($file['name']) == 'xml') {
$files = array($file['tmp_name']);
} else {
$jConfig = DiscussHelper::getJConfig();
$path = rtrim($jConfig->get('tmp_path'), '/') . '/' . $file['name'];
// @rule: Copy zip file to temporary location
if (!JFile::copy($file['tmp_name'], $path)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
jimport('joomla.filesystem.archive');
$tmp = md5(DiscussHelper::getDate()->toMysQL());
$dest = rtrim($jConfig->get('tmp_path'), '/') . '/' . $tmp;
if (!JArchive::extract($path, $dest)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
$files = JFolder::files($dest, '.', true, true);
if (empty($files)) {
// Try to do a level deeper in case the zip is on the outer.
$folder = JFolder::folders($dest);
if (!empty($folder)) {
$files = JFolder::files($dest . '/' . $folder[0], true);
$dest = $dest . '/' . $folder[0];
}
}
if (empty($files)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_RULE_FILE'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
}
if (empty($files)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_RULE_INSTALL_FAILED'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
foreach ($files as $file) {
$this->installXML($file);
}
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_RULE_INSTALL_SUCCESS'), DISCUSS_QUEUE_SUCCESS);
$app->redirect('index.php?option=com_easydiscuss&view=rules&layout=install');
$app->close();
}
示例3: display
public function display($tmpl = null)
{
$config = DiscussHelper::getConfig();
$jConfig = DiscussHelper::getJConfig();
if (!$config->get('main_rss')) {
return;
}
$filteractive = JRequest::getString('filter', 'allposts');
$sort = JRequest::getString('sort', 'latest');
if ($filteractive == 'unanswered' && ($sort == 'active' || $sort == 'popular')) {
//reset the active to latest.
$sort = 'latest';
}
$doc = JFactory::getDocument();
$doc->link = JRoute::_('index.php?option=com_easydiscuss&view=index');
// Load up the tag
$tag = JRequest::getInt('id', 0);
$table = DiscussHelper::getTable('Tags');
$table->load($tag);
// Set the title of the document
$doc->setTitle($table->title);
$doc->setDescription(JText::sprintf('COM_EASYDISCUSS_DISCUSSIONS_TAGGED_IN', $table->title));
$postModel = $this->getModel('Posts');
$posts = $postModel->getTaggedPost($tag, $sort, $filteractive);
$pagination = $postModel->getPagination('0', $sort, $filteractive);
$jConfig = DiscussHelper::getJConfig();
$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');
}
}
$doc->addItem($item);
}
}
示例4: display
function display($tmpl = null)
{
$config = DiscussHelper::getConfig();
if (!$config->get('main_rss')) {
return;
}
$document = JFactory::getDocument();
$document->link = JRoute::_('index.php?option=com_easydiscuss&view=index');
$document->setTitle($this->escape($document->getTitle()));
$sort = JRequest::getString('sort', 'latest');
$filter = JRequest::getString('filter', 'allposts');
$category = JRequest::getInt('category_id', 0);
$postModel = $this->getModel('Posts');
$posts = $postModel->getData(true, $sort, null, $filter, $category);
$pagination = $postModel->getPagination('0', $sort, $filter, $category);
$jConfig = DiscussHelper::getJConfig();
$posts = DiscussHelper::formatPost($posts);
require_once DISCUSS_HELPERS . '/parser.php';
foreach ($posts as $row) {
// Assign to feed item
$title = $this->escape($row->title);
$title = html_entity_decode($title);
$category = DiscussHelper::getTable('Category');
$category->load($row->category_id);
// load individual item creator class
$item = new JFeedItem();
//Problems with other language
//$item->title = htmlentities( $title );
$item->title = $row->title;
$item->link = JRoute::_('index.php?option=com_easydiscuss&view=post&id=' . $row->id);
//$row->content = DiscussHelper::parseContent( $row->content );
if ($row->content_type == 'bbcode') {
$row->content = DiscussHelper::parseContent($row->content);
$row->content = html_entity_decode($row->content);
}
// Problems with other language
//$item->description = htmlentities( $row->content );
$item->description = $row->content;
$item->date = DiscussHelper::getDate($row->created)->toMySQL();
$item->author = $row->user->getName();
$item->category = $category->getTitle();
if ($jConfig->get('feed_email') != 'none') {
if ($jConfig->get('feed_email') == 'author') {
$item->authorEmail = $row->user->user->email;
} else {
$item->authorEmail = $jConfig->get('mailfrom');
}
}
$document->addItem($item);
}
}
示例5: display
function display($tpl = null)
{
//initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$config = DiscussHelper::getConfig();
$mainframe = JFactory::getApplication();
$acl = DiscussHelper::getHelper('ACL');
$filteractive = JRequest::getString('filter', 'allposts');
$query = JRequest::getString('query', '');
$sort = JRequest::getString('sort', 'latest');
$category = JRequest::getInt('category_id', 0);
$postModel = $this->getModel('Posts');
$featuredposts = '';
$featuredpostsHTML = '';
$showFeaturedPost = true;
$posts = $postModel->getData(true, $sort, null, $filteractive, $category, null, $showFeaturedPost);
$pagination = $postModel->getPagination('0', $sort, $filteractive, $category, $showFeaturedPost);
$posts = DiscussHelper::formatPost($posts);
$concatCode = DiscussHelper::getJConfig()->getValue('sef') ? '?' : '&';
$document->addHeadLink(JRoute::_('index.php?option=com_easydiscuss&view=featured') . $concatCode . 'format=feed&type=rss', 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
$document->addHeadLink(JRoute::_('index.php?option=com_easydiscuss&view=featured') . $concatCode . 'format=feed&type=atom', 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
$rssLink = DiscussHelper::getHelper('Feeds')->getFeedURL('index.php?option=com_easydiscuss&view=featured');
$tpl = new DiscussThemes();
$tpl->set('rssLink', $rssLink);
$filterBar = '';
$tpl->set('acl', $acl);
$tpl->set('posts', $posts);
$tpl->set('paginationType', DISCUSS_QUESTION_TYPE);
$tpl->set('parent_id', 0);
$tpl->set('pagination', $pagination);
$tpl->set('sort', $sort);
$tpl->set('filter', $filteractive);
$tpl->set('filterbar', $filterBar);
$tpl->set('query', $query);
$tpl->set('config', $config);
echo $tpl->fetch('featured.php');
}
示例6: getOffSet16
public static function getOffSet16($numberOnly = false)
{
jimport('joomla.form.formfield');
$user = JFactory::getUser();
$config = DiscussHelper::getConfig();
$jConfig = DiscussHelper::getJConfig();
// temporary ignore the dst in joomla 1.6
if ($user->id != 0) {
$userTZ = $user->getParam('timezone');
}
if (empty($userTZ)) {
$userTZ = $jConfig->get('offset');
}
if ($numberOnly) {
$newTZ = new DateTimeZone($userTZ);
$dateTime = new DateTime("now", $newTZ);
$offset = $newTZ->getOffset($dateTime) / 60 / 60;
return $offset;
} else {
//timezone string
return $userTZ;
}
}
示例7: listings
/**
* Displays a list of recent discussions from a particular category.
*
* @since 3.0
* @access public
*/
public function listings()
{
// Initialise variables
$doc = JFactory::getDocument();
$my = JFactory::getUser();
$config = DiscussHelper::getConfig();
$app = JFactory::getApplication();
$registry = DiscussHelper::getRegistry();
$categoryId = JRequest::getInt('category_id', 0);
// Try to detect if there's any category id being set in the menu parameter.
$activeMenu = $app->getMenu()->getActive();
if ($activeMenu) {
// Load menu params to the registry.
$registry->loadString($activeMenu->params);
// Set the active category id if exists.
$categoryId = $registry->get('category_id') ? $registry->get('category_id') : $categoryId;
}
// Get the current logged in user's access.
$acl = DiscussHelper::getHelper('ACL');
// Todo: Perhaps we should fix the confused naming of filter and sort to type and sort
$activeFilter = JRequest::getString('filter', $registry->get('filter'));
$sort = JRequest::getString('sort', $registry->get('sort'));
// Get the pagination limit
$limit = $registry->get('limit');
$limit = $limit == '-2' ? DiscussHelper::getListLimit() : $limit;
$limit = $limit == '-1' ? DiscussHelper::getJConfig()->get('list_limit') : $limit;
// Get the active category id if there is any
$activeCategory = DiscussHelper::getTable('Category');
$activeCategory->load($categoryId);
DiscussHelper::setPageTitle($activeCategory->title);
// Add breadcrumbs for active category.
if ($activeCategory->id != 0) {
// Test if user is really allowed to access this category.
if (!$activeCategory->canAccess()) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$app->close();
return;
}
// Add pathway for category here.
DiscussHelper::getHelper('Pathway')->setCategoryPathway($activeCategory);
}
// Add view to this page.
$this->logView();
// Set the meta of the page.
DiscussHelper::setMeta();
$doc = JFactory::getDocument();
$doc->setMetadata('description', strip_tags($activeCategory->getDescription()));
// Add rss feed into headers
DiscussHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easydiscuss&view=index');
// Get list of categories on the site.
$catModel = $this->getModel('Categories');
// Pagination is by default disabled.
$pagination = false;
if ($categoryId) {
$category = DiscussHelper::getTable('Category');
$category->load($categoryId);
$categories[] = $category;
} else {
$categories = $catModel->getCategories($categoryId);
if (count($categories) > 1) {
$ids = array();
foreach ($categories as $row) {
$ids[] = $row->id;
}
// iniCounts should only called in index page.
$category = DiscussHelper::getTable('Category');
$category->initCounts($ids, true);
}
}
// Get the model.
$postModel = DiscussHelper::getModel('Posts');
$authorIds = array();
$topicIds = array();
for ($i = 0; $i < count($categories); $i++) {
$category =& $categories[$i];
// building category childs lickage.
$category->childs = null;
$nestedLinks = '';
// In category page
if ($config->get('layout_show_all_subcategories', '1')) {
// By default show all the subcategories of the selected category
DiscussHelper::buildNestedCategories($category->id, $category, false, true);
} else {
// Show one level of subcategories of the selected category only
$category->childs = $catModel->getChildCategories($category->id);
}
DiscussHelper::accessNestedCategories($category, $nestedLinks, '0', '', 'listlink', ', ');
$category->nestedLink = $nestedLinks;
// Get featured posts from this particular category.
$featured = $postModel->getDiscussions(array('pagination' => false, 'sort' => $sort, 'filter' => $activeFilter, 'category' => $category->id, 'limit' => $config->get('layout_featuredpost_limit', $limit), 'featured' => true));
// Get normal discussion posts.
$posts = $postModel->getDiscussions(array('sort' => $sort, 'filter' => $activeFilter, 'category' => $category->id, 'limit' => $limit, 'featured' => false));
$tmpPostsArr = array_merge($featured, $posts);
if (count($tmpPostsArr) > 0) {
//.........这里部分代码省略.........
示例8: filter
/**
* Filters discussion based on a given filter
*
* @since 3.2
* @access public
* @param string
* @return
*/
public function filter()
{
$filterType = JRequest::getVar('filter');
$sort = JRequest::getVar('sort', 'latest');
$categoryId = JRequest::getVar('id', '0');
if (!$categoryId) {
$categoryId = array();
} else {
$categoryId = explode(',', $categoryId);
}
$view = JRequest::getVar('view', 'index');
$ajax = DiscussHelper::getHelper('ajax');
JRequest::setVar('filter', $filterType);
$postModel = DiscussHelper::getModel('Posts');
$registry = DiscussHelper::getRegistry();
// Get the pagination limit
$limit = $registry->get('limit');
$limit = $limit == '-2' ? DiscussHelper::getListLimit() : $limit;
$limit = $limit == '-1' ? DiscussHelper::getJConfig()->get('list_limit') : $limit;
// Get normal discussion posts.
$options = array('sort' => $sort, 'category' => $categoryId, 'filter' => $filterType, 'limit' => $limit, 'featured' => false);
$posts = $postModel->getDiscussions($options);
//$posts = $postModel->getData( false , $sort , null , $filterType , $categoryId, null, '');
$posts = DiscussHelper::formatPost($posts);
$pagination = '';
$pagination = $postModel->getPagination(0, $sort, $filterType, $categoryId, false);
$filtering = array('category_id' => $categoryId, 'filter' => $filterType, 'sort' => $sort);
$pagination = $pagination->getPagesLinks($view, $filtering, true);
$html = '';
$empty = '';
if (count($posts) > 0) {
$template = new DiscussThemes();
$badgesTable = DiscussHelper::getTable('Profile');
$onlineUsers = Discusshelper::getModel('Users')->getOnlineUsers();
foreach ($posts as $post) {
$badgesTable->load($post->user->id);
$post->badges = $badgesTable->getBadges();
// Translate post status from integer to string
switch ($post->post_status) {
case '0':
$post->post_status_class = '';
$post->post_status = '';
break;
case '1':
$post->post_status_class = '-on-hold';
$post->post_status = JText::_('COM_EASYDISCUSS_POST_STATUS_ON_HOLD');
break;
case '2':
$post->post_status_class = '-accept';
$post->post_status = JText::_('COM_EASYDISCUSS_POST_STATUS_ACCEPTED');
break;
case '3':
$post->post_status_class = '-working-on';
$post->post_status = JText::_('COM_EASYDISCUSS_POST_STATUS_WORKING_ON');
break;
case '4':
$post->post_status_class = '-reject';
$post->post_status = JText::_('COM_EASYDISCUSS_POST_STATUS_REJECT');
break;
default:
$post->post_status_class = '';
$post->post_status = '';
break;
}
$alias = $post->post_type;
$modelPostTypes = DiscussHelper::getModel('Post_types');
// Get each post's post status title
$title = $modelPostTypes->getTitle($alias);
$post->post_type = $title;
// Get each post's post status suffix
$suffix = $modelPostTypes->getSuffix($alias);
$post->suffix = $suffix;
$template->set('post', $post);
$html .= $template->fetch('frontpage.post.php');
}
} else {
$template = new DiscussThemes();
$html .= $template->fetch('frontpage.empty.php');
}
// This post is already favourite
$ajax->resolve($html, $pagination);
$ajax->send();
}
示例9: isSefEnabled
public static function isSefEnabled()
{
$jConfig = DiscussHelper::getJConfig();
$isSef = false;
//check if sh404sef enabled or not.
if (defined('sh404SEF_AUTOLOADER_LOADED') && JFile::exists(JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php')) {
require_once JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php';
if (class_exists('shRouter')) {
$sefConfig = shRouter::shGetConfig();
if ($sefConfig->Enabled) {
$isSef = true;
}
}
}
// if sh404sef not enabled, we check on joomla
if (!$isSef) {
$isSef = $jConfig->getValue('sef');
}
return $isSef;
}
示例10: getEmailTemplateContent
function getEmailTemplateContent($template, $data)
{
$config = DiscussHelper::getConfig();
$output = '';
if (!isset($data['unsubscribeLink'])) {
$data['unsubscribeLink'] = '';
}
$replyBreakText = '';
if ($replyBreakText = $config->get('mail_reply_breaker')) {
$replyBreakText = JText::sprintf('COM_EASYDISCUSS_EMAILTEMPLATE_REPLY_BREAK', $replyBreakText);
}
// If this uses html, we need to switch the template file
if ($config->get('notify_html_format')) {
$template = str_ireplace('.php', '.html.php', $template);
}
$theme = new DiscussThemes();
foreach ($data as $key => $val) {
$theme->set($key, $val);
}
$contents = $theme->fetch($template, array('emails' => true));
unset($theme);
$theme = new DiscussThemes();
$jConfig = DiscussHelper::getJConfig();
$theme->set('emailTitle', $config->get('notify_email_title', $jConfig->getValue('sitename')));
$theme->set('contents', $contents);
$theme->set('unsubscribeLink', $data['unsubscribeLink']);
$theme->set('replyBreakText', $replyBreakText);
if ($config->get('notify_html_format')) {
$output = $theme->fetch('email.template.html.php', array('emails' => true));
} else {
$output = $theme->fetch('email.template.text.php', array('emails' => true));
}
return $output;
}
示例11: setMeta
public static function setMeta()
{
$config = DiscussHelper::getConfig();
$db = DiscussHelper::getDBO();
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive();
$result = new stdClass();
$result->description = $config->get('main_description');
$result->keywords = '';
$description = '';
if (is_object($item)) {
$params = $item->params;
if (!$params instanceof JRegistry) {
$params = DiscussHelper::getRegistry($item->params);
}
$description = $params->get('menu-meta_description', '');
$keywords = $params->get('menu-meta_keywords', '');
if (!empty($description)) {
$result->description = $description;
}
if (!empty($keywords)) {
$result->keywords = $keywords;
}
}
$document = JFactory::getDocument();
if (empty($result->keywords) && empty($result->description)) {
// Get joomla default description.
$jConfig = DiscussHelper::getJConfig();
$joomlaDesc = $jConfig->getValue('MetaDesc');
$metaDesc = $description . ' - ' . $joomlaDesc;
$document->setMetadata('description', $metaDesc);
} else {
if (!empty($result->keywords)) {
$document->setMetadata('keywords', $result->keywords);
}
if (!empty($result->description)) {
$document->setMetadata('description', $result->description);
}
}
}
示例12: getHeadingTitle
public static function getHeadingTitle()
{
static $title = null;
if (!$title) {
$config = DiscussHelper::getConfig();
$jConfig = DiscussHelper::getJConfig();
$title = $config->get('notify_email_title') ? $config->get('notify_email_title') : $jConfig->getValue('sitename');
}
return $title;
}
示例13: getTotalGuests
/**
* Get total number of guests that is viewing the site.
*
* @since 3.0
* @access public
*/
public function getTotalGuests()
{
$db = DiscussHelper::getDBO();
$jConfig = DiscussHelper::getJConfig();
$lifespan = $jConfig->getValue('lifetime');
$online = time() - $lifespan * 60;
$query = array();
$query[] = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__session');
$query[] = 'WHERE ' . $db->nameQuote('guest') . '=' . $db->Quote(1);
$query[] = 'AND ' . $db->nameQuote('time') . '>=' . $db->Quote($online);
$query = implode(' ', $query);
$db->setQuery($query);
$total = $db->loadResult();
return $total;
}
示例14: share
/**
* Shares a new content on Facebook
**/
public function share($post)
{
$config = DiscussHelper::getConfig();
$content = $post->content;
$content = EasyDiscussParser::bbcode($content);
JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
$editor = DiscussHelper::getEditorType('question');
if ($editor == 'html') {
// @rule: Match images from content
$pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
} else {
$pattern = '/\\[img\\](.*?)\\[\\/img\\]/ims';
}
preg_match($pattern, $content, $matches);
$image = '';
if ($matches) {
$image = isset($matches[1]) ? $matches[1] : '';
if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
$image = DISCUSS_JURIROOT . '/' . ltrim($image, '/');
}
}
$text = strip_tags($content);
// @TODO: Configurable content length.
$maxLength = 200;
$text = JString::strlen($text) > $maxLength ? JString::substr($text, 0, $maxLength) . '...' : $text;
$url = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
$this->_access_token = preg_replace('/&expires=.*/i', '', $this->_access_token);
$jConfig = DiscussHelper::getJConfig();
$params = array('link' => $url, 'name' => $post->title, 'actions' => '{"name": "' . JText::_('COM_EASYDISCUSS_AUTOPOST_FB_VIEWON_BUTTON') . '", "link" : "' . $url . '"}', 'description' => $text, 'message' => JString::substr(strip_tags($text), 0, 30) . '...', 'access_token' => $this->_access_token);
if (!empty($image)) {
// Since Facebook does not allow https images we need to replace them here.
$params['picture'] = str_ireplace('https://', 'http://', $image);
} else {
$params['picture'] = DISCUSS_JURIROOT . '/media/com_easydiscuss/images/default_facebook.png';
$params['source'] = rtrim(JURI::root(), '/') . '/media/com_easydiscuss/images/default_facebook.png';
}
// @rule: See if we need to post this to a Facebook page instead.
$pageId = $config->get('main_autopost_facebook_page_id');
if (!empty($pageId)) {
$pages = JString::trim($pageId);
$pages = explode(',', $pages);
$total = count($pages);
// @rule: Test if there are any pages at all the user can access
$accounts = parent::api('/me/accounts', array('access_token' => $this->_access_token));
if (is_array($accounts) && isset($accounts['data'])) {
for ($i = 0; $i < $total; $i++) {
foreach ($accounts['data'] as $page) {
if ($page['id'] == $pages[$i]) {
$params['access_token'] = $page['access_token'];
$query = parent::api('/' . $page['id'] . '/feed', 'post', $params);
}
}
}
}
} else {
// @rule: If this is just a normal posting, just post it on their page.
$query = parent::api('/me/feed', 'post', $params);
}
$success = isset($query['id']) ? true : false;
return $success;
}
示例15:
<th width="10%" class="center"><?php
echo JHTML::_('grid.sort', JText::_('COM_EASYDISCUSS_ADMIN_POST_TYPES_ALIAS'), 'a.alias', $this->orderDirection, $this->order);
?>
</th>
<th width="1%" class="center"><?php
echo JHTML::_('grid.sort', JText::_('Id'), 'a.id', $this->orderDirection, $this->order);
?>
</th>
</tr>
</thead>
<tbody>
<?php
if ($this->postTypes) {
$k = 0;
$x = 0;
$config = DiscussHelper::getJConfig();
for ($i = 0, $n = count($this->postTypes); $i < $n; $i++) {
$row = $this->postTypes[$i];
$date = DiscussHelper::getDate($row->created, $config->get('offset'));
?>
<tr class="<?php
echo "row{$k}";
?>
">
<td class="center" style="text-align: center;">
<?php
echo JHTML::_('grid.id', $x++, $row->id);
?>
</td>
<td align="left">