本文整理汇总了PHP中JCommentsFactory类的典型用法代码示例。如果您正苦于以下问题:PHP JCommentsFactory类的具体用法?PHP JCommentsFactory怎么用?PHP JCommentsFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JCommentsFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectOwner
function getObjectOwner($id)
{
$db =& JCommentsFactory::getDBO();
$db->setQuery('SELECT owner FROM #__ezrealty WHERE id = ' . $id);
$userid = (int) $db->loadResult();
return $userid;
}
示例2: getObjectOwner
function getObjectOwner($id)
{
$db =& JCommentsFactory::getDBO();
$db->setQuery('SELECT user_id FROM #__beeheard_suggestions WHERE id = ' . $id);
$userid = $db->loadResult();
return $userid;
}
示例3: getObjectOwner
function getObjectOwner($id)
{
$db = JCommentsFactory::getDBO();
$db->setQuery('SELECT created_by, id FROM #__rokdownloads WHERE id = ' . $id);
$userid = $db->loadResult();
return $userid;
}
示例4: getObjectOwner
function getObjectOwner($id)
{
$db =& JCommentsFactory::getDBO();
$db->setQuery("SELECT created_by FROM #__js_res_record WHERE id='{$id}'");
$userid = $db->loadResult();
return $userid;
}
示例5: applyConfig
/**
* Set Jcomments config for the actual product, and the value of $comments_enabled
*
* @author Florian Voutzinos
* @param object $product virtuemart product object
* @param array $excludedCatIds Ids of excluded category from plugin params
* @return void
*/
public static function applyConfig($product, $excludedCatIds)
{
$config = JCommentsFactory::getConfig();
// {Jcomments} tag domines Excluded categories !
// and {Jcomments OFF} domines everything
// if {Jcomments OFF} tag found we disable comments by force
if (self::isDisabled($product)) {
$config->set('comments_on', 0);
$config->set('comments_off', 1);
self::$comments_enabled = false;
} elseif (self::isEnabled($product)) {
$config->set('comments_on', 1);
$config->set('comments_off', 0);
self::$comments_enabled = true;
} else {
// we enable comments if the product category is enabled
if (self::isCategoryProductEnabled($product, $excludedCatIds)) {
$config->set('comments_on', 1);
$config->set('comments_off', 0);
self::$comments_enabled = true;
} else {
$config->set('comments_on', 0);
$config->set('comments_off', 1);
self::$comments_enabled = false;
}
}
$config->set('comments_locked', (int) self::isLocked($product));
}
示例6: render
function render()
{
$readmoreLink = $this->getReadmoreLink();
$commentsLink = $this->getCommentsLink();
$hitsCount = '';
if ($this->getVar('show_hits', 0) == 1) {
$content = $this->getVar('content-item');
if (!isset($content->hits)) {
$dbo =& JCommentsFactory::getDBO();
$dbo->setQuery('SELECT hits FROM #__content WHERE id = ' . intval($content->id));
$cnt = (int) $dbo->loadResult();
} else {
$cnt = (int) $content->hits;
}
$hitsCount = JText::_('Hits') . ': ' . $cnt;
}
if ($readmoreLink != '' || $commentsLink != '') {
?>
<div class="jcomments-links"><?php
echo $readmoreLink;
?>
<?php
echo $commentsLink;
?>
<?php
echo $hitsCount;
?>
</div>
<?php
}
}
示例7: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$row = null;
if (JCOMMENTS_JVERSION == '1.0') {
$db = JCommentsFactory::getDBO();
$db->setQuery('SELECT link_id, link_name, user_id FROM #__mt_links WHERE link_id = ' . $id);
$db->loadObject($row);
} else {
$db = JFactory::getDBO();
$db->setQuery('SELECT link_id, link_name, user_id FROM #__mt_links WHERE link_id = ' . $id);
$row = $db->loadObject();
}
if (!empty($row)) {
$Itemid = self::getItemid('com_mtree');
$Itemid = $Itemid > 0 ? '&Itemid=' . $Itemid : '';
$info->title = $row->link_name;
$info->userid = $row->user_id;
if (JCOMMENTS_JVERSION == '1.0') {
$info->link = sefRelToAbs('index.php?option=com_mtree&task=viewlink&link_id=' . $id . $Itemid);
} else {
$info->link = JRoute::_('index.php?option=com_mtree&task=viewlink&link_id=' . $id . $Itemid);
}
}
return $info;
}
示例8: getObjectInfo
function getObjectInfo($id, $language = null)
{
if (JCOMMENTS_JVERSION == '1.0') {
$query = "SELECT id, title, '' as alias, access FROM #__polls WHERE id = " . $id;
} else {
$query = "SELECT id, title, alias, access FROM #__polls WHERE id = " . $id;
}
$db = JCommentsFactory::getDBO();
$db->setQuery($query);
$row = $db->loadObject();
$info = new JCommentsObjectInfo();
if (!empty($row)) {
$_Itemid = self::getItemid('com_poll');
$info->title = $row->title;
$info->access = $row->access;
if (JCOMMENTS_JVERSION == '1.0') {
$link = sefRelToAbs('index.php?option=com_poll&task=results&id=' . $id . '&Itemid=' . $_Itemid);
} else {
$_Itemid = $_Itemid > 0 ? '&Itemid=' . $_Itemid : '';
$link = JRoute::_('index.php?option=com_poll&id=' . $id . ':' . $row->alias . $_Itemid);
}
$info->link = $link;
}
return $info;
}
示例9: isEnabled
public static function isEnabled()
{
static $enabled = null;
if (!isset($enabled)) {
$app = JFactory::getApplication();
if ($app->isSite()) {
$enabled = $app->getLanguageFilter();
} else {
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('enabled');
$query->from($db->quoteName('#__extensions'));
$query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
$query->where($db->quoteName('folder') . ' = ' . $db->quote('system'));
$query->where($db->quoteName('element') . ' = ' . $db->quote('languagefilter'));
$db->setQuery($query);
$enabled = $db->loadResult();
}
JFactory::getConfig()->set('multilingual_support', $enabled);
if ($enabled) {
$enabled = JCommentsFactory::getConfig()->get('multilingual_support', $enabled);
}
}
return $enabled;
}
示例10: getList
public static function getList($params)
{
$db = JFactory::getDBO();
$db->setQuery("SELECT * FROM #__jcomments ORDER BY date DESC", 0, $params->get('count'));
$items = $db->loadObjectList();
if (!is_array($items)) {
$items = array();
}
if (count($items)) {
$config = JCommentsFactory::getConfig();
$bbcode = JCommentsFactory::getBBCode();
$limit_comment_text = (int) $params->get('limit_comment_text', 0);
foreach ($items as &$item) {
$item->link = 'index.php?option=com_jcomments&&view=comment&layout=edit&id=' . $item->id;
$item->author = JComments::getCommentAuthorName($item);
$text = JCommentsText::censor($item->comment);
$text = $bbcode->filter($text, true);
$text = JCommentsText::cleanText($text);
if ($limit_comment_text && JString::strlen($text) > $limit_comment_text) {
$text = self::truncateText($text, $limit_comment_text - 1);
}
$item->comment = $text;
}
}
return $items;
}
示例11: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$row = null;
if (JCOMMENTS_JVERSION == '1.0') {
$db = JCommentsFactory::getDBO();
$db->setQuery('SELECT id, ad_headline, userid, category FROM #__adsmanager_ads WHERE id = ' . $id);
$db->loadObject($row);
} else {
$db = JFactory::getDBO();
$db->setQuery('SELECT id, ad_headline, userid, category FROM #__adsmanager_ads WHERE id = ' . $id);
$row = $db->loadObject();
}
if (!empty($row)) {
$info->title = $row->ad_headline;
$info->userid = $row->userid;
if (JCOMMENTS_JVERSION == '1.0') {
$Itemid = self::getItemid('com_adsmanager');
$Itemid = $Itemid > 0 ? '&Itemid=' . $Itemid : '';
$info->link = sefRelToAbs("index.php?option=com_adsmanager&page=show_ad&adid=" . $id . $Itemid);
} else {
$Itemid = self::getItemid('com_adsmanager', 'index.php?option=com_adsmanager&view=front');
$Itemid = $Itemid > 0 ? '&Itemid=' . $Itemid : '';
$info->link = JRoute::_("index.php?option=com_adsmanager&view=details&id=" . $row->id . "&catid=" . $row->category . $Itemid);
}
}
return $info;
}
示例12: plgSystemJComments
function plgSystemJComments()
{
global $mosConfig_absolute_path, $mainframe;
include_once $mosConfig_absolute_path . '/components/com_jcomments/jcomments.legacy.php';
if (!defined('JCOMMENTS_JVERSION')) {
return;
}
include_once JCOMMENTS_BASE . '/jcomments.class.php';
include_once JCOMMENTS_BASE . '/jcomments.config.php';
include_once JCOMMENTS_HELPERS . '/system.php';
$document = JCommentsFactory::getDocument();
if (!defined('JCOMMENTS_CSS')) {
$document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
define('JCOMMENTS_CSS', 1);
}
if (!$mainframe->isAdmin()) {
if (!defined('JCOMMENTS_JS')) {
$document->addScript(JCommentsSystemPluginHelper::getCoreJS());
define('JCOMMENTS_JS', 1);
}
if (!defined('JOOMLATUNE_AJAX_JS')) {
$document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
define('JOOMLATUNE_AJAX_JS', 1);
}
}
}
示例13: save
public function save()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$base64 = $app->input->get('base64', '');
if (!empty($base64)) {
$base64 = base64_decode(urldecode($base64));
parse_str($base64, $data);
foreach ($data as $k => $v) {
$app->input->post->set($k, $v);
}
}
$model = $this->getModel();
$data = $app->input->post->get('jform', array(), 'array');
$language = $app->input->post->get('language', '', 'string');
$model->setState($model->getName() . '.language', $language);
if ($model->save($data) === false) {
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_jcomments&view=settings', false));
return false;
}
if (!extension_loaded('gd') || !function_exists('imagecreatefrompng')) {
$config = JCommentsFactory::getConfig();
if ($config->get('captcha_engine', 'kcaptcha') != 'recaptcha') {
JFactory::getApplication()->enqueueMessage(JText::_('A_WARNINGS_PHP_GD'), 'warning');
}
}
$cache = JFactory::getCache('com_jcomments');
$cache->clean();
$this->setMessage(JText::_('A_SETTINGS_SAVED'));
$this->setRedirect(JRoute::_('index.php?option=com_jcomments&view=settings', false));
return true;
}
示例14: getParams
/**
* Gets the parameter object for a plugin
*
* @param string $pluginName The plugin name
* @param string $type The plugin type, relates to the sub-directory in the plugins directory
* @return JParameter A JParameter object (mosParameters for J1.0)
*/
public static function getParams($pluginName, $type = 'content')
{
if (JCOMMENTS_JVERSION == '1.0') {
static $mambotParams = array();
$paramKey = $type . '_' . $pluginName;
if (!isset($mambotParams[$paramKey])) {
include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
$dbo = JCommentsFactory::getDBO();
$dbo->setQuery("SELECT params FROM #__mambots WHERE element = '{$pluginName}' AND folder = '{$type}'");
$mambotParams[$paramKey] = $dbo->loadResult();
}
$data = $mambotParams[$paramKey];
$pluginParams = new mosParameters($data);
} elseif (JCOMMENTS_JVERSION == '1.5') {
$plugin = JPluginHelper::getPlugin($type, $pluginName);
if (is_object($plugin)) {
$pluginParams = new JParameter($plugin->params);
} else {
$pluginParams = new JParameter('');
}
} else {
$plugin = JPluginHelper::getPlugin($type, $pluginName);
if (is_object($plugin)) {
$pluginParams = new JRegistry($plugin->params);
} else {
$pluginParams = new JRegistry('');
}
}
return $pluginParams;
}
示例15: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$Itemid = self::getItemid('com_marketplace');
$Itemid = $Itemid > 0 ? '&Itemid=' . $Itemid : '';
$marketplaceCore = JPATH_SITE . '/components/com_marketplace/controller.php';
if (is_file($marketplaceCore)) {
$db = JFactory::getDBO();
$query = 'SELECT e.id, e.headline as title, e.user_id as userid' . " , CASE WHEN CHAR_LENGTH(e.alias) THEN CONCAT_WS(':', e.id, e.alias) ELSE e.id END as slug" . " , CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as categorySlug" . " FROM #__marketplace_entries AS e" . " JOIN #__marketplace_categories AS c ON c.id = e.category_id" . " WHERE e.id = " . $id;
$db->setQuery($query);
$row = $db->loadObject();
$link = JRoute::_("index.php?option=com_marketplace&view=entry&catid=" . htmlspecialchars($row->categorySlug) . "&entry=" . $row->slug . $Itemid);
} else {
$db = JCommentsFactory::getDBO();
$query = 'SELECT e.id, e.ad_headline as title, e.userid ' . " FROM #__marketplace_ads AS e" . " WHERE e.id = " . $id;
$db->setQuery($query);
$row = $db->loadObject();
$link = JoomlaTuneRoute::_("index.php?option=com_marketplace&page=show_ad&adid=" . $id . $Itemid);
}
if (!empty($row)) {
$info->title = $row->ad_headline;
$info->userid = $row->userid;
$info->link = $link;
}
return $info;
}