本文整理汇总了PHP中JCommentsFactory::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP JCommentsFactory::getConfig方法的具体用法?PHP JCommentsFactory::getConfig怎么用?PHP JCommentsFactory::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCommentsFactory
的用法示例。
在下文中一共展示了JCommentsFactory::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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));
}
示例3: 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;
}
示例4: 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;
}
示例5: check
public static function check($str)
{
static $group = null;
$str = JCommentsFactory::getConfig()->get($str);
if (!empty($str)) {
$user = JFactory::getUser();
$list = explode(',', $str);
if ($group === null) {
if ($user->id) {
$db = JFactory::getDbo();
// get highest group
$query = $db->getQuery(true);
$query->select('a.id');
$query->from('#__user_usergroup_map AS map');
$query->leftJoin('#__usergroups AS a ON a.id = map.group_id');
$query->where('map.user_id = ' . (int) $user->id);
$query->order('a.lft desc');
$db->setQuery($query, 0, 1);
$group = $db->loadResult();
} else {
$group = JComponentHelper::getParams('com_users')->get('guest_usergroup', 1);
}
}
if (in_array($group, $list)) {
return 1;
}
}
return 0;
}
示例6: getSmiliesPath
public static function getSmiliesPath()
{
$config = JCommentsFactory::getConfig();
$smiliesPath = $config->get('smilies_path', 'components/com_jcomments/images/smilies/');
$smiliesPath = str_replace(array('//', '\\\\'), '/', $smiliesPath);
$smiliesPath = trim($smiliesPath, '\\/') . '/';
return $smiliesPath;
}
示例7: CategoryViewsTime
function CategoryViewsTime($name, $reason = '')
{
global $mainframe, $my;
$config =& JCommentsFactory::getConfig();
if ($config->get('CategoryGet') != '') {
$object = new stdClass();
$object->object_cat = CategoryFactory::getAbs($object->object_cat);
$commentText = $comment->comment;
}
}
示例8: JCommentsPagination
public function JCommentsPagination($object_id, $object_group)
{
$config = JCommentsFactory::getConfig();
$this->commentsPerPage = $config->getInt('comments_per_page');
$this->commentsPageLimit = $config->getInt('comments_page_limit');
$this->commentsOrder = $config->get('comments_order');
if ($this->commentsPerPage > 0) {
$this->setCommentsCount(JComments::getCommentsCount($object_id, $object_group));
}
}
示例9: checkIsRegisteredEmail
public static function checkIsRegisteredEmail($email)
{
$config = JCommentsFactory::getConfig();
if ($config->getInt('enable_username_check') == 1) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT(*)');
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('email') . ' = ' . $db->Quote($db->escape($email, true)));
$db->setQuery($query);
return $db->loadResult() == 0 ? 0 : 1;
}
return 0;
}
示例10: trigger
/**
* Triggers an event by dispatching arguments to all observers that handle
* the event and returning their return values.
*
* @param string $event The event name
* @param array $args An array of arguments
* @return array An array of results from each function call
*/
public static function trigger($event, $args = null)
{
static $pluginsLoaded = false;
$result = array();
$config = JCommentsFactory::getConfig();
if ($config->getInt('enable_mambots') == 1) {
if (!$pluginsLoaded) {
JPluginHelper::importPlugin('jcomments');
$pluginsLoaded = true;
}
$dispatcher = JDispatcher::getInstance();
$result = $dispatcher->trigger($event, $args);
}
return $result;
}
示例11: getCommentsList
function getCommentsList($object_id, $object_group = 'com_content', $limitStart = 0, $limit = 0)
{
$acl =& JCommentsFactory::getACL();
$db =& JCommentsFactory::getDBO();
$config =& JCommentsFactory::getConfig();
$options['object_id'] = (int) $object_id;
$options['object_group'] = trim($object_group);
$options['published'] = $acl->canPublish() ? null : 1;
$options['orderBy'] = $config->get('template_view') == 'tree' ? 'c.parent, c.date ASC' : 'c.date ' . $config->get('comments_order');
$options['limit'] = $limit;
$options['limitStart'] = $limitStart;
$db->setQuery(JCommentsModel::_getCommentsQuery($options));
$rows = $db->loadObjectList();
return $rows;
}
示例12: trigger
/**
* Triggers an event by dispatching arguments to all observers that handle
* the event and returning their return values.
*
* @param string $event The event name
* @param array $args An array of arguments
* @return array An array of results from each function call
*/
public static function trigger($event, $args = null)
{
static $initialised = false;
$result = array();
if (JCommentsFactory::getConfig()->getInt('enable_plugins') == 1) {
if (!$initialised) {
JPluginHelper::importPlugin('jcomments');
$initialised = true;
}
if (version_compare(JVERSION, '3.0', 'ge')) {
$dispatcher = JEventDispatcher::getInstance();
} else {
$dispatcher = JDispatcher::getInstance();
}
$result = $dispatcher->trigger($event, $args);
}
return $result;
}
示例13: show
public static function show()
{
$app = JCommentsFactory::getApplication('administrator');
$config = JCommentsFactory::getConfig();
if ($config->getInt('enable_blacklist') == 0) {
if (JCOMMENTS_JVERSION != '1.0') {
JError::raiseWarning(500, JText::_('A_BLACKLIST_WARNING_BLACKLIST_IS_DISABLED'));
}
}
$context = 'com_jcomments.blacklist.';
$limit = intval($app->getUserStateFromRequest($context . 'limit', 'limit', $app->getCfg('list_limit')));
$limitstart = intval($app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0));
$filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'bl.created');
$filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', 'desc');
$search = trim($app->getUserStateFromRequest($context . 'search', 'search', ''));
if (JCOMMENTS_JVERSION == '1.0') {
$search = strtolower($search);
} else {
$search = JString::strtolower($search);
}
if ($filter_order == '') {
$filter_order = 'bl.created';
}
if ($filter_order_Dir == '') {
$filter_order_Dir = 'desc';
}
$lists['order'] = $filter_order;
$lists['order_Dir'] = $filter_order_Dir;
$lists['search'] = $search;
$db = JCommentsFactory::getDBO();
$where = array();
if ($search != '') {
$where[] = '(LOWER(bl.ip) like "%' . $db->getEscaped($search, true) . '%")' . ' OR LOWER(bl.reason) like "%' . $db->getEscaped($search, true) . '%"' . ' OR LOWER(bl.notes) like "%' . $db->getEscaped($search, true) . '%"';
}
$query = "SELECT COUNT(*)" . " FROM #__jcomments_blacklist AS bl" . (count($where) ? " WHERE " . implode(' AND ', $where) : "");
$db->setQuery($query);
$total = $db->loadResult();
$lists['pageNav'] = JCommentsAdmin::getPagination($total, $limitstart, $limit);
$query = "SELECT bl.*, u.name AS editor" . " FROM #__jcomments_blacklist AS bl" . " LEFT JOIN #__users AS u ON u.id = bl.checked_out" . (count($where) ? " WHERE " . implode(' AND ', $where) : "") . " ORDER BY " . $filter_order . ' ' . $filter_order_Dir;
$db->setQuery($query, $lists['pageNav']->limitstart, $lists['pageNav']->limit);
$lists['rows'] = $db->loadObjectList();
HTML_JCommentsAdminBlacklistManager::show($lists);
}
示例14: __construct
public function __construct()
{
if (count($this->_replacements) == 0) {
$config = JCommentsFactory::getConfig();
$path = JUri::root(true) . '/' . trim(str_replace('\\', '/', $config->get('smilies_path')), '/') . '/';
$smilies = $config->get('smilies');
if (!empty($smilies)) {
$values = explode("\n", $smilies);
foreach ($values as $value) {
list($code, $image) = explode("\t", $value);
$this->_smilies[$code] = $image;
}
}
$list = $this->_smilies;
uksort($list, array($this, 'compare'));
foreach ($list as $code => $image) {
$this->_replacements['code'][] = '#(^|\\s|\\n|\\r|\\>)(' . preg_quote($code, '#') . ')(\\s|\\n|\\r|\\<|$)#ismu';
$this->_replacements['icon'][] = '\\1 \\2 \\3';
$this->_replacements['code'][] = '#(^|\\s|\\n|\\r|\\>)(' . preg_quote($code, '#') . ')(\\s|\\n|\\r|\\<|$)#ismu';
$this->_replacements['icon'][] = '\\1<img src="' . $path . $image . '" alt="' . htmlspecialchars($code) . '" />\\3';
}
}
}
示例15: _getDefaultOrder
/**
* Returns default order for comments list
*
* @return string
*/
protected static function _getDefaultOrder()
{
$config = JCommentsFactory::getConfig();
if ($config->get('template_view') == 'tree') {
switch ($config->getInt('comments_tree_order')) {
case 2:
$result = 'threadDate DESC, c.date ASC';
break;
case 1:
$result = 'c.parent, c.date DESC';
break;
default:
$result = 'c.parent, c.date ASC';
break;
}
} else {
$result = 'c.date ' . $config->get('comments_list_order');
}
return $result;
}