本文整理汇总了PHP中XenForo_Model::getModelFromCache方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Model::getModelFromCache方法的具体用法?PHP XenForo_Model::getModelFromCache怎么用?PHP XenForo_Model::getModelFromCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Model
的用法示例。
在下文中一共展示了XenForo_Model::getModelFromCache方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: getUserText
public function getUserText(XenForo_Model $model)
{
$params = array();
$params['trophyId'] = $this->_trophyId;
$params['trophyPhrase'] = $this->_getPhrase($model->getModelFromCache('XenForo_Model_Trophy')->getTrophyTitlePhraseName($this->_trophyId));
return $this->_getSimulationTemplate('bdsocialshare_user_text_i_am_awarded_trophy_x', $params);
}
示例3: _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;
}
示例4: _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;
}
示例5: _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;
}
示例6: getImage
public function getImage(XenForo_Model $model)
{
$item = $this->_itemDw->getMergedData();
if ($item['attach_count'] > 0) {
if ($this->_image === false) {
$item = $model->getModelFromCache('NFLJ_Showcase_Model_Item')->getAndMergeAttachmentsIntoItem($item);
if (!empty($item['cover_image'])) {
$this->_image = XenForo_Link::convertUriToAbsoluteUri($item['cover_image']['thumbnailUrl'], true);
} else {
$this->_image = '';
}
}
if (!empty($this->_image)) {
return $this->_image;
}
}
return parent::getImage($model);
}
示例7: notifyTaggedUsers3
public function notifyTaggedUsers3($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, array $taggedUsers, array $noAlertUserIds = array(), array $noEmailUserIds = array(), XenForo_Model $someRandomModel = null, array $options = array())
{
$options = array_merge(array(self::OPTION_MAX_TAGGED_USERS => bdTagMe_Option::get('max')), $options);
if ($someRandomModel != null) {
/* @var $userModel XenForo_Model_User */
$userModel = $someRandomModel->getModelFromCache('XenForo_Model_User');
} else {
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
}
$neededUserIds = array();
$taggableUserGroups = $this->getTaggableUserGroups();
foreach ($taggedUsers as $taggedUserId => $taggedUserName) {
if (is_numeric($taggedUserId)) {
$neededUserIds[] = $taggedUserId;
} else {
if (strpos($taggedUserId, 'ug_') === 0) {
$userGroupId = substr($taggedUserId, 3);
if (isset($taggableUserGroups[$userGroupId])) {
$neededUserIds += array_keys($taggableUserGroups[$userGroupId]['userIds']);
}
}
}
}
if (!empty($neededUserIds)) {
if ($options[self::OPTION_MAX_TAGGED_USERS] > 0) {
// there are limit of maximum tagged users
$userIds = array_slice($neededUserIds, 0, $options[self::OPTION_MAX_TAGGED_USERS]);
} else {
$userIds = $neededUserIds;
}
} else {
$userIds = array();
}
if (count($userIds) > self::USERS_PER_BATCH) {
$deferredUserIds = array_slice($userIds, self::USERS_PER_BATCH);
$userIds = array_slice($userIds, 0, self::USERS_PER_BATCH);
XenForo_Application::defer('bdTagMe_Deferred_NotifyUserIds', array($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $deferredUserIds, $noAlertUserIds, $noEmailUserIds, $options));
}
return $this->notifyUserIds($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $userIds, $noAlertUserIds, $noEmailUserIds, $userModel, $options);
}
示例8: _getImageForAttachment
protected function _getImageForAttachment($attachment, XenForo_Model $model)
{
// try to use full size link if possible
$image = XenForo_Link::buildPublicLink('attachments', $attachment);
if (Zend_URi::check($image) and substr($image, -1) !== '/') {
$filename = basename($image);
$ext = XenForo_Helper_File::getFileExtension($filename);
if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png'), true)) {
return $image;
}
}
// fallback to thumbnail
$image = $model->getModelFromCache('XenForo_Model_Attachment')->getAttachmentThumbnailUrl($attachment);
$image = XenForo_Link::convertUriToAbsoluteUri($image, true);
return $image;
}
示例9: _getFirstPost
protected function _getFirstPost(XenForo_Model $model)
{
if ($this->_firstPost === null) {
$thread = $this->_postDw->getDiscussionData();
if (!empty($thread['first_post_id'])) {
$this->_firstPost = $model->getModelFromCache('XenForo_Model_Post')->getPostById($thread['first_post_id']);
}
}
return $this->_firstPost;
}