• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XenForo_Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中XenForo_Model的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Model类的具体用法?PHP XenForo_Model怎么用?PHP XenForo_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XenForo_Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _getAttachment

 protected function _getAttachment(XenForo_Model $model)
 {
     if ($this->_attachment === null) {
         $this->_attachment = $model->getModelFromCache('XenForo_Model_Attachment')->getAttachmentById($this->_mediaDw->get('attachment_id'));
     }
     return $this->_attachment;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Media.php


示例2: _getVideoData

 protected function _getVideoData(XenForo_Model $model)
 {
     if ($this->_videoData === null) {
         $this->_videoData = $model->getModelFromCache('sonnb_XenGallery_Model_VideoData')->getDataByDataId($this->_videoDw->get('content_data_id'));
     }
     return $this->_videoData;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Video.php


示例3: _getPhotoData

 protected function _getPhotoData(XenForo_Model $model)
 {
     if ($this->_photoData === null) {
         $dataId = $this->_photoDw->get('photo_data_id');
         if (empty($dataId)) {
             // sonnb - XenGallery v2.0.0
             $dataId = $this->_photoDw->get('content_data_id');
         }
         $this->_photoData = $model->getModelFromCache('sonnb_XenGallery_Model_PhotoData')->getDataByDataId($dataId);
     }
     return $this->_photoData;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:12,代码来源:Photo.php


示例4: getDescription

 public function getDescription(XenForo_Model $model)
 {
     $resource = $this->_resourceDw->getMergedData();
     $resource = $model->getModelFromCache('XenResource_Model_Resource')->prepareResource($resource, null, $this->getViewingUser());
     $resource = $model->getModelFromCache('XenResource_Model_Resource')->prepareResourceCustomFields($resource, array(), $this->getViewingUser());
     $params = array('resource' => $resource);
     if ($resource['user_id'] == $this->getViewingUserId()) {
         return $this->_getSimulationTemplate('bdsocialshare_description_xenresource_resource', $params);
     } else {
         return $this->_getSimulationTemplate('bdsocialshare_description_xenresource_resource_aut', $params);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:12,代码来源:Resource.php


示例5: getVisibleReportsForUser

 /**
  * Gets the visible reports of this content type for the viewing user.
  *
  * @see XenForo_ReportHandler_Abstract:getVisibleReportsForUser()
  */
 public function getVisibleReportsForUser(array $reports, array $viewingUser)
 {
     $reportsByUser = array();
     foreach ($reports as $reportId => $report) {
         $info = unserialize($report['content_info']);
         $reportsByUser[$info['profile_user_id']][] = $reportId;
     }
     $users = XenForo_Model::create('XenForo_Model_User')->getUsersByIds(array_keys($reportsByUser), array('join' => XenForo_Model_User::FETCH_USER_PRIVACY, 'followingUserId' => $viewingUser['user_id']));
     $userProfileModel = XenForo_Model::create('XenForo_Model_UserProfile');
     foreach ($reportsByUser as $userId => $userReports) {
         $remove = false;
         if (isset($users[$userId]) && !$userProfileModel->canViewFullUserProfile($users[$userId], $null, $viewingUser)) {
             $remove = true;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') && !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                 $remove = true;
             }
         }
         if ($remove) {
             foreach ($userReports as $reportId) {
                 unset($reports[$reportId]);
             }
         }
     }
     return $reports;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:31,代码来源:ProfilePostComment.php


示例6: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('position' => 0, 'batch' => 100, 'delete' => false), $data);
     $data['batch'] = max(1, $data['batch']);
     /* @var $statsModel XenForo_Model_Stats */
     $statsModel = XenForo_Model::create('XenForo_Model_Stats');
     if ($data['position'] == 0) {
         // delete old stats cache if required
         if (!empty($data['delete'])) {
             $statsModel->deleteStats();
         }
         // an appropriate date from which to start... first thread, or earliest user reg?
         $data['position'] = min(XenForo_Model::create('XenForo_Model_Thread')->getEarliestThreadDate(), XenForo_Model::create('XenForo_Model_User')->getEarliestRegistrationDate());
         // start on a 24 hour increment point
         $data['position'] = $data['position'] - $data['position'] % 86400;
     } else {
         if ($data['position'] > XenForo_Application::$time) {
             return true;
         }
     }
     $endPosition = $data['position'] + $data['batch'] * 86400;
     $statsModel->buildStatsData($data['position'], $endPosition);
     $data['position'] = $endPosition;
     $actionPhrase = new XenForo_Phrase('rebuilding');
     $typePhrase = new XenForo_Phrase('daily_statistics');
     $status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::date($data['position'], 'absolute'));
     return $data;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:28,代码来源:DailyStats.php


示例7: getModelFromCache

 /**
  * Gets the specified model object from the cache. If it does not exist,
  * it will be instantiated.
  *
  * @param string $class Name of the class to load
  *
  * @return XenForo_Model
  */
 public function getModelFromCache($class)
 {
     if (!isset($this->_modelCache[$class])) {
         $this->_modelCache[$class] = XenForo_Model::create($class);
     }
     return $this->_modelCache[$class];
 }
开发者ID:robclancy,项目名称:XenPlus,代码行数:15,代码来源:Abstract.php


示例8: getUser

 public function getUser()
 {
     $visitor = XenForo_Visitor::getInstance();
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $userInfo = $userModel->getFullUserById($visitor->getUserId());
     return $userInfo;
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:7,代码来源:XfAuthentication.php


示例9: _getThreadModel

 /**
  *
  * @return XenForo_Model_Thread
  */
 protected function _getThreadModel()
 {
     if (!$this->_threadModel) {
         $this->_threadModel = XenForo_Model::create('XenForo_Model_Thread');
     }
     return $this->_threadModel;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:11,代码来源:ThreadListItem.php


示例10: 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


示例11: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('startLanguage' => 0, 'startPhrase' => 0, 'position' => 0, 'mapped' => false), $data);
     /* @var $phraseModel XenForo_Model_Phrase */
     $phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
     if ($data['startLanguage'] == 0 && $data['startPhrase'] == 0 && !$data['mapped']) {
         $s = microtime(true);
         $phraseModel->insertPhraseMapForLanguages($phraseModel->buildPhraseMapForLanguageTree(0), true);
         $data['mapped'] = true;
         $maxExec = $targetRunTime ? $targetRunTime - (microtime(true) - $s) : 0;
     } else {
         $maxExec = $targetRunTime;
     }
     $actionPhrase = new XenForo_Phrase('rebuilding');
     $typePhrase = new XenForo_Phrase('phrases');
     $status = sprintf('%s... %s %s', $actionPhrase, $typePhrase, str_repeat(' . ', $data['position']));
     if (!$targetRunTime || $maxExec > 1) {
         $result = $phraseModel->compileAllPhrases($maxExec, $data['startLanguage'], $data['startPhrase']);
     } else {
         $result = false;
     }
     if ($result === true) {
         return false;
     } else {
         if ($result) {
             $data['startLanguage'] = $result[0];
             $data['startPhrase'] = $result[1];
         }
         $data['position']++;
         return $data;
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:32,代码来源:Phrase.php


示例12: run

 public function run()
 {
     /* @var $classModel ThemeHouse_Objects_Model_Class */
     $classModel = XenForo_Model::create('ThemeHouse_Objects_Model_Class');
     $classes = $classModel->getAllClasses();
     if (self::$_dependencies instanceof XenForo_Dependencies_Public) {
         $routes = self::$_data['routesPublic'];
     } elseif (self::$_dependencies instanceof XenForo_Dependencies_Admin) {
         $routes = self::$_data['routesAdmin'];
     }
     foreach ($classes as $class) {
         $routePrefix = '';
         if (self::$_dependencies instanceof XenForo_Dependencies_Public) {
             $routePrefix = isset($class['route_prefix']) ? $class['route_prefix'] : '';
         } elseif (self::$_dependencies instanceof XenForo_Dependencies_Admin) {
             $routePrefix = isset($class['route_prefix_admin']) ? $class['route_prefix_admin'] : '';
         }
         if ($routePrefix && !isset($routes[$routePrefix])) {
             $routes[$routePrefix]['build_link'] = 'all';
             if (self::$_dependencies instanceof XenForo_Dependencies_Public) {
                 $routes[$routePrefix]['route_class'] = 'ThemeHouse_Objects_Route_Prefix_Objects';
             } elseif (self::$_dependencies instanceof XenForo_Dependencies_Admin) {
                 $routes[$routePrefix]['route_class'] = 'ThemeHouse_Objects_Route_PrefixAdmin_Objects';
             }
         }
     }
     if (self::$_dependencies instanceof XenForo_Dependencies_Public) {
         XenForo_Link::setHandlerInfoForGroup('public', $routes);
     } elseif (self::$_dependencies instanceof XenForo_Dependencies_Admin) {
         XenForo_Link::setHandlerInfoForGroup('admin', $routes);
     }
     parent::run();
 }
开发者ID:ThemeHouse-XF,项目名称:Objects,代码行数:33,代码来源:InitDependencies.php


示例13: getVisibleModerationQueueEntriesForUser

 /**
  * Gets visible moderation queue entries for specified user.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::getVisibleModerationQueueEntriesForUser()
  */
 public function getVisibleModerationQueueEntriesForUser(array $contentIds, array $viewingUser)
 {
     /* @var $profilePostModel XenForo_Model_ProfilePost */
     $profilePostModel = XenForo_Model::create('XenForo_Model_ProfilePost');
     $profilePosts = $profilePostModel->getProfilePostsByIds($contentIds);
     $profileUserIds = array();
     foreach ($profilePosts as $profilePost) {
         $profileUserIds[] = $profilePost['profile_user_id'];
     }
     $users = XenForo_Model::create('XenForo_Model_User')->getUsersByIds($profileUserIds, array('join' => XenForo_Model_User::FETCH_USER_PRIVACY, 'followingUserId' => $viewingUser['user_id']));
     $output = array();
     foreach ($profilePosts as $profilePost) {
         if (!isset($users[$profilePost['profile_user_id']])) {
             continue;
         }
         $user = $users[$profilePost['profile_user_id']];
         $canManage = true;
         if (!$profilePostModel->canViewProfilePostAndContainer($profilePost, $user, $null, $viewingUser)) {
             $canManage = false;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') || !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                 $canManage = false;
             }
         }
         if ($canManage) {
             $output[$profilePost['profile_post_id']] = array('message' => $profilePost['message'], 'user' => array('user_id' => $profilePost['user_id'], 'username' => $profilePost['username']), 'title' => new XenForo_Phrase('profile_post_for_x', array('username' => $user['username'])), 'link' => XenForo_Link::buildPublicLink('profile-posts', $profilePost), 'contentTypeTitle' => new XenForo_Phrase('profile_post'), 'titleEdit' => false);
         }
     }
     return $output;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:ProfilePost.php


示例14: _getCategoryModel

 /**
  * @return XenForo_Model_Category
  */
 protected function _getCategoryModel()
 {
     if ($this->_categoryModel === null) {
         $this->_categoryModel = XenForo_Model::create('XenForo_Model_Category');
     }
     return $this->_categoryModel;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:10,代码来源:Category.php


示例15: actionLanguage

 /**
  * Displays a form to change the visitor's language, or changes it if a language_id is present.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionLanguage()
 {
     $visitor = XenForo_Visitor::getInstance();
     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;
             }
         }
         if ($visitor['user_id']) {
             $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
             $dw->setExistingData($visitor['user_id']);
             $dw->set('language_id', $languageId);
             $dw->save();
             XenForo_Helper_Cookie::deleteCookie('language_id');
         } else {
             XenForo_Helper_Cookie::setCookie('language_id', $languageId, 86400 * 365);
         }
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
     } else {
         $languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache();
         $viewParams = array('languages' => $this->getModelFromCache('XenForo_Model_Language')->getAllLanguages(), 'redirect' => $this->getDynamicRedirect(false, false));
         return $this->responseView('XenForo_ViewPublic_Misc_Language', 'language_chooser', $viewParams);
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:33,代码来源:Misc.php


示例16: _render

 protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     $mediaCloudModel = XenForo_Model::create('EWRmedio_Model_Keywords');
     //		$model = XenForo_Model::create('EWRporta_Model_Options');
     //		$option = $model->getOptionById('MediaCloud');
     $options = XenForo_Application::get('options');
     $sidebar['keywords'] = $mediaCloudModel->getKeywordCloud($options->EWRmedio_cloudcount, $options->EWRmedio_mincloud, $options->EWRmedio_maxcloud);
     if ($options->EWRmedio_animatedcloud && $sidebar['keywords']) {
         $sidebar['animated'] = $mediaCloudModel->getAnimatedCloud($sidebar['keywords']);
     }
     /*		$limit = $option['limit'];
     		$mincloud = $option['mincloud'];
     		$maxcloud = $option['maxcloud'];
     		$animated = $option['animated'];
     		
     		$cloud['keywords'] = $mediaCloudModel->getKeywordCloud($limit, $mincloud, $maxcloud);
     
     		if ($animated && $cloud['keywords'])
     		{
     			$cloud['animated'] = $mediaCloudModel->getAnimatedCloud($cloud['keywords']);
     		}*/
     $viewParams = array('MediaCloud' => $sidebar);
     $renderTemplateObject->setParams($viewParams);
     return $renderTemplateObject->render();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:MediaCloudWidget.php


示例17: _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


示例18: _getMediaModel

 /**
  * @return XenGallery_Model_Media
  */
 protected function _getMediaModel()
 {
     if (!$this->_mediaModel) {
         $this->_mediaModel = XenForo_Model::create('XenGallery_Model_Media');
     }
     return $this->_mediaModel;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:10,代码来源:Rating.php


示例19: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('position' => 0, 'batch' => 100), $data);
     $data['batch'] = max(1, $data['batch']);
     /* @var $trophyModel XenForo_Model_Trophy */
     $trophyModel = XenForo_Model::create('XenForo_Model_Trophy');
     $trophies = $trophyModel->getAllTrophies();
     if (!$trophies) {
         return true;
     }
     /* @var $userModel XenForo_Model_User */
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $userIds = $userModel->getUserIdsInRange($data['position'], $data['batch']);
     if (sizeof($userIds) == 0) {
         return true;
     }
     $data['position'] = end($userIds);
     $users = $userModel->getUsers(array('user_state' => 'valid', 'is_banned' => 0, 'user_id' => $userIds), array('join' => XenForo_Model_User::FETCH_USER_FULL));
     $userTrophies = $trophyModel->getUserTrophiesByUserIds(array_keys($users));
     foreach ($users as $user) {
         $trophyModel->updateTrophiesForUser($user, isset($userTrophies[$user['user_id']]) ? $userTrophies[$user['user_id']] : array(), $trophies);
         $trophyModel->updateTrophyPointsForUser($user['user_id']);
     }
     $actionPhrase = new XenForo_Phrase('rebuilding');
     $typePhrase = new XenForo_Phrase('trophies');
     $status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
     return $data;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:28,代码来源:Trophy.php


示例20: _postSave

 protected function _postSave()
 {
     parent::_postSave();
     $page = XenForo_Model::create('XenForo_Model_Page')->getPages();
     $this->_getDataRegistryModel()->set('brcnsCacheDataPage', $page);
     $this->getModelFromCache('XenForo_Model_Style')->updateAllStylesLastModifiedDate();
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:7,代码来源:Page.php



注:本文中的XenForo_Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XenForo_Permission类代码示例发布时间:2022-05-23
下一篇:
PHP XenForo_Locale类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap