本文整理汇总了PHP中XenForo_Application::isRegistered方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::isRegistered方法的具体用法?PHP XenForo_Application::isRegistered怎么用?PHP XenForo_Application::isRegistered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::isRegistered方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderCss
/**
* Render the CSS version of the... CSS!
*
* @return string
*/
public function renderCss()
{
XenForo_Template_Abstract::setLanguageId(0);
$bbCodeCache = $this->_params['bbCodeCache'];
$templateParams = array('displayStyles' => array(), 'smilieSprites' => $this->_params['smilieSprites'], 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'dir' => $this->_params['dir'], 'pageIsRtl' => $this->_params['dir'] == 'RTL');
$templates = array();
foreach ($this->_params['css'] as $cssTemplate) {
if (strpos($cssTemplate, 'public:') === 0) {
$templates[$cssTemplate] = new XenForo_Template_Public(substr($cssTemplate, strlen('public:')), $templateParams);
} else {
$templates[$cssTemplate] = $this->createTemplateObject($cssTemplate, $templateParams);
}
}
if (XenForo_Application::isRegistered('adminStyleModifiedDate')) {
$modifyDate = XenForo_Application::get('adminStyleModifiedDate');
} else {
$modifyDate = XenForo_Application::$time;
}
$this->_response->setHeader('Expires', 'Wed, 01 Jan 2020 00:00:00 GMT', true);
$this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $modifyDate) . ' GMT', true);
$this->_response->setHeader('Cache-Control', 'private', true);
$css = XenForo_CssOutput::renderCssFromObjects($templates, true);
$css = XenForo_CssOutput::prepareCssForOutput($css, $this->_params['dir'], false);
return $css;
}
示例2: actionAdmin
public function actionAdmin()
{
/** @var XenForo_Model_Admin $adminModel */
$adminModel = $this->getModelFromCache('XenForo_Model_Admin');
$visitor = XenForo_Visitor::getInstance();
$admin = $adminModel->getAdminById($visitor->user_id);
if ($this->_input->inRequest('language_id')) {
$this->_checkCsrfFromToken($this->_input->filterSingle('_xfToken', XenForo_Input::STRING));
$languageId = $this->_input->filterSingle('language_id', XenForo_Input::UINT);
if ($languageId) {
$languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache();
if (!isset($languages[$languageId])) {
$languageId = 0;
}
}
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Admin');
$dw->setExistingData($admin);
$dw->set('admin_language_id', $languageId);
$dw->save();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
} else {
$viewParams = array('languages' => $this->getModelFromCache('XenForo_Model_Language')->getAllLanguages(), 'redirect' => $this->_input->filterSingle('redirect', XenForo_Input::STRING));
return $this->responseView('XenForo_ViewAdmin_Language_Admin', 'language_chooser', $viewParams);
}
}
示例3: buildLink
/**
*
* @see XenForo_Route_Prefix_Forums::buildLink()
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
if (isset($data['social_forum_id'])) {
if (ThemeHouse_SocialGroups_SocialForum::hasInstance()) {
$socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance()->toArray();
} else {
$socialForum = $data;
}
$class = XenForo_Application::resolveDynamicClass('ThemeHouse_SocialGroups_Route_Prefix_SocialForums', 'route_prefix');
$router = new $class();
$link = $router->buildLink('social-forums', 'social-forums', $action, $extension, $socialForum, $extraParams);
if (XenForo_Application::isRegistered('routeFiltersOut')) {
$routeFilters = XenForo_Application::get('routeFiltersOut');
if (isset($routeFilters['social-forums'])) {
foreach ($routeFilters['social-forums'] as $filter) {
if (array_key_exists('find_route', $filter) && array_key_exists('replace_route', $filter)) {
list($from, $to) = XenForo_Link::translateRouteFilterToRegex($filter['find_route'], $filter['replace_route']);
$newLink = preg_replace($from, $to, $link);
} else {
$newLink = $link;
}
if ($newLink != $link) {
$link = $newLink;
break;
}
}
}
}
return $link;
}
return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
}
示例4: _getSocialNoticesContainerParams
/**
* Fetches all notices applicable to the visiting user
*
* @param array $params
* @param array $containerData
*
* @return array
*/
protected function _getSocialNoticesContainerParams(XenForo_ControllerResponse_View $controllerResponse, array $notices = array())
{
$socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance();
/* @var $noticeModel XenForo_Model_Notice */
$noticeModel = XenForo_Model::create('XenForo_Model_Notice');
if (XenForo_Application::get('options')->enableNotices) {
$user = XenForo_Visitor::getInstance()->toArray();
if (XenForo_Application::isRegistered('session')) {
$dismissedNotices = XenForo_Application::getSession()->get('dismissedNotices');
}
if (!isset($dismissedNotices) || !is_array($dismissedNotices)) {
$dismissedNotices = array();
}
// handle style overrides
$user['style_id'] = XenForo_Application::get('options')->defaultStyleId;
$noticeTokens = array('{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'), '{user_id}' => $user['user_id']);
$allNotices = $noticeModel->getNoticesForSocialForum($socialForum['social_forum_id']);
foreach ($allNotices as $noticeId => $notice) {
if (!in_array($noticeId, $dismissedNotices) && XenForo_Helper_Criteria::userMatchesCriteria($notice['user_criteria'], true, $user) && XenForo_Helper_Criteria::pageMatchesCriteria($notice['page_criteria'], true, $controllerResponse->params, $controllerResponse->containerParams)) {
$notices[$noticeId] = array('title' => $notice['title'], 'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']), 'wrap' => $notice['wrap'], 'dismissible' => $notice['dismissible'] && XenForo_Visitor::getUserId());
}
}
}
return $notices;
}
示例5: _setupSession
/**
* Setup the session.
*
* @param string $action
*/
protected function _setupSession($action)
{
if (XenForo_Application::isRegistered('session')) {
return;
}
XenForo_Session::startAdminSession($this->_request);
}
示例6: doJob
public static function doJob($method, $uri, array $params)
{
if (XenForo_Application::isRegistered('_bdApi_disableBatch') && XenForo_Application::get('_bdApi_disableBatch')) {
return array('_job_result' => 'error', '_job_error' => 'Batch running has been disabled.');
}
$fc = self::getFc();
$request = new bdApi_Zend_Controller_Request_Http(bdApi_Data_Helper_Core::safeConvertApiUriToAbsoluteUri($uri, true));
$request->setMethod($method);
foreach ($params as $key => $value) {
$request->setParam($key, $value);
}
$fc->setRequest($request);
// routing
$routeMatch = $fc->getDependencies()->route($request);
if (!$routeMatch or !$routeMatch->getControllerName()) {
list($controllerName, $action) = $fc->getDependencies()->getNotFoundErrorRoute();
$routeMatch->setControllerName($controllerName);
$routeMatch->setAction($action);
}
$response = $fc->dispatch($routeMatch);
if ($response instanceof XenForo_ControllerResponse_Error) {
return array('_job_result' => 'error', '_job_error' => $response->errorText);
} elseif ($response instanceof XenForo_ControllerResponse_Exception) {
return array('_job_result' => 'error', '_job_error' => $response->getMessage());
} elseif ($response instanceof XenForo_ControllerResponse_Message) {
return array('_job_result' => 'message', '_job_message' => $response->message);
} elseif ($response instanceof XenForo_ControllerResponse_View) {
return array('_job_result' => 'ok', '_job_response' => $response);
}
throw new XenForo_Exception('Unexpected $response occurred.');
}
示例7: renderCss
public function renderCss()
{
// re-implement XenForo_CssOutput::renderCss() so we can change how caching works
$cacheId = $this->getCacheId();
if ($cacheObject = XenForo_Application::getCache()) {
if ($cacheCss = $cacheObject->load($cacheId, true)) {
return $cacheCss . "\n/* CSS returned from cache. */";
}
}
$this->_prepareForOutput();
if (XenForo_Application::isRegistered('bbCode')) {
$bbCodeCache = XenForo_Application::get('bbCode');
} else {
$bbCodeCache = XenForo_Model::create('XenForo_Model_BbCode')->getBbCodeCache();
}
$params = array('displayStyles' => $this->_displayStyles, 'smilieSprites' => $this->_smilieSprites, 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'dir' => $this->_textDirection, 'pageIsRtl' => $this->_textDirection == 'RTL');
$templates = array();
foreach ($this->_cssRequested as $cssName) {
$cssName = trim($cssName);
if (!$cssName) {
continue;
}
$templateName = $cssName . '.css';
if (!isset($templates[$templateName])) {
$templates[$templateName] = new XenForo_Template_Public($templateName, $params);
}
}
$css = self::renderCssFromObjects($templates, XenForo_Application::debugMode());
$css = self::prepareCssForOutput($css, $this->_textDirection, XenForo_Application::get('options')->minifyCss && $cacheObject);
if ($cacheObject) {
$cacheObject->save($css, $cacheId, array(), 86400);
}
return $css;
}
示例8: controllerPreDispatch
public static function controllerPreDispatch(XenForo_Controller $controller, $action)
{
if ($controller instanceof XenForo_ControllerPublic_Abstract) {
if (self::$_updatedMediaCounts === false) {
self::$_updatedMediaCounts = true;
$options = XenForo_Application::getOptions();
$visitor = XenForo_Visitor::getInstance();
if ($options->xengalleryUnviewedCounter['enabled'] && $visitor->xengallery_unviewed_media_count && XenForo_Application::isRegistered('session')) {
$time = XenForo_Application::$time;
$session = XenForo_Application::get('session');
$mediaUnviewed = $session->get('mediaUnviewed');
if ($mediaUnviewed === false || $mediaUnviewed['lastUpdateDate'] < $time - $options->xengalleryUnviewedCounter['length'] * 60) {
/** @var $mediaModel XenGallery_Model_Media */
$mediaModel = XenForo_Model::create('XenGallery_Model_Media');
$unviewedIds = $mediaModel->getUnviewedMediaIds($visitor->user_id, array('viewCategoryIds' => $mediaModel->getViewableCategoriesForVisitor($visitor->toArray()), 'viewAlbums' => XenForo_Permission::hasPermission($visitor->permissions, 'xengallery', 'viewAlbums')));
if ($unviewedIds !== false) {
if (sizeof($unviewedIds)) {
$mediaUnviewed = array('unviewed' => array_combine($unviewedIds, $unviewedIds), 'lastUpdateDate' => $time);
} else {
$mediaUnviewed = self::_getDefaultUnviewedArray();
}
}
} elseif (!$visitor->user_id) {
$mediaUnviewed = self::_getDefaultUnviewedArray();
}
$session->set('mediaUnviewed', $mediaUnviewed);
}
}
}
}
示例9: actionIndex
public function actionIndex()
{
$codes = $this->_getBbmBBCodeModel()->getAllBbCodes();
$bbcodesWithCallbackErrors = $this->_classAndMethodIntegrityCheck($codes);
//Add class
foreach ($codes as &$code) {
if ($code['tag'][0] == '@') {
$code['class'] = 'orphanButton';
$code['orphanButton'] = true;
} else {
$code['class'] = 'normalButton';
$code['orphanButton'] = false;
}
$code['disableAddon'] = false;
if (XenForo_Application::isRegistered('addOns')) {
$enableAddons = XenForo_Application::get('addOns');
if (!empty($code['bbcode_addon']) && !isset($enableAddons[$code['bbcode_addon']])) {
$code['class'] .= ' disableAddon';
$code['disableAddon'] = true;
}
}
}
$viewParams = array('codes' => $codes, 'callbackErrors' => $bbcodesWithCallbackErrors, 'permsBbm' => XenForo_Visitor::getInstance()->hasAdminPermission('bbm_BbCodesAndButtons'));
return $this->responseView('Bbm_ViewAdmin_Bbm_BbCodes_List', 'bbm_bb_codes_list', $viewParams);
}
示例10: bakeBbmTags
public function bakeBbmTags()
{
$bbmTags = BBM_Helper_Bbm::getBbmBbCodes();
$activeAddons = XenForo_Application::isRegistered('addOns') ? XenForo_Application::get('addOns') : array();
$visitor = XenForo_Visitor::getInstance();
if (!is_array($bbmTags)) {
return false;
}
$allBbmTags = array();
foreach ($bbmTags as $bbm) {
if (!$bbm['active']) {
continue;
}
if (!empty($activeAddons) && !empty($bbm['bbcode_addon'])) {
if (!isset($activeAddons[$bbm['bbcode_addon']])) {
//Skip Bb Codes linked to an addon when this addon is disabled
continue;
}
}
$tagName = $bbm['tag'];
if (!empty($bbm['preParser'])) {
$this->addPreParserBbCode($tagName);
}
}
$this->_bbmTags = $allBbmTags;
/****
* XenForo Options - only need to call once the options
***/
$options = XenForo_Application::get('options');
if (!empty($options->Bbm_PreCache_XenTags)) {
foreach ($options->Bbm_PreCache_XenTags as $tagName) {
$this->addPreParserBbCode($tagName);
}
}
}
示例11: actionIndex
/**
* Displays a list of active reports for the visiting user.
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionIndex()
{
$reportId = $this->_input->filterSingle('report_id', XenForo_Input::UINT);
if ($reportId) {
return $this->responseReroute(__CLASS__, 'view');
}
$reportModel = $this->_getReportModel();
$activeReports = $reportModel->getActiveReports();
if (XenForo_Application::isRegistered('reportCounts')) {
$reportCounts = XenForo_Application::get('reportCounts');
if (count($activeReports) != $reportCounts['activeCount']) {
$reportModel->rebuildReportCountCache(count($activeReports));
}
}
XenForo_Application::getSession()->set('reportLastRead', XenForo_Application::$time);
$reports = $reportModel->getVisibleReportsForUser($activeReports);
$session = XenForo_Application::get('session');
$sessionReportCounts = $session->get('reportCounts');
if (!is_array($sessionReportCounts) || $sessionReportCounts['total'] != count($reports)) {
$sessionReportCounts = $reportModel->getSessionCountsForReports($reports, XenForo_Visitor::getUserId());
$sessionReportCounts['lastBuildDate'] = XenForo_Application::$time;
$session->set('reportCounts', $sessionReportCounts);
}
$closedReportsRaw = $reportModel->getClosedReportsInTimeFrame(XenForo_Application::$time - 86400, XenForo_Application::$time);
$viewParams = array('reports' => $reports, 'recentlyClosed' => $reportModel->getVisibleReportsForUser($closedReportsRaw));
return $this->responseView('XenForo_ViewPublic_Report_List', 'report_list', $viewParams);
}
示例12: match
/**
* Attempts to match the routing path. See {@link XenForo_Route_Interface} for further details.
*
* @param string $routePath Routing path
* @param Zend_Controller_Request_Http $request Request object
* @param XenForo_Router $router Routing object
*
* @return XenForo_RouteMatch|bool
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
if (!XenForo_Application::isRegistered('routeFiltersIn')) {
return false;
}
$filters = XenForo_Application::get('routeFiltersIn');
if (!$filters) {
return false;
}
foreach ($filters as $filter) {
if (isset($filter['match_regex'])) {
$from = $filter['match_regex'];
$to = $filter['match_replace'];
} else {
list($from, $to) = XenForo_Link::translateRouteFilterToRegex(urldecode($filter['replace_route']), urldecode($filter['find_route']));
}
$newRoutePath = preg_replace($from, $to, $routePath);
if ($newRoutePath != $routePath) {
$match = $router->getRouteMatch();
$match->setModifiedRoutePath($newRoutePath);
return $match;
}
}
return false;
}
示例13: get
public static function get($key)
{
if (self::$_options === null) {
self::$_options = XenForo_Application::get('options');
}
switch ($key) {
case 'applicationVersionId':
return XenForo_Application::$versionId;
case 'cacheCutoffDays':
return 7;
case 'indexTabId':
return 'WidgetFramework_home';
case 'layoutEditorEnabled':
if (self::$_layoutEditorEnabled === null) {
if (!XenForo_Application::isRegistered('session')) {
// no session yet...
return false;
}
$session = XenForo_Application::getSession();
self::$_layoutEditorEnabled = $session->get('_WidgetFramework_layoutEditor') === true;
if (!self::$_layoutEditorEnabled and !empty($_REQUEST['_layoutEditor'])) {
$visitor = XenForo_Visitor::getInstance();
if ($visitor->hasAdminPermission('style')) {
self::$_layoutEditorEnabled = true;
}
}
}
// use the cached value
return self::$_layoutEditorEnabled;
}
return self::$_options->get('wf_' . $key);
}
示例14: 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;
}
}
示例15: _postSave
/**
* Post-save handling.
*
* Note: not run when importing
*/
protected function _postSave()
{
parent::_postSave();
if ($this->isInsert() && !empty(XenForo_Application::getOptions()->dpAnalyticsEvents['registration']) && !empty(XenForo_Application::getOptions()->dpAnalyticsInternal['v'])) {
if (XenForo_Application::isRegistered('fc')) {
$action = preg_split('/\\b/', strtolower(trim(XenForo_Application::getFc()->route()->getAction())));
switch ($action[1]) {
case 'facebook':
$label = 'Facebook';
break;
case 'google':
$label = 'Google';
break;
case 'twitter':
$label = 'Twitter';
break;
default:
$label = 'Standard';
// would have preferred to leave this blank, but a null value causes it to be omitted from certain reports in Analytics
}
} else {
$label = null;
}
$user = $this->getMergedData();
if (XenForo_Application::isRegistered('fc')) {
$analyticsClientId = XenForo_Application::getFc()->getRequest()->getCookie('_ga');
} else {
$analyticsClientId = null;
}
DigitalPointBetterAnalytics_Helper_Analytics::getInstance()->event(XenForo_Application::getOptions()->googleAnalyticsWebPropertyId, $analyticsClientId, $user['user_id'], @$_SERVER['REMOTE_ADDR'], 'User', 'Registration', $label);
}
}