本文整理汇总了PHP中KunenaConfig::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaConfig::getInstance方法的具体用法?PHP KunenaConfig::getInstance怎么用?PHP KunenaConfig::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaConfig
的用法示例。
在下文中一共展示了KunenaConfig::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->config = KunenaConfig::getInstance();
$this->limit = $this->config->userlist_rows;
$this->query->leftJoin('#__kunena_users AS ku ON ku.userid=a.id');
}
示例2: before
/**
* Load user list.
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$config = KunenaConfig::getInstance();
if ($config->userlist_allowed && JFactory::getUser()->guest) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
}
require_once KPATH_SITE . '/models/user.php';
$this->model = new KunenaModelUser(array(), $this->input);
$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
$this->state = $this->model->getState();
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$start = $this->state->get('list.start');
$limit = $this->state->get('list.limit');
// Get list of super admins to exclude or not in filter by configuration.
$filter = JAccess::getUsersByGroup(8);
$finder = new KunenaUserFinder();
$finder->filterByConfiguration($filter)->filterByName($this->state->get('list.search'));
$this->total = $finder->count();
$this->pagination = new KunenaPagination($this->total, $start, $limit);
$alias = 'ku';
$aliasList = array('id', 'name', 'username', 'email', 'block', 'registerDate', 'lastvisitDate');
if (in_array($this->state->get('list.ordering'), $aliasList)) {
$alias = 'a';
}
$this->users = $finder->order($this->state->get('list.ordering'), $this->state->get('list.direction') == 'asc' ? 1 : -1, $alias)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
}
示例3: before
/**
* Prepare announcement box display.
*
* @return bool
*/
protected function before()
{
parent::before();
$config = KunenaConfig::getInstance();
if (!$config->showannouncement)
{
return false;
}
$items = KunenaForumAnnouncementHelper::getAnnouncements();
$this->announcement = array_pop($items);
if (!$this->announcement || !$this->announcement->authorise('read'))
{
return false;
}
$view = $this->input->getWord('view', 'default');
$layout = $this->input->getWord('layout', 'default');
if ($view == 'topic' && $layout != 'default' || $view == 'user' || $view == 'search' || $view == 'announcement' && $layout == 'default') {
return false;
}
return true;
}
示例4: __construct
/**
* Method to instantiate the layout.
*
* @param string $name
* @param array $paths The paths queue.
*/
public function __construct($name, array $paths = null)
{
// Setup dependencies.
$this->_name = $name;
$this->includePaths = isset($paths) ? $paths : $this->loadPaths();
$this->debug = JDEBUG || KunenaConfig::getInstance()->get('debug');
}
示例5: initialize
/**
* Initialize class.
*/
static public function initialize()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
if (KunenaConfig::getInstance()->get('cache_cat'))
{
// FIXME: Experimental caching.
/** @var JCache|JCacheControllerCallback $cache */
$cache = JFactory::getCache('com_kunena', 'callback');
$cache->setLifeTime(180);
self::$_instances = $cache->call(array('KunenaForumCategoryHelper', 'loadCategories'));
}
else
{
self::$_instances = self::loadCategories();
}
if (is_null(self::$_tree))
{
self::buildTree(self::$_instances);
}
self::$allowed = KunenaAccess::getInstance()->getAllowedCategories();
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
}
示例6: before
/**
* Executed before display.
*/
protected function before()
{
$this->layout = $this->input->getCmd('layout', 'default');
$this->config = KunenaConfig::getInstance();
if ($this->primary) {
$this->document = JFactory::getDocument();
}
}
示例7: before
/**
* Prepare AJAX display.
*
* @return void
*/
protected function before()
{
// Load language files.
KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
KunenaFactory::loadLanguage('com_kunena.templates');
KunenaFactory::loadLanguage('com_kunena.models');
KunenaFactory::loadLanguage('com_kunena.views');
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$this->document = JFactory::getDocument();
$this->template = KunenaFactory::getTemplate();
$this->template->initialize();
}
示例8: before
/**
* Prepare statistics box display.
*
* @return boolean
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showstats') || !$this->config->statslink_allowed && !KunenaUserHelper::get()->exists()) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
$statistics = KunenaForumStatistics::getInstance();
$statistics->loadGeneral();
$this->setProperties($statistics);
$this->latestMemberLink = KunenaFactory::getUser(intval($this->lastUserId))->getLink();
$this->statisticsUrl = KunenaFactory::getProfile()->getStatisticsURL();
return true;
}
示例9: before
/**
* Prepare general statistics display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showstats')) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
if (!$this->config->statslink_allowed && JFactory::getUser()->guest) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
}
$statistics = KunenaForumStatistics::getInstance();
$statistics->loadAll();
$this->setProperties($statistics);
$this->latestMemberLink = KunenaFactory::getUser((int) $this->lastUserId)->getLink();
$this->userlistUrl = KunenaFactory::getProfile()->getUserListUrl();
}
示例10: before
/**
* Prepare Who is online display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showwhoisonline')) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
$me = KunenaUserHelper::getMyself();
$moderator = intval($me->isModerator()) + intval($me->isAdmin());
$users = KunenaUserHelper::getOnlineUsers();
KunenaUserHelper::loadUsers(array_keys($users));
$onlineusers = KunenaUserHelper::getOnlineCount();
$who = '<strong>' . $onlineusers['user'] . ' </strong>';
if ($onlineusers['user'] == 1) {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER') . ' ';
} else {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS') . ' ';
}
$who .= JText::_('COM_KUNENA_WHO_AND');
$who .= '<strong> ' . $onlineusers['guest'] . ' </strong>';
if ($onlineusers['guest'] == 1) {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST') . ' ';
} else {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS') . ' ';
}
$who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW');
$this->membersOnline = $who;
$this->onlineList = array();
$this->hiddenList = array();
foreach ($users as $userid => $usertime) {
$user = KunenaUserHelper::get($userid);
if (!$user->showOnline) {
if ($moderator) {
$this->hiddenList[$user->getName()] = $user;
}
} else {
$this->onlineList[$user->getName()] = $user;
}
}
ksort($this->onlineList);
ksort($this->hiddenList);
$profile = KunenaFactory::getProfile();
$this->usersUrl = $profile->getUserListURL();
}
示例11: checkFileSize
/**
* Check if filesize on file which on going to be uploaded doesn't exceed the limits set by Kunena configuration and Php configuration
*
* @param int $filesize The size of file in bytes
* @param boolean $avatar If the file is an avatar
*
* @return boolean
*/
protected function checkFileSize($filesize, $avatar)
{
if (!$avatar) {
if ($filesize > $this->getMaxSize()) {
return false;
}
} else {
if ($avatar && $filesize > intval(KunenaConfig::getInstance()->avatarsize) * 1024) {
return false;
}
}
return true;
}
示例12: getConfig
/**
* Get a Kunena configuration object
*
* Returns the global {@link KunenaConfig} object, only creating it if it doesn't already exist.
*
* @return KunenaConfig
*/
public static function getConfig() {
return KunenaConfig::getInstance();
}
示例13: build
protected static function build()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
if (self::$search === false)
{
$user = KunenaUserHelper::getMyself();
$language = strtolower(JFactory::getDocument()->getLanguage());
self::$search = false;
if (KunenaConfig::getInstance()->get('cache_mid'))
{
// FIXME: Experimental caching.
$cache = self::getCache();
self::$search = unserialize($cache->get('search', "com_kunena.route.v1.{$language}.{$user->userid}"));
}
if (self::$search === false)
{
self::$search['home'] = array();
foreach (self::$menu as $item)
{
// Skip menu items that aren't pointing to Kunena or are using wrong language.
if (($item->component != 'com_kunena' && $item->type != 'alias')
|| ($item->language != '*' && strtolower($item->language) != $language))
{
continue;
}
// Follow links.
if ($item->type == 'alias')
{
if (empty($item->query['Itemid']) || empty(self::$menu[$item->query['Itemid']]))
{
continue;
}
$item = self::$menu[$item->query['Itemid']];
if ($item->component != 'com_kunena' || ($item->language != '*' && strtolower($item->language) != $language))
{
continue;
}
}
// Ignore legacy menu items without view in it.
if (!isset($item->query['view']))
{
continue;
}
// Save Kunena menu items so that we can make fast searches
$home = self::getHome($item);
self::$search[$item->query['view']][$home ? $home->id : 0][$item->id] = $item->id;
}
if (isset($cache))
{
$cache->store(serialize(self::$search), 'search', "com_kunena.route.v1.{$language}.{$user->userid}");
}
}
}
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
}
示例14: getAvailableFilename
/**
* Find filename which isn't already taken in the filesystem.
*
* @param string $folder Relative path from JPATH_ROOT.
* @param string $basename Filename without extension.
* @param string $extension File extension.
* @param bool $protected True to randomize the filename. If not given, uses Kunena configuration setting.
*
* @return string
*
* @since K4.0
*/
public static function getAvailableFilename($folder, $basename, $extension, $protected = null)
{
if (is_null($protected)) {
$protected = (bool) KunenaConfig::getInstance()->attachment_protection;
}
if ($protected) {
// Ignore proposed filename and return totally random and unique name without file extension.
do {
$name = md5(rand());
} while (file_exists(JPATH_ROOT . "/{$folder}/{$name}"));
return $name;
}
// Lets find out if we need to rename the filename.
$basename = preg_replace('/[[:space:]]/', '', KunenaFile::makeSafe($basename));
$extension = trim($extension, '.');
if (empty($basename)) {
$basename = 'file_' . substr(md5(rand()), 2, 7);
}
$newName = "{$basename}.{$extension}";
$date = date('Y-m-d');
// Rename file if there is already one with the same name
if (file_exists(JPATH_ROOT . "/{$folder}/{$newName}")) {
$newName = "{$basename}_{$date}.{$extension}";
for ($i = 2; file_exists(JPATH_ROOT . "/{$folder}/{$newName}"); $i++) {
$newName = "{$basename}_{$date}-{$i}.{$extension}";
}
}
return $newName;
}
示例15: before
/**
* Prepare attachment display.
*
* @return void
*/
protected function before()
{
// Load language files.
KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$this->document = JFactory::getDocument();
}