当前位置: 首页>>代码示例>>PHP>>正文


PHP XenForo_Model::create方法代码示例

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


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

示例1: _getPostModel

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

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

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

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

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

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

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

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

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

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

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

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

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

示例14: _getNodeModel

 /**
  * @return XenForo_Model_Node
  */
 protected function _getNodeModel()
 {
     if (!$this->_nodeModel) {
         $this->_nodeModel = XenForo_Model::create('XenForo_Model_Node');
     }
     return $this->_nodeModel;
 }
开发者ID:maitandat1507,项目名称:Tinhte_XenTag,代码行数:10,代码来源:NodeAbstract.php

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


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