本文整理汇总了PHP中XenForo_Application类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application类的具体用法?PHP XenForo_Application怎么用?PHP XenForo_Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_Application类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _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);
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:37,代码来源:User.php
示例2: login
public function login($username, $password)
{
/**
* @var $loginModel XenForo_Model_Login
* @var $userModel XenForo_Model_User
* @var $session XenForo_Session
*/
$loginModel = XenForo_Model::create('XenForo_Model_Login');
$userModel = XenForo_Model::create('XenForo_Model_User');
$userId = $userModel->validateAuthentication($username, $password, $this->error);
//var_dump($userId);
//die;
if (!$userId) {
$loginModel->logLoginAttempt($username);
return false;
}
$loginModel->clearLoginAttempts($username);
/* if ($data['remember'])
{
$userModel->setUserRememberCookie($userId);
} */
XenForo_Model_Ip::log($userId, 'user', $userId, 'login');
$userModel->deleteSessionActivity(0, $this->getClientIp(false));
$session = XenForo_Application::get('session');
//die('aaabb');
/*if(!$this->session){
$this->session = XenForo_Application::get('session');
}*/
$session->changeUserId($userId);
XenForo_Visitor::setup($userId);
$this->visitor = XenForo_Visitor::getInstance();
$userInfo = $userModel->getFullUserById($this->visitor->getUserId());
return $userInfo;
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:34,代码来源:XfAuthentication.php
示例3: rebuild
/**
* @param int $position
* @param array $options
* @param string $detailedMessage
* @return bool|int|string|true
*/
public function rebuild($position = 0, array &$options = array(), &$detailedMessage = '')
{
$options['batch'] = max(1, isset($options['batch']) ? $options['batch'] : 10);
/* @var sonnb_XenGallery_Model_Location $locationModel */
$locationModel = XenForo_Model::create('sonnb_XenGallery_Model_Location');
$locations = $locationModel->getLocationsWithoutCoordinate($position, $options['batch']);
if (count($locations) < 1) {
return true;
}
XenForo_Db::beginTransaction();
$db = XenForo_Application::getDb();
/** @var sonnb_XenGallery_Model_Location $locationModel */
$locationModel = XenForo_Model::create('sonnb_XenGallery_Model_Location');
foreach ($locations as $locationId => $location) {
$position = $location['location_id'];
try {
$client = XenForo_Helper_Http::getClient($locationModel->getGeocodeUrlForAddress($location['location_name']));
$response = $client->request('GET');
$response = @json_decode($response->getBody(), true);
if (empty($response['results'][0])) {
continue;
}
$address = $response['results'][0]['formatted_address'];
$lat = $response['results'][0]['geometry']['location']['lat'];
$lng = $response['results'][0]['geometry']['location']['lng'];
$db->update('sonnb_xengallery_location', array('location_name' => $address, 'location_lat' => $lat, 'location_lng' => $lng), array('location_id = ?' => $location['location_id']));
} catch (Exception $e) {
continue;
}
}
XenForo_Db::commit();
$detailedMessage = XenForo_Locale::numberFormat($position);
return $position;
}
开发者ID:Sywooch,项目名称:forums,代码行数:40,代码来源:Location.php
示例4: getActiveRoutes
public function getActiveRoutes()
{
if ($this->routes != null) {
return $this->routes;
}
$routes = trim(XenForo_Application::get('options')->dark_azucloud_routes);
$routes = explode("\n", str_replace("\r", "", $routes));
$routes_extra = array();
foreach ($routes as $key => &$route) {
$route = trim($route);
if ($route == '') {
unset($routes[$key]);
continue;
}
// stick in a slash if there isn't already, otherwise remove it and keep existing either way
if (substr($route, -1) == '/') {
$routes_extra[] = substr($route, 0, strlen($route) - 1);
} else {
$routes_extra[] = $route . '/';
}
}
$routes = array_merge($routes, $routes_extra);
$this->routes = $routes;
return $routes;
}
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:Nakano.php
示例5: runSyncGroups
public static function runSyncGroups()
{
$QCDB = WebSync_Database_Core::getQuartzcoreDatabase();
$options = XenForo_Application::get('options');
$userModel = XenForo_Model::create('XenForo_Model_User');
$userFieldModel = XenForo_Model::create('XenForo_Model_UserField');
if ($options->syncGroups) {
$fetchOptions = array('validOnly' => true);
$users = $userModel->getAllUsers($fetchOptions);
foreach ($users as $user) {
$hasUpdated = false;
$coreId = $userFieldModel->getUserFieldValues($user['user_id'])['CoreID'];
$secondaryGroups = $user['secondary_group_ids'];
$groups_raw = file_get_contents($options->restApiUrl . 'group.php?action=getAllGroups');
$groups = json_decode($groups_raw, true);
while ($groupId = mysqli_fetch_array($groups)) {
$group_raw = file_get_contents($options->restApiUrl . 'group.php?action=getGroup&id=' . $groupId);
$group = json_decode($group_raw);
foreach ($userGroups as $userGroup) {
if ($userGroup == $group['site_group_id']) {
$player_raw = file_get_contents($options->restApiUrl . 'player.php?action=updatePlayer&id=' . $coreId . '&primaryGroupID=' . $group['id'] . '&apikey=07af7e75676eab410d1f83937d7afb62');
$player = json_decode($player_raw, true);
$hasUpdated = $player['hasUpdated'];
}
}
}
if ($hasUpdated == false) {
$player_raw = file_get_contents($options->restApiUrl . 'player.php?action=updatePlayer&id=' . $coreId . '&primaryGroupID=2&apikey=07af7e75676eab410d1f83937d7afb62');
$player = json_decode($player_raw, true);
$hasUpdated = $player['hasUpdated'];
}
}
}
}
开发者ID:Quartzcraft,项目名称:Website,代码行数:34,代码来源:Groups.php
示例6: _messagePreSave
/**
*
* @see XenForo_DataWriter_DiscussionMessage_Post::_messagePreSave()
*/
protected function _messagePreSave()
{
if ($this->isDiscussionFirstMessage() && isset($GLOBALS['XenForo_ControllerPublic_Forum'])) {
$visitor = XenForo_Visitor::getInstance();
$this->set('original_poster_th', array('user_id' => $visitor->user_id, 'username' => $visitor->username));
}
if (!empty($GLOBALS['XenForo_ControllerPublic_Thread'])) {
/* @var $controller XenForo_ControllerPublic_Thread */
$controller = $GLOBALS['XenForo_ControllerPublic_Thread'];
$this->set('original_poster_th', array('user_id' => $this->get('user_id'), 'username' => $this->get('username')));
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
$input = $controller->getInput()->filter(array('post_as_user_id' => XenForo_Input::UINT, 'post_as_username' => XenForo_Input::STRING));
if ($input['post_as_username']) {
$user = $userModel->getUserByName($input['post_as_username']);
$input['post_as_user_id'] = $user['user_id'];
}
if (!isset($user) && $input['post_as_user_id']) {
$user = $userModel->getUserById($input['post_as_user_id']);
}
if (isset($user) && $userModel->canPostAsDifferentUser($user)) {
$this->set('user_id', $user['user_id']);
$this->set('username', $user['username']);
if (XenForo_Application::get('options')->th_postAsUser_updateLastActivity) {
/* @var $userModel XenForo_Model_User */
$userModel = $this->getModelFromCache('XenForo_Model_User');
$request = $controller->getRequest();
$routeMatch = $controller->getRouteMatch();
$userModel->updateSessionActivity($user['user_id'], $request->getClientIp(false), $routeMatch->getControllerName(), $routeMatch->getAction(), 'valid', $request->getUserParams());
}
}
}
parent::_messagePreSave();
}
开发者ID:ThemeHouse-XF,项目名称:PostAsUser,代码行数:38,代码来源:Post.php
示例7: 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);
}
开发者ID:ThemeHouse-XF,项目名称:SocialGroups,代码行数:36,代码来源:Forums.php
示例8: prepareDiscoveryParams
public static function prepareDiscoveryParams(array &$params, Zend_Controller_Response_Http $response, $topicType, $topicId, $selfLink, $subscriptionOption)
{
if (!bdApi_Option::getSubscription($topicType)) {
// subscription for this topic type has been disabled
return false;
}
// subscription discovery
$hubLink = bdApi_Data_Helper_Core::safeBuildApiLink('subscriptions', null, array('hub.topic' => bdApi_Model_Subscription::getTopic($topicType, $topicId), 'oauth_token' => ''));
$response->setHeader('Link', sprintf('<%s>; rel=hub', $hubLink));
$response->setHeader('Link', sprintf('<%s>; rel=self', $selfLink));
// subscription info
if (!empty($subscriptionOption)) {
$subscriptionOption = @unserialize($subscriptionOption);
if (!empty($subscriptionOption['subscriptions'])) {
/* @var $session bdApi_Session */
$session = XenForo_Application::getSession();
$clientId = $session->getOAuthClientId();
foreach ($subscriptionOption['subscriptions'] as $subscription) {
if ($subscription['client_id'] == $clientId) {
$params['subscription_callback'] = $subscription['callback'];
}
}
}
}
return true;
}
开发者ID:billyprice1,项目名称:bdApi,代码行数:26,代码来源:Subscription.php
示例9: 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;
}
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:28,代码来源:Listener.php
示例10: actionAdd
public function actionAdd()
{
$response = parent::actionAdd();
if ($response instanceof XenForo_ControllerResponse_View) {
$threadNodeId = $this->_input->filterSingle('thread_node_id', XenForo_Input::UINT);
if ($threadNodeId && !empty($response->params['categories'])) {
foreach ($response->params['categories'] as $resourceCategoryId => $category) {
if ($category['thread_node_id'] != $threadNodeId) {
unset($response->params['categories'][$resourceCategoryId]);
}
}
$response->params['redirectToThread'] = true;
} else {
$redirectToThread = $this->_input->filterSingle('redirect_to_thread', XenForo_Input::UINT);
if ($redirectToThread) {
$response->params['redirectToThread'] = true;
}
}
$addOns = XenForo_Application::get('addOns');
if (!empty($addOns['ThemeHouse_SocialGroups'])) {
$socialForumId = $this->_input->filterSingle('social_forum_id', XenForo_Input::UINT);
if ($socialForumId) {
$response->params['socialForumId'] = $socialForumId;
}
}
}
return $response;
}
开发者ID:ThemeHouse-XF,项目名称:CreateResForum,代码行数:28,代码来源:Resource.php
示例11: logModeratorActionLocal
public function logModeratorActionLocal($contentType, array $content, $action, array $actionParams = array(), $parentContent = null, array $logUser = null)
{
$xenOptions = XenForo_Application::get('options');
if ($xenOptions->th_moderatorLog_splitMoveCopyPosts) {
$existingActions = array('post_copy_target_existing', 'post_move_target_existing');
$actions = array_merge($existingActions, array('post_copy_target', 'post_move_target'));
if (in_array($action, $actions)) {
$newAction = substr($action, strlen('post_'));
/* @var $postModel XenForo_Model_Post */
$postModel = $this->getModelFromCache('XenForo_Model_Post');
$posts = $postModel->getPostsByIds(explode(', ', $actionParams['ids']));
unset($actionParams['ids']);
$logId = false;
$i = 0;
foreach ($posts as $postId => $post) {
if ($i > 0 && !in_array($action, $existingActions)) {
$newAction = substr($newAction, 0, strlen('move_target'));
}
$actionParams['id'] = $postId;
$logId = $this->logModeratorActionLocal('post', $post, $newAction, $actionParams, $content, $logUser);
$i++;
}
return $logId;
}
}
return parent::logModeratorActionLocal($contentType, $content, $action, $actionParams, $parentContent, $logUser);
}
开发者ID:ThemeHouse-XF,项目名称:ModeratorLog,代码行数:27,代码来源:Log.php
示例12: findNewThreads
public function findNewThreads()
{
$threadModel = $this->_getThreadModel();
$searchModel = $this->_getSearchModel();
$userId = XenForo_Visitor::getUserId();
$limitOptions = array('limit' => XenForo_Application::get('options')->maximumSearchResults);
$days = $this->_input->filterSingle('days', XenForo_Input::UINT);
$recent = $this->_input->filterSingle('recent', XenForo_Input::UINT);
if ($userId && !$days && !$recent) {
$threadIds = $threadModel->getUnreadThreadIds($userId, $limitOptions);
$searchType = 'new-threads';
} else {
if ($days < 1) {
$days = 3;
}
$fetchOptions = $limitOptions + array('order' => 'last_post_date', 'orderDirection' => 'desc');
$threadIds = array_keys($threadModel->getThreads(array('last_post_date' => array('>', XenForo_Application::$time - 86400 * $days), 'deleted' => false, 'moderated' => false), $fetchOptions));
$searchType = 'recent-threads';
}
$results = array();
foreach ($threadIds as $threadId) {
$results[] = array(XenForo_Model_Search::CONTENT_TYPE => 'thread', XenForo_Model_Search::CONTENT_ID => $threadId);
}
$results = $searchModel->getViewableSearchResults($results);
if (!$results) {
return $this->getNoResultsResponse();
}
$search = $searchModel->insertSearch($results, $searchType, '', array(), 'date', false);
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('find-new/threads', $search));
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:30,代码来源:FindNew.php
示例13: 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);
}
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Description.php
示例14: actionIndex
public function actionIndex()
{
$commentModel = $this->_getCommentModel();
$mediaHelper = $this->_getMediaHelper();
$commentId = $this->_input->filterSingle('comment_id', XenForo_Input::UINT);
$fetchOptions = array('join' => XenGallery_Model_Comment::FETCH_USER | XenGallery_Model_Comment::FETCH_MEDIA | XenGallery_Model_Comment::FETCH_CATEGORY);
$redirect = 'xengallery';
$comment = $commentModel->getCommentById($commentId, $fetchOptions);
if ($comment['content_type'] == 'media') {
$content = $mediaHelper->assertMediaValidAndViewable($comment['content_id']);
$pageParam = 'page';
} else {
$content = $mediaHelper->assertAlbumValidAndViewable($comment['content_id']);
$redirect .= '/albums';
$pageParam = 'commentpage';
}
$moderated = $commentModel->canViewUnapprovedComment();
if (!$moderated) {
$moderated = XenForo_Visitor::getUserId();
}
$conditions = array('content_id' => $comment['content_id'], 'content_type' => $comment['content_type'], 'deleted' => $commentModel->canViewDeletedComment(), 'moderated' => $moderated, 'comment_id_lt' => $commentId);
$commentsBefore = $commentModel->countComments($conditions);
$commentsPerPage = XenForo_Application::getOptions()->xengalleryMaxCommentsPerPage;
$page = floor($commentsBefore / $commentsPerPage) + 1;
$linkParams = array();
if ($page > 1) {
$linkParams = array($pageParam => $page);
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL_PERMANENT, XenForo_Link::buildPublicLink($redirect, $content, $linkParams) . '#comment-' . $commentId);
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:30,代码来源:Comment.php
示例15: renderRaw
public function renderRaw()
{
$attachment = $this->_params['attachment'];
if (!headers_sent() && function_exists('header_remove')) {
header_remove('Expires');
header('Cache-control: private');
}
$extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
$imageTypes = array('svg' => 'image/svg+xml', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png');
if (isset($imageTypes[$extension]) && ($attachment['width'] && $attachment['height'])) {
$this->_response->setHeader('Content-type', $imageTypes[$extension], true);
$this->setDownloadFileName($attachment['filename'], true);
} else {
$this->_response->setHeader('Content-type', 'application/octet-stream', true);
$this->setDownloadFileName($attachment['filename']);
}
$this->_response->setHeader('ETag', '"' . $attachment['attach_date'] . '"', true);
$this->_response->setHeader('Content-Length', $attachment['file_size'], true);
$this->_response->setHeader('X-Content-Type-Options', 'nosniff');
$attachmentFile = $this->_params['attachmentFile'];
$options = XenForo_Application::getOptions();
if ($options->SV_AttachImpro_XAR) {
if (SV_AttachmentImprovements_AttachmentHelper::ConvertFilename($attachmentFile)) {
if (XenForo_Application::debugMode() && $options->SV_AttachImpro_log) {
XenForo_Error::debug('X-Accel-Redirect:' . $attachmentFile);
}
$this->_response->setHeader('X-Accel-Redirect', $attachmentFile);
return '';
}
if (XenForo_Application::debugMode() && $options->SV_AttachImpro_log) {
XenForo_Error::debug('X-Accel-Redirect skipped');
}
}
return new XenForo_FileOutput($attachmentFile);
}
开发者ID:Xon,项目名称:XenForo-AttachmentImprovements,代码行数:35,代码来源:View.php
示例16: run
public function run()
{
if ($this->_templateName == "PAGE_CONTAINER" && XenForo_Application::debugMode()) {
$this->_debugMode();
}
return parent::run();
}
开发者ID:ThemeHouse-XF,项目名称:DebugOnPost,代码行数:7,代码来源:TemplatePostRender.php
示例17: _getProfilePosts
protected function _getProfilePosts(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
if ($positionCode == 'forum_list' and $widget['options']['limit'] == XenForo_Application::getOptions()->get('forumListNewProfilePosts')) {
if (!empty($params['profilePosts'])) {
return $params['profilePosts'];
}
}
$core = WidgetFramework_Core::getInstance();
$visitor = XenForo_Visitor::getInstance();
/** @var WidgetFramework_XenForo_Model_ProfilePost $profilePostModel */
$profilePostModel = $core->getModelFromCache('XenForo_Model_ProfilePost');
$profilePosts = $profilePostModel->WidgetFramework_getLatestProfilePosts(array('deleted' => false, 'moderated' => false), array('limit' => $widget['options']['limit'] * 3, 'join' => XenForo_Model_ProfilePost::FETCH_USER_POSTER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER_PRIVACY, 'permissionCombinationId' => $visitor->get('permission_combination_id')));
foreach ($profilePosts as $id => &$profilePost) {
$receivingUser = $profilePostModel->getProfileUserFromProfilePost($profilePost);
if (!$profilePostModel->canViewProfilePostAndContainer($profilePost, $receivingUser)) {
unset($profilePosts[$id]);
}
$profilePost = $profilePostModel->prepareProfilePost($profilePost, $receivingUser);
if (!empty($profilePost['isIgnored'])) {
unset($profilePosts[$id]);
}
}
$profilePosts = array_slice($profilePosts, 0, $widget['options']['limit'], true);
return $profilePosts;
}
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:25,代码来源:ProfilePosts.php
示例18: navigationTabs
public static function navigationTabs(&$extraTabs, $selectedTabId)
{
$options = XenForo_Application::get('options');
if (XenForo_Visitor::getInstance()->hasPermission('players', 'view') && $options->displayPlayersTab && $options->displayPlayers) {
$extraTabs['players'] = array('title' => new XenForo_Phrase('players'), 'href' => XenForo_Link::buildPublicLink('full:players'), 'position' => 'home', 'linksTemplate' => 'player_tab_links');
}
}
开发者ID:Quartzcraft,项目名称:Website,代码行数:7,代码来源:Listener.php
示例19: runOften
public static function runOften()
{
$feeds = XenForo_Model::create('DigitalPointSocialBar_Model_SocialBar')->getSlugsFromOptions();
shuffle($feeds);
// randomize order in case someone has absurd number of lists attached to forums (would need to be more than 180 unique) to work around Twitter API limits
$cacheObject = XenForo_Application::getCache();
$twitter = DigitalPointSocialBar_Helper_Twitter::getService(XenForo_Application::getOptions()->dpTwitterAccessToken, XenForo_Application::getOptions()->dpTwitterAccessTokenSecret, XenForo_Application::getOptions()->dpTwitterUsername);
// forum specific feeds
if ($feeds) {
foreach ($feeds as $slug) {
$tweets_array = array();
$results = $twitter->listsStatuses(array('slug' => $slug, 'owner_screen_name' => XenForo_Application::getOptions()->dpTwitterUsername, 'count' => 250, 'include_rts' => 1, 'include_entities' => 1));
if (count($results)) {
try {
for ($i = 0; $i < count($results); $i++) {
$tweet = $results[$i];
if (is_object($tweet->user)) {
$screen_name = $tweet->user->screen_name;
if (!@isset($tweets_array[$screen_name])) {
$tweets_array[$screen_name] = DigitalPointSocialBar_Helper_Twitter::parseTweet($tweet);
}
}
}
$cacheObject->save(json_encode(array_values($tweets_array)), 'social_bar_' . str_replace('-', '_', $slug), array(), 604800);
// 7 day cache
} catch (Exception $e) {
}
}
}
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:SocialBar.php
示例20: actionIndex
/**
* Single-stage logout procedure
*/
public function actionIndex()
{
$csrfToken = $this->_input->filterSingle('_xfToken', XenForo_Input::STRING);
$redirectResponse = $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
$userId = XenForo_Visitor::getUserId();
if (!$userId) {
return $redirectResponse;
}
if ($this->_noRedirect() || !$csrfToken) {
// request is likely from JSON, probably XenForo.OverlayTrigger, so show a confirmation dialog
return $this->responseView('XenForo_ViewPublic_LogOut', 'log_out');
} else {
$this->_checkCsrfFromToken($csrfToken);
// remove an admin session if we're logged in as the same person
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
$adminSession = new $class(array('admin' => true));
$adminSession->start();
if ($adminSession->get('user_id') == $userId) {
$adminSession->delete();
}
}
$this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies($this->_getRetainedCookies(), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
return $redirectResponse;
}
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:32,代码来源:Logout.php
注:本文中的XenForo_Application类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论