本文整理汇总了PHP中XenForo_Application::set方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::set方法的具体用法?PHP XenForo_Application::set怎么用?PHP XenForo_Application::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHtml
public function renderHtml()
{
XenForo_Application::set('view', $this);
$bbCodeBase = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Base', array('view' => $this));
$commentBbCode = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view', $this));
$bbCodeParser = XenForo_BbCode_Parser::create($bbCodeBase);
$commentBbCodeParser = XenForo_BbCode_Parser::create($commentBbCode);
$bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'team_post', 'contentIdKey' => 'post_id');
$this->_params['team']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['team']['about'], $bbCodeParser);
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
foreach ($this->_params['posts'] as &$post) {
if (!$post['comments']) {
continue;
}
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($post['comments'], $commentBbCodeParser, array());
}
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['stickyPosts'], $bbCodeParser, $bbCodeOptions);
foreach ($this->_params['stickyPosts'] as &$post) {
if (!$post['comments']) {
continue;
}
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($post['comments'], $commentBbCodeParser, array());
}
unset($post);
$this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate($this, 'message', '', array('json' => array('buttonConfig' => $this->_params['customEditor']), 'height' => '60px'));
}
示例2: listen
public static function listen($hookName, &$content, array $hookParams, XenForo_Template_Abstract $template)
{
if ($hookName == 'editor') {
$params = $template->getParams();
$options = XenForo_Application::get('options');
if ($options->dark_minorin_enabled) {
$smilies = array();
$toolbar_bbcode = array();
$toolbar_bbcode_temp = explode("\n", str_replace("\r", "", trim($options->dark_minorin_bbcode)));
foreach ($toolbar_bbcode_temp as $bbcode) {
$bbcode = explode(":", trim($bbcode));
$toolbar_bbcode[$bbcode[0]] = $bbcode[1];
}
if (XenForo_Application::isRegistered('smilies')) {
$smilies = XenForo_Application::get('smilies');
} else {
$smilies = XenForo_Model::create('XenForo_Model_Smilie')->getAllSmiliesForCache();
XenForo_Application::set('smilies', $smilies);
}
foreach ($smilies as &$smilie) {
$smilie['text'] = $smilie['smilieText'][0];
$smilie['sprite_mode'] = array_key_exists('sprite_params', $smilie);
}
$params += array('minorin' => array("toolbar_bbcode" => $toolbar_bbcode, "toolbar_smilies" => $smilies, "enabled" => $options->dark_minorin_enabled, "js_modification" => filemtime("js/dark/minorin.js")));
}
$content .= $template->create('dark_minorin_toolbar', $params);
}
}
示例3: getTaigaChatStuff
public static function getTaigaChatStuff(&$response, $action, $dis = false)
{
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
$smilies = array();
$toolbar_bbcode = array();
if ($options->dark_taigachat_toolbar) {
$toolbar_bbcode_temp = explode("\n", str_replace("\r", "", trim($options->dark_taigachat_toolbar_bbcode)));
foreach ($toolbar_bbcode_temp as $bbcode) {
$bbcode = explode(":", trim($bbcode));
$toolbar_bbcode[$bbcode[0]] = $bbcode[1];
}
if (XenForo_Application::isRegistered('smilies')) {
$smilies = XenForo_Application::get('smilies');
} else {
$smilies = XenForo_Model::create('XenForo_Model_Smilie')->getAllSmiliesForCache();
XenForo_Application::set('smilies', $smilies);
}
foreach ($smilies as &$smilie) {
$smilie['text'] = $smilie['smilieText'][0];
$smilie['sprite_mode'] = array_key_exists('sprite_params', $smilie);
}
}
if (empty($response->params['taigachat'])) {
$response->params['taigachat'] = array();
}
// Don't forget to add to dark_taigachat template too
$response->params['taigachat'] += array("refreshtime" => $options->dark_taigachat_refreshtime, "maxrefreshtime" => $options->dark_taigachat_maxrefreshtime, "enabled" => $options->dark_taigachat_enabled, "maxlength" => $options->dark_taigachat_maxlength, "reverse" => $options->dark_taigachat_direction, "height" => $options->dark_taigachat_height, "route" => $options->dark_taigachat_route, "timedisplay" => $options->dark_taigachat_timedisplay, "toolbar" => $options->dark_taigachat_toolbar, "toolbar_bbcode" => $toolbar_bbcode, "toolbar_smilies" => $smilies, "thumbzoom" => $options->dark_taigachat_imagemode == 'ThumbZoom', "js_modification" => filemtime("js/dark/taigachat.js"), "canView" => $visitor->hasPermission('dark_taigachat', 'view'), "canPost" => $visitor->hasPermission('dark_taigachat', 'post'), "sidebar" => $response->viewName != "Dark_TaigaChat_ViewPublic_TaigaChat_Index" && $action != 'popup', "popup" => $action == 'popup', "limit" => $response->viewName != "Dark_TaigaChat_ViewPublic_TaigaChat_Index" && $action != 'popup' ? $options->dark_taigachat_sidebarperpage : $options->dark_taigachat_fullperpage);
}
示例4: renderHtml
public function renderHtml()
{
XenForo_Application::set('view', $this);
$bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$this->_params['team']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['team']['about'], $bbCodeParser);
foreach ($this->_params['customFieldsGrouped'] as $id => &$fields) {
if (empty($fields['fieldChoices'])) {
// hard remove if custom fields did not have any values
// @link https://nobita.me/threads/227/
unset($this->_params['customFieldsGrouped'][$id]);
continue;
}
foreach ($fields as &$field) {
if ($field['field_type'] == 'bbcode') {
$field['fieldValueHtml'] = new XenForo_BbCode_TextWrapper($field['field_value'], $bbCodeParser);
} else {
$field['fieldValueHtml'] = Nobita_Teams_ViewPublic_Helper_Team::getTeamFieldValueHtml($this->_params['team'], $field, $field['field_value']);
}
}
}
unset($fields, $field);
foreach ($this->_params['parentTabsGrouped'] as &$fields) {
foreach ($fields as &$field) {
if ($field['field_type'] == 'bbcode') {
$field['fieldValueHtml'] = new XenForo_BbCode_TextWrapper($field['field_value'], $bbCodeParser);
} else {
$field['fieldValueHtml'] = Nobita_Teams_ViewPublic_Helper_Team::getTeamFieldValueHtml($this->_params['team'], $field, $field['field_value']);
}
}
}
}
示例5: _handleCustomPreloadedData
/**
* Handles the custom data that needs to be preloaded.
*
* @param array $data Data that was loaded. Unsuccessfully loaded items will have a value of null
*/
protected function _handleCustomPreloadedData(array &$data)
{
if (!is_array($data['routesAdmin'])) {
$data['routesAdmin'] = XenForo_Model::create('XenForo_Model_RoutePrefix')->rebuildRoutePrefixTypeCache('admin');
}
XenForo_Link::setHandlerInfoForGroup('admin', $data['routesAdmin']);
if (!is_array($data['adminStyleProperties'])) {
$data['adminStyleProperties'] = XenForo_Model::create('XenForo_Model_StyleProperty')->rebuildPropertyCacheInStyleAndChildren(-1);
}
XenForo_Application::set('adminStyleProperties', $data['adminStyleProperties']);
if (!is_int($data['adminStyleModifiedDate'])) {
$data['adminStyleModifiedDate'] = 0;
}
XenForo_Application::set('adminStyleModifiedDate', $data['adminStyleModifiedDate']);
if (!is_array($data['adminSearchTypes'])) {
try {
$data['adminSearchTypes'] = XenForo_Model::create('XenForo_Model_AdminSearch')->rebuildSearchTypesCache();
} catch (Exception $e) {
$data['adminSearchTypes'] = array();
}
}
XenForo_Application::set('adminSearchTypes', $data['adminSearchTypes']);
XenForo_Application::$allowManualDeferred = true;
XenForo_Application::$javaScriptUrl = 'js';
}
示例6: renderHtml
public function renderHtml()
{
XenForo_Application::set('view', $this);
$bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewImages']), 'showSignature' => false);
$this->_params['update']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['update'], $bbCodeParser, $bbCodeOptions);
}
示例7: templatePostRender
public static function templatePostRender($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
{
$param = array();
switch ($templateName) {
case 'node_list.css':
$cacheDataForum = XenForo_Application::isRegistered('brcnsCacheDataForum') ? XenForo_Application::get('brcnsCacheDataForum') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataForum');
$cacheDataPage = XenForo_Application::isRegistered('brcnsCacheDataPage') ? XenForo_Application::get('brcnsCacheDataPage') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataPage');
$cacheDataLink = XenForo_Application::isRegistered('brcnsCacheDataLink') ? XenForo_Application::get('brcnsCacheDataLink') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataLink');
$cacheDataCategory = XenForo_Application::isRegistered('brcnsCacheDataCategory') ? XenForo_Application::get('brcnsCacheDataCategory') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataCategory');
$cacheDataCategoryRoot = XenForo_Application::isRegistered('brcnsCacheDataCateRoot') ? XenForo_Application::get('brcnsCacheDataCateRoot') : XenForo_Model::create('XenForo_Model_DataRegistry')->get('brcnsCacheDataCateRoot');
XenForo_Application::set('brcnsCustomNodeStylesForum', $cacheDataForum);
XenForo_Application::set('brcnsCustomNodeStylesPage', $cacheDataPage);
XenForo_Application::set('brcnsCustomNodeStylesLink', $cacheDataLink);
XenForo_Application::set('brcnsCustomNodeStylesCategory', $cacheDataCategory);
XenForo_Application::set('brcnsCustomNodeStylesCategoryRoot', $cacheDataCategoryRoot);
$param['CustomNodeStylesForums'] = XenForo_Application::get('brcnsCustomNodeStylesForum');
$param['CustomNodeStylesPages'] = XenForo_Application::get('brcnsCustomNodeStylesPage');
$param['CustomNodeStylesLinks'] = XenForo_Application::get('brcnsCustomNodeStylesLink');
$param['CustomNodeStylescategories'] = XenForo_Application::get('brcnsCustomNodeStylesCategory');
$param['CustomNodeStylesCategoriesRoot'] = XenForo_Application::get('brcnsCustomNodeStylesCategoryRoot');
$options = XenForo_Application::get('options');
$param['size'] = $options->BRCNS_size_icon;
$newTemplate = $template->create('BRCNS_custom_node_style.css', $template->getParams());
$newTemplate->setParams($param);
$content = $content . $newTemplate->render();
break;
}
}
示例8: rebuildListenerClassCache
public function rebuildListenerClassCache()
{
$listenerClasses = $this->getAllListenerClassesForCache();
$listenerClasses = $this->rebuildListenerClassCodeListener($listenerClasses);
$this->_getDataRegistryModel()->set('brListenerClasses', $listenerClasses);
XenForo_Application::set('brListenerClasses', $listenerClasses);
return $listenerClasses;
}
示例9: getAllCategories
public function getAllCategories()
{
if (!XenForo_Application::isRegistered('elportal_allcategories')) {
$categories = $this->getCategories();
XenForo_Application::set('elportal_allcategories', $categories);
}
return XenForo_Application::get('elportal_allcategories');
}
示例10: getTaigaChatStuff
public static function getTaigaChatStuff(&$response, $action, $dis = false)
{
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
/** @var Dark_TaigaChat_Model_TaigaChat */
$taigamodel = XenForo_Model::create("Dark_TaigaChat_Model_TaigaChat");
$visitor = XenForo_Visitor::getInstance();
/** @var Dark_TaigaChat_Model_TaigaChat */
$taigamodel->updateActivity($visitor['user_id'], false);
$smilies = array();
$toolbar_bbcode = array();
if ($options->dark_taigachat_toolbar) {
$toolbar_bbcode_temp2 = preg_replace('#(^//.+$)#mi', '', trim($options->dark_taigachat_toolbar_bbcode));
$toolbar_bbcode_temp2 = str_replace("\r", "", $toolbar_bbcode_temp2);
if (!empty($toolbar_bbcode_temp2)) {
$toolbar_bbcode_temp = explode("\n", $toolbar_bbcode_temp2);
foreach ($toolbar_bbcode_temp as $bbcode) {
$bbcode = trim($bbcode);
if (!empty($bbcode)) {
$bbcode = explode(":", trim($bbcode));
if (!empty($bbcode)) {
$toolbar_bbcode[$bbcode[0]] = $bbcode[1];
}
}
}
}
if (XenForo_Application::isRegistered('smilies')) {
$smilies = XenForo_Application::get('smilies');
} else {
$smilies = XenForo_Model::create('XenForo_Model_Smilie')->getAllSmiliesForCache();
XenForo_Application::set('smilies', $smilies);
}
foreach ($smilies as &$smilie) {
$smilie['text'] = $smilie['smilieText'][0];
$smilie['sprite_mode'] = array_key_exists('sprite_params', $smilie);
}
}
if (empty($response->params['taigachat'])) {
$response->params['taigachat'] = array();
}
if (!XenForo_Application::isRegistered('config')) {
$path = 'data';
} else {
$path = XenForo_Application::get('config')->externalDataPath;
}
if ($path == 'data' && $options->dark_taigachat_speedmode == 'Https') {
$path = $options->boardUrl . '/' . $path;
}
$isSidebar = $response->viewName != "Dark_TaigaChat_ViewPublic_TaigaChat_Index" && $action != 'popup' && $action != 'xenporta_alt';
//$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base'));
//$motd = new XenForo_BbCode_TextWrapper($options->dark_taigachat_motd, $bbCodeParser);
$motd = false;
if (!empty($options->dark_taigachat_motd)) {
$motd = " ";
}
// Don't forget to add to dark_taigachat template too
$response->params['taigachat'] += array("focusedrefreshtime" => $options->dark_taigachat_focusedrefreshtime, "unfocusedrefreshtime" => $options->dark_taigachat_unfocusedrefreshtime, "tabunfocusedrefreshtime" => $options->dark_taigachat_tabunfocusedrefreshtime, "enabled" => true, "maxlength" => $options->dark_taigachat_maxlength, "reverse" => $options->dark_taigachat_direction, "height" => $options->dark_taigachat_height, "route" => $options->dark_taigachat_route, "timedisplay" => $options->dark_taigachat_timedisplay, "toolbar" => $options->dark_taigachat_toolbar, "ignorehide" => $options->dark_taigachat_ignorehide, "showAlert" => $options->dark_taigachat_showalert, "toolbar_bbcode" => $toolbar_bbcode, "toolbar_smilies" => $smilies, "activity_newtab" => $options->dark_taigachat_activity_newtab, "thumbzoom" => $options->dark_taigachat_imagemode == 'ThumbZoom', "js_modification" => filemtime("js/dark/taigachat.js"), "canView" => $visitor->hasPermission('dark_taigachat', 'view'), "canPost" => $visitor->hasPermission('dark_taigachat', 'post'), "canBan" => $visitor->hasPermission('dark_taigachat', 'ban'), "canColor" => $taigamodel->canUseColor(), "color" => $visitor->taigachat_color, "canModify" => $visitor->hasPermission('dark_taigachat', 'modify'), "canModifyAll" => $visitor->hasPermission('dark_taigachat', 'modifyAll'), "canMotd" => $visitor->hasPermission('dark_taigachat', 'motd'), "motd" => $motd, "sidebar" => $isSidebar, "popup" => $action == 'popup', "limit" => $isSidebar ? $options->dark_taigachat_sidebarperpage : $options->dark_taigachat_fullperpage, "speed" => $options->dark_taigachat_speedmode != 'Disabled', "speedurl" => $isSidebar ? $path . '/taigachat/messagesmini.html' : $path . '/taigachat/messages.html');
}
示例11: getBbmButtons
public static function getBbmButtons()
{
if (XenForo_Application::isRegistered('bbm_buttons')) {
$bbmButtons = XenForo_Application::get('bbm_buttons');
} else {
$bbmButtons = XenForo_Model::create('XenForo_Model_DataRegistry')->get('bbm_buttons');
XenForo_Application::set('bbm_buttons', $bbmButtons);
}
return $bbmButtons;
}
示例12: getDb
public static function getDb()
{
if (!XenForo_Application::get('AWickham_SourceBansSync_Db')) {
// get the options
$options = XenForo_Application::get('options');
$db = Zend_Db::factory(array('host' => $dbConfig->host, 'port' => $dbConfig->port, 'username' => $dbConfig->username, 'password' => $dbConfig->password, 'dbname' => $dbConfig->dbname, 'charset' => 'utf8'));
XenForo_Application::set('AWickham_SourceBansSync_Db', $db);
}
return XenForo_Application::get('AWickham_SourceBansSync_Db');
}
示例13: __construct
public function __construct()
{
$startTime = microtime(true);
$fileDir = XF_ROOT;
require $fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Session::startPublicSession();
}
示例14: _setupSession
/**
* Setup the session.
*
* @param string $action
*/
protected function _setupSession($action)
{
if (XenForo_Application::isRegistered('session')) {
return;
}
$session = new XenForo_Session(array('admin' => true));
XenForo_Application::set('session', $session);
$session->start();
XenForo_Visitor::setup($session->get('user_id'));
}
示例15: __construct
public function __construct($root = XF_ROOT)
{
$startTime = microtime(true);
$fileDir = $root;
require $fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir, true, array('resetOutputBuffering' => false));
XenForo_Application::set('page_start_time', $startTime);
XenForo_Session::startPublicSession();
}