本文整理汇总了PHP中XenForo_Application::getFc方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::getFc方法的具体用法?PHP XenForo_Application::getFc怎么用?PHP XenForo_Application::getFc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::getFc方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _postSave
/**
* Post-save handling.
*
* Note: not run when importing
*/
protected function _postSave()
{
parent::_postSave();
if ($this->isInsert() && !empty(XenForo_Application::getOptions()->dpAnalyticsEvents['report']) && !empty(XenForo_Application::getOptions()->dpAnalyticsInternal['v'])) {
if (XenForo_Application::isRegistered('fc')) {
if (XenForo_Application::getFc()->route()->getAction() == 'report') {
$customFields = XenForo_Visitor::getInstance()->get('customFields');
$label = null;
$reportModel = $this->_getReportModel();
if ($report = $reportModel->getReportById($this->get('report_id'))) {
if ($reportHandler = Xenforo_Model::create('XenForo_Model_Report')->getReportHandler($report['content_type'])) {
$label = (string) $reportHandler->getContentTitle($report, unserialize($report['content_info']));
}
}
DigitalPointBetterAnalytics_Helper_Analytics::getInstance()->event(XenForo_Application::getOptions()->googleAnalyticsWebPropertyId, @$customFields['analytics_cid'], XenForo_Visitor::getUserId(), @$_SERVER['REMOTE_ADDR'], 'Report', 'Reported', $label);
}
}
}
}
示例2: _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);
}
}
示例3: renderHtml
public function renderHtml()
{
header('Cache-Control: public, max-age=31536000');
header('Content-Type: application/javascript');
$templateObject = XenForo_Application::getFc()->getDependencies()->createTemplateObject($this->_templateName);
$templateObject->setLanguageId(XenForo_Phrase::getLanguageId());
$templateObject->setStyleId(XenForo_Application::get('options')->defaultStyleId);
echo $templateObject->render();
exit;
}
示例4: parseRouteUrl
/**
* Parses a URL that should contain a route match in it into
* the route match and any request params set by it.
*
* @param string $url
*
* @return array|bool False if parsing fails, otherwise array with match and params keys
*/
public function parseRouteUrl($url)
{
if (!XenForo_Application::isRegistered('fc')) {
return false;
}
$requestPaths = XenForo_Application::get('requestPaths');
$url = XenForo_Link::convertUriToAbsoluteUri($url);
if (strpos($url, $requestPaths['fullBasePath']) !== 0) {
return false;
}
$urlParts = parse_url($url);
$requestUri = (isset($urlParts['path']) ? $urlParts['path'] : '/') . (isset($urlParts['query']) ? '?' . $urlParts['query'] : '');
$request = clone $this->_request;
$request->setRequestUri($requestUri);
$match = XenForo_Application::getFc()->getDependencies()->getRouter()->match($request);
return array('match' => $match, 'params' => $request->getUserParams());
}
示例5: renderSocialBar
public static function renderSocialBar($contents, $params, $template)
{
try {
$requestParams = XenForo_Application::getFc()->getRequest()->getParams();
} catch (Exception $e) {
return;
}
$route = substr($requestParams['_origRoutePath'], 0, strpos($requestParams['_origRoutePath'], '/'));
switch (true) {
case isset($requestParams['thread_id']):
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('full:threads', array('thread_id' => $requestParams['thread_id'], 'title' => $title));
break;
case isset($requestParams['user_id']):
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('full:members', array('user_id' => $requestParams['user_id'], 'username' => $title));
break;
case isset($requestParams['resource_id']):
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('full:resources', array('resource_id' => $requestParams['resource_id'], 'title' => $title));
break;
case isset($requestParams['resource_category_id']):
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('full:resources/categories', array('resource_category_id' => $requestParams['resource_category_id'], 'category_title' => $title));
break;
case substr($route, 0, 9) == 'resources':
$url = XenForo_Link::buildPublicLink('full:resources');
break;
case substr($route, 0, 21) == 'subdomain-marketplace':
if (isset($requestParams['item_id']) && substr($requestParams['_origRoutePath'], -9) == '/articles') {
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('subdomain-marketplace/articles', array('article_category_id' => $requestParams['item_id'], 'category_name' => $title));
} elseif (isset($requestParams['item_id']) && substr($requestParams['_origRoutePath'], -8) == '/article') {
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('subdomain-marketplace/article', array('article_group_id' => $requestParams['item_id'], 'title' => $title));
} elseif (isset($requestParams['item_id']) && substr($requestParams['_origRoutePath'], -9) != '/category') {
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('subdomain-marketplace/item', array('item_id' => $requestParams['item_id'], 'title' => $title));
} elseif (isset($requestParams['item_id'])) {
$title = self::_getTitle($requestParams['_matchedRoutePath']);
$url = XenForo_Link::buildPublicLink('subdomain-marketplace/category', array('category_id' => $requestParams['item_id'], 'name' => $title));
} else {
$url = XenForo_Link::buildPublicLink('subdomain-marketplace');
}
break;
case substr($route, 0, 22) == 'subdomain-advertising':
$url = XenForo_Link::buildPublicLink('subdomain-advertising');
break;
case substr($route, 0, 9) == 'subdomain':
if (substr_count($requestParams['_origRoutePath'], '/') > 1) {
$url = XenForo_Link::buildPublicLink('full:' . $route);
} else {
$url = XenForo_Link::buildPublicLink('full:' . $requestParams['_origRoutePath']);
}
break;
case substr($requestParams['_origRoutePath'], 0, 5) == 'help/':
$urlBuild = parse_url(XenForo_Link::buildPublicLink('full:help'));
$url = $urlBuild['scheme'] . '://' . $urlBuild['host'] . '/';
break;
default:
if (!empty($requestParams['node_id']) || !empty($requestParams['node_name'])) {
$title = self::_getTitle($requestParams['_matchedRoutePath']);
if (substr($requestParams['_matchedRoutePath'], 0, 6) == 'pages/') {
$url = XenForo_Link::buildPublicLink('full:pages', array('node_id' => @$requestParams['node_id'], 'node_name' => @$requestParams['node_name'], 'title' => $title));
break;
} elseif (substr($requestParams['_matchedRoutePath'], 0, 7) == 'forums/') {
$url = XenForo_Link::buildPublicLink('full:forums', array('node_id' => @$requestParams['node_id'], 'node_name' => @$requestParams['node_name'], 'title' => $title));
break;
}
}
$url = XenForo_Link::buildPublicLink('full:index');
}
if (substr($url, 0, 2) == '//') {
$url = 'https:' . $url;
}
$forum = $template->getParam('forum');
if (empty($forum['dp_twitter_slug'])) {
$twitterSlug = XenForo_Application::getOptions()->dpTwitterDefaultList;
} else {
$twitterSlug = $forum['dp_twitter_slug'];
}
return $template->create('social_bar', array('twitter_slug' => $twitterSlug, 'url' => $url, 'xenOptions' => XenForo_Application::getOptions()->getOptions()))->render();
}
示例6: actionBlockers
/**
* Just going to reroute to the normal user search results rather than reinvent the wheel.
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionBlockers()
{
XenForo_Application::getFc()->getRequest()->setParam('criteria', array('custom' => array('analytics_cid' => 'DP.')));
return $this->responseReroute('XenForo_ControllerAdmin_User', 'list');
}