本文整理汇总了PHP中KunenaForum::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForum::setup方法的具体用法?PHP KunenaForum::setup怎么用?PHP KunenaForum::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForum
的用法示例。
在下文中一共展示了KunenaForum::setup方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModel
/**
* Gets the model description for CB Forums
*
* @return stdClass
*/
public static function getModel()
{
global $_CB_framework;
static $cache = array();
$plugin = cbforumsClass::getPlugin();
$forum = $plugin->params->get('forum_model', 1);
if (!isset($cache[$forum])) {
$path = $_CB_framework->getCfg('absolute_path');
$model = new stdClass();
if (in_array($forum, array(1, 3, 4, 5, 6)) && file_exists($path . '/administrator/components/com_kunena/api.php')) {
/** @noinspection PhpIncludeInspection */
require_once $path . '/administrator/components/com_kunena/api.php';
if (!class_exists('KunenaForum') || !KunenaForum::installed()) {
$model->file = null;
} else {
KunenaForum::setup();
$model->file = $plugin->absPath . '/models/kunena20.php';
}
$model->detected = $forum == 6 ? CBTxt::T('Kunena 3.x') : CBTxt::T('Kunena 2.x');
$model->type = $forum == 6 ? 6 : 5;
} else {
$model->file = null;
$model->detected = CBTxt::T('None');
$model->type = 0;
}
if ($model->file) {
/** @noinspection PhpIncludeInspection */
require_once $model->file;
$model->class = new cbforumsModel();
}
$cache[$forum] = $model;
}
return $cache[$forum];
}
示例2: display
/**
* Display module contents.
*/
public final function display()
{
// Load CSS only once
if (static::$css) {
$this->document->addStyleSheet(JURI::root(true) . static::$css);
static::$css = null;
}
// Use caching also for registered users if enabled.
if ($this->params->get('owncache', 0)) {
/** @var $cache JCacheControllerOutput */
$cache = JFactory::getCache('com_kunena', 'output');
$me = KunenaFactory::getUser();
$cache->setLifeTime($this->params->get('cache_time', 180));
$hash = md5(serialize($this->params));
if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) {
return;
}
}
// Initialize Kunena.
KunenaForum::setup();
// Display module.
$this->_display();
// Store cached page.
if (isset($cache)) {
$cache->end();
}
}
示例3: getModel
/**
* Returns the forum model instance
*
* @return null|ModelInterface
*/
static public function getModel()
{
global $_CB_framework, $_PLUGINS;
static $model = null;
if ( ! $model ) {
static $params = null;
if ( ! $params ) {
$plugin = $_PLUGINS->getLoadedPlugin( 'user/plug_cbgroupjive/plugins', 'cbgroupjiveforums' );
$params = $_PLUGINS->getPluginParams( $plugin );
}
switch( $params->get( 'groups_forums_model', 'kunena' ) ) {
case 'kunena':
$api = $_CB_framework->getCfg( 'absolute_path' ) . '/administrator/components/com_kunena/api.php';
if ( file_exists( $api ) ) {
require_once( $api );
if ( class_exists( 'KunenaForum' ) ) {
\KunenaForum::setup();
}
$model = new Model\Kunena\Model();
}
break;
}
}
return $model;
}
示例4: display
function display()
{
KunenaForum::setup();
KunenaFactory::loadLanguage();
KunenaFactory::loadLanguage('com_kunena.templates');
$this->params->def('greeting', 1);
$this->document = JFactory::getDocument();
$this->me = KunenaFactory::getUser();
$token = JUtility::getToken();
// Load CSS only once
if (self::$cssadded == false) {
$this->document->addStyleSheet(JURI::root(true) . '/modules/mod_kunenalogin/tmpl/css/kunenalogin.css');
self::$cssadded = true;
}
$cache = JFactory::getCache('com_kunena', 'output');
if ($cache->start("{$this->me->userid}.{$token}", 'mod_kunenalogin')) {
return;
}
$login = KunenaLogin::getInstance();
if (!$this->me->exists()) {
$this->type = 'login';
$this->login = null;
if ($login) {
$this->lostPasswordUrl = $login->getResetURL();
$this->lostUsernameUrl = $login->getRemindURL();
$this->registerUrl = $login->getRegistrationURL();
$this->remember = JPluginHelper::isEnabled('system', 'remember');
}
} else {
$this->type = 'logout';
$this->logout = null;
$this->lastvisitDate = new KunenaDate($this->me->lastvisitDate);
if ($login) {
$this->logout = $login->getLogoutURL();
$this->recentPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics', JText::_('MOD_KUNENALOGIN_RECENT'));
$this->myPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics&layout=user&mode=default', JText::_('MOD_KUNENALOGIN_MYPOSTS'));
}
// Private messages
$private = KunenaFactory::getPrivateMessaging();
$this->privateMessages = '';
if ($this->params->get('showmessage') && $private) {
$count = $private->getUnreadCount($this->me->userid);
$this->privateMessages = $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX'));
}
}
$this->return = $this->getReturnURL();
require JModuleHelper::getLayoutPath('mod_kunenalogin');
$cache->end();
}
示例5: kunenaOnline
protected static function kunenaOnline()
{
// Kunena detection and version check
$minKunenaVersion = '2.0';
if (!class_exists('KunenaForum') || !KunenaForum::isCompatible($minKunenaVersion)) {
JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_NOT_INSTALLED', $minKunenaVersion), 'notice');
return false;
}
// Kunena installed check
if (!KunenaForum::installed()) {
JFactory::getApplication()->enqueueMessage(JText::_('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_OFFLINE'), 'notice');
return false;
}
KunenaForum::setup();
return true;
}
示例6: stepFinish
public function stepFinish()
{
KunenaForum::setup();
$entryfiles = array(array(KPATH_ADMIN, 'api', 'php'), array(KPATH_ADMIN, 'admin.kunena', 'php'), array(KPATH_SITE, 'router', 'php'), array(KPATH_SITE, 'kunena', 'php'));
$lang = JFactory::getLanguage();
$lang->load('com_kunena', JPATH_SITE) || $lang->load('com_kunena', KPATH_SITE);
$this->createMenu(false);
// Fix broken category aliases (workaround for < 2.0-DEV12 bug)
$count = KunenaForumCategoryHelper::fixAliases();
$md5 = md5_file(KPATH_ADMIN . '/api.new.php');
foreach ($entryfiles as $fileparts) {
list($path, $filename, $ext) = $fileparts;
if (is_file("{$path}/{$filename}.new.{$ext}")) {
$success = JFile::delete("{$path}/{$filename}.{$ext}");
if (!$success) {
$this->addStatus(JText::_('COM_KUNENA_INSTALL_DELETE_STATUS_FAIL') . " {$filename}.{$ext}", false, '');
}
$success = JFile::move("{$path}/{$filename}.new.{$ext}", "{$path}/{$filename}.{$ext}");
if (!$success) {
$this->addStatus(JText::_('COM_KUNENA_INSTALL_RENAMING_FAIL') . " {$filename}.new.{$ext}", false, '');
}
}
}
// Clean cache, just in case
KunenaMenuHelper::cleanCache();
JFactory::getCache('com_kunena')->clean();
// Test if api file has been fully copied
$this->waitFile(KPATH_ADMIN . "/api.php", $md5);
if (!$this->getInstallError()) {
$this->updateVersionState('');
$this->addStatus(JText::_('COM_KUNENA_INSTALL_SUCCESS'), true, '');
$this->setStep($this->getStep() + 1);
}
}
示例7: KunenaControllerInstall
// Safety check to prevent fatal error if 'System - Kunena Forum' plug-in has been disabled.
if ($app->input->getCmd('view') == 'install' || !class_exists('KunenaForum') || !KunenaForum::isCompatible('4.0')) {
// Run installer instead..
require_once __DIR__ . '/install/controller.php';
$controller = new KunenaControllerInstall();
// TODO: execute special task that checks what's wrong
$controller->execute($app->input->getCmd('task'));
$controller->redirect();
return;
}
if ($app->input->getCmd('view') == 'uninstall') {
$allowed = $app->getUserState('com_kunena.uninstall.allowed');
if ($allowed) {
require_once __DIR__ . '/install/controller.php';
$controller = new KunenaControllerInstall();
$controller->execute('uninstall');
$controller->redirect();
$app->setUserState('com_kunena.uninstall.allowed', null);
return;
}
}
// Initialize Kunena Framework.
KunenaForum::setup();
// Initialize custom error handlers.
KunenaError::initialize();
// Kunena has been successfully installed: Load our main controller.
$controller = KunenaController::getInstance();
$controller->execute($app->input->getCmd('task'));
$controller->redirect();
// Remove custom error handlers.
KunenaError::cleanup();
示例8: stepFinish
public function stepFinish()
{
KunenaForum::setup();
$lang = JFactory::getLanguage();
$lang->load('com_kunena', JPATH_SITE) || $lang->load('com_kunena', KUNENA_INSTALLER_SITEPATH);
$this->createMenu(false);
// Fix broken category aliases (workaround for < 2.0-DEV12 bug)
KunenaForumCategoryHelper::fixAliases();
// Clean cache, just in case
KunenaMenuHelper::cleanCache();
/** @var JCache|JCacheController $cache */
$cache = JFactory::getCache();
$cache->clean('com_kunena');
// Delete installer file (only if not using GIT build).
if (!KunenaForum::isDev()) {
JFile::delete(KPATH_ADMIN . '/install.php');
}
if (!$this->getInstallError()) {
$this->updateVersionState('');
$this->addStatus(JText::_('COM_KUNENA_INSTALL_SUCCESS'), true, '');
$this->setStep($this->getStep() + 1);
}
}
示例9: _initialize_kunena
/**
* A private function that is used to initialize kunena app
*
* @return boolean true if success, false if not compatible kunena installation found
*/
private static function _initialize_kunena()
{
if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) {
return false;
}
KunenaForum::setup();
return true;
}
示例10: onContentBeforeDisplay
/**
* Before display content method.
*
* Method is called by the view and the results are imploded and displayed in a placeholder.
*
* @param string $context The context for the content passed to the plugin.
* @param object $article The content object. Note $article->text is also available
* @param object $params The content params
* @param integer $limitstart The 'page' number
*
* @return string
*/
public function onContentBeforeDisplay($context, &$article, &$params, $limitstart = 0)
{
static $loaded = false;
// Initialize plug-in during the first run.
if (!$loaded) {
$loaded = true;
// Load language files and setup Kunena libraries.
$this->loadLanguage();
KunenaForum::setup();
KunenaFactory::loadLanguage();
// Create Kunena Discuss table if it doesn't exist.
$this->createTable();
}
// Make sure that event gets only called once.
if (self::$inevent) {
return '';
}
self::$inevent = true;
$this->prepare($context, $article, $params);
self::$inevent = false;
return '';
}
示例11: setup
/**
* Method to setup the indexer to be run.
*
* @return boolean True on success.
*
* @since 2.5
*/
protected function setup()
{
// Initialize CLI
$api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
if (is_file($api)) {
require_once $api;
}
// Check if Kunena has been installed.
if (!class_exists('KunenaForum') || !KunenaForum::isCompatible('4.0') || !KunenaForum::installed()) {
return false;
}
KunenaForum::setup();
return true;
}
示例12: checkDependencies
protected function checkDependencies()
{
// Test if Kunena is installed and if the minimum version requirement is met
$minKunenaVersion = '2.0.1';
if (!class_exists('KunenaForum') || !KunenaForum::isCompatible($minKunenaVersion)) {
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_KUNENAIMPORTER_DEPENDENCY_FAIL', $minKunenaVersion), 'error');
return false;
}
KunenaForum::setup();
return true;
}
示例13: uddeIMgetPicOnly
//.........这里部分代码省略.........
// $api_KUN = JPATH_SITE.'/components/com_kunena/lib/kunena.config.class.php';
// if ( file_exists($api_KUN) ) {
// require_once($api_KUN);
// $kcfg = KunenaFactory::getConfig();
//}
$sql="SELECT avatar FROM #__kunena_users WHERE userid=".(int)$ofanid." LIMIT 1";
$database->setQuery($sql);
$ofanavatar=$database->loadResult();
$filenameglocal = "/media/kunena/avatars/".$ofanavatar;
$filenameglive = uddeIMgetPath('live_site') ."/media/kunena/avatars/".$ofanavatar;
$filename2local = "/media/kunena/avatars/s_nophoto.jpg";
$filename2live = uddeIMgetPath('live_site') ."/media/kunena/avatars/s_nophoto.jpg";
if (uddeIMfileExists($filenameglocal)) {
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
} elseif ($config->gravatar) {
$email = uddeIMgetEMailFromID((int)$ofanid, $config);
$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
} elseif (uddeIMfileExists($filename2local)) {
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
}
if ($noanchor)
$gimmeback = $imgurl;
else
$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);
} elseif ($config->showcbpic==10) { // NINJABOARD
// $filenameglocal = "/media/com_ninjaboard/images/avatars/".$ofanid."/avatar.png";
// $filenameglive = uddeIMgetPath('live_site') ."/media/com_ninjaboard/images/avatars/".$ofanid."/avatar.png";
// if (uddeIMfileExists($filenameglocal)) {
// $gimmeback = uddeIMgetLinkOnly($ofanid, "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />", $config);
// }
$filenameglive = uddeIMgetPath('live_site') ."/index.php?view=avatar&id=".$ofanid."&thumbnail=large";
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
if ($noanchor)
$gimmeback = $imgurl;
else
$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);
} elseif ($config->showcbpic==11 || $config->showcbpic==12) { // KUNENA 2.0+, 3.0+
$sizex = $sizey = $grsize;
$class = 'avatar';
KunenaForum::setup();
$isInstalled = KunenaForum::installed ();
if ($isInstalled) {
$user = KunenaUserHelper::get($ofanid);
// $user = KunenaFactory::getUser();
// Get avatar URL "/media/kunena/avatars/path/file.jpg"
$avatarUrl = $user->getAvatarURL($sizex, $sizey);
// Get avatar <img> tag
$avatarHtml = $user->getAvatarImage($class, $sizex, $sizey);
// Get profile link with avatar pointing to profile page
$userLink = $user->getLink(null, $avatarHtml);
$filenameglocal = $avatarUrl;
$filenameglive = $avatarHtml;
if (!empty($avatarUrl)) {
$imgurl = $filenameglive;
} elseif ($config->gravatar) {
$email = uddeIMgetEMailFromID((int)$ofanid, $config);
$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
} else {
$imgurl = "";
}
if ($noanchor)
$gimmeback = $imgurl;
else
$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);
}
} elseif ($config->showcbpic==0 && $config->gravatar) { // disabled, but gravatar enabled
$email = uddeIMgetEMailFromID((int)$ofanid, $config);
$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
if ($noanchor)
$gimmeback = $imgurl;
else
$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);
}
return $gimmeback;
}