本文整理汇总了PHP中XenForo_Application::arrayFilterKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::arrayFilterKeys方法的具体用法?PHP XenForo_Application::arrayFilterKeys怎么用?PHP XenForo_Application::arrayFilterKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::arrayFilterKeys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderJson
public function renderJson()
{
$this->_params['urls'] = ThemeHouse_SocialGroups_Template_Helper_SocialForum::getAvatarUrls($this->_params['socialForum']);
$this->_params['user_id'] = "sg-" . $this->_params['social_forum_id'];
$output = XenForo_Application::arrayFilterKeys($this->_params, array('sizeCode', 'maxWidth', 'maxDimension', 'width', 'height', 'cropX', 'cropY', 'urls', 'user_id', 'logo_date', 'cropCss', 'message'));
return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
}
示例2: prepareGames
/**
* Prepare the array user in the notes
*/
public function prepareGames(array $games)
{
foreach ($games as &$game) {
$game['user'] = XenForo_Application::arrayFilterKeys($game, array('user_id', 'username'));
unset($game['user_id'], $game['username']);
}
return $games;
}
示例3: _preparePhotoForJson
protected function _preparePhotoForJson(array $photo, array $album)
{
$keys = array('content_data_id', 'upload_date', 'thumbnailUrl');
$template = $this->createTemplateObject('sonnb_xengallery_upload', array('content' => $photo, 'album' => $album));
$photo = XenForo_Application::arrayFilterKeys($photo, $keys);
$photo['templateHtml'] = $template;
return $photo;
}
示例4: _prepareAttachmentForJson
/**
* Reduces down an array of attachment data into information we don't mind exposing,
* and includes the attachment_editor_attachment template for each attachment.
*
* @param array $attachment
*
* @return array
*/
protected function _prepareAttachmentForJson(array $attachment)
{
$keys = array('attachment_id', 'attach_date', 'filename', 'thumbnailUrl', 'deleteUrl', 'viewUrl');
$template = $this->createTemplateObject('attachment_editor_attachment', array('attachment' => $attachment));
$attachment = XenForo_Application::arrayFilterKeys($attachment, $keys);
$attachment['templateHtml'] = $template;
return $attachment;
}
示例5: prepareParams
public function prepareParams()
{
parent::prepareParams();
$this->_params['templates'] = array();
$keys = array('template_id', 'title', 'template', 'link', 'deleteLink');
foreach ($this->_params['templateData'] as $template) {
$this->_params['templates'][$template['title']] = XenForo_Application::arrayFilterKeys($template, $keys);
}
}
示例6: getReportDetailsFromContent
/**
* Gets report details from raw array of content (eg, a post record).
*
* @see XenForo_ReportHandler_Abstract::getReportDetailsFromContent()
*/
public function getReportDetailsFromContent(array $content)
{
/* @var $conversationModel XenForo_Model_Conversation */
$conversationModel = XenForo_Model::create('XenForo_Model_Conversation');
$message = $conversationModel->getConversationMessageById($content['message_id']);
if (!$message) {
return array(false, false, false);
}
if (empty($content['conversation'])) {
$content['conversation'] = $conversationModel->getConversationMasterById($message['conversation_id']);
}
$conversation = XenForo_Application::arrayFilterKeys($content['conversation'], array('conversation_id', 'title', 'start_date', 'user_id', 'username', 'reply_count'));
return array($content['message_id'], $content['user_id'], array('username' => $content['username'], 'message' => $content['message'], 'conversation' => $conversation, 'recipients' => $conversationModel->getConversationRecipients($conversation['conversation_id'])));
}
示例7: _prepareAttachmentForJson
/**
* Reduces down an array of attachment data into information we don't mind exposing,
* and includes the attachment_editor_attachment template for each attachment.
*
* @param array $attachment
*
* @return array
*/
protected function _prepareAttachmentForJson(array $attachment)
{
$attachment['mediaType'] = $this->_params['upload_type'];
if (!empty($this->_params['customFields'])) {
foreach ($this->_params['customFields'] as $fieldId => &$fields) {
foreach ($fields as &$field) {
if ($field['field_type'] == 'bbcode') {
$field['editorTemplateHtml'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate($this, "{$attachment['mediaType']}[{$attachment['attachment_id']}][custom_fields][{$field['field_id']}]", isset($field['field_value']) ? $field['field_value'] : '', array('height' => '90px', 'extraClass' => 'NoAttachment NoAutoComplete'));
}
}
}
}
$template = $this->createTemplateObject($this->_templateName, array('media' => $attachment) + $this->_params);
$keys = array('attachment_id', 'attach_date', 'filename', 'thumbnailUrl', 'deleteUrl', 'mediaType');
$attachment = XenForo_Application::arrayFilterKeys($attachment, $keys);
$attachment['templateHtml'] = $template;
return $attachment;
}
示例8: rebuildResourceFieldCache
/**
* Rebuilds the cache of resource field info for front-end display
*
* @return array
*/
public function rebuildResourceFieldCache()
{
$cache = array();
foreach ($this->getResourceFields() as $fieldId => $field) {
$cache[$fieldId] = XenForo_Application::arrayFilterKeys($field, array('field_id', 'field_type', 'field_group_id'));
}
$this->_getDataRegistryModel()->set('resourceFieldsInfo', $cache);
return $cache;
}
示例9: rebuildDestinationOptionCache
/**
* Rebuilds the cache of destination option info for front-end display
*
* @return array
*/
public function rebuildDestinationOptionCache()
{
$cache = array();
foreach ($this->getDestinationOptions() as $optionId => $destinationOption) {
$cache[$optionId] = XenForo_Application::arrayFilterKeys($destinationOption, array('option_id', 'field_type'));
foreach (array('display_template') as $optionalDestinationOption) {
if (!empty($destinationOption[$optionalDestinationOption])) {
$cache[$optionId][$optionalDestinationOption] = $destinationOption[$optionalDestinationOption];
}
}
}
$this->_getDataRegistryModel()->set('destinationOptionsInfo', $cache);
return $cache;
}
示例10: _prepareSocialForumForCombination
private function _prepareSocialForumForCombination(array $socialForum)
{
return XenForo_Application::arrayFilterKeys($socialForum, array('social_forum_id', 'title', 'logo_date', 'logo_width', 'logo_height', 'logo_crop_x', 'logo_crop_y'));
}
示例11: renderJson
public function renderJson()
{
$this->_params['url'] = Nobita_Teams_Template_Helper_Core::getAvatarUrl($this->_params['team'], true);
$output = XenForo_Application::arrayFilterKeys($this->_params, array('url', 'team_avatar_date', 'message', 'redirectUri'));
return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
}
示例12: renderJson
public function renderJson()
{
$this->_params['urls'] = XenForo_Template_Helper_Core::getAvatarUrls($this->_params['user']);
$output = XenForo_Application::arrayFilterKeys($this->_params, array('sizeCode', 'maxWidth', 'maxDimension', 'width', 'height', 'cropX', 'cropY', 'urls', 'user_id', 'avatar_date', 'cropCss', 'message'));
return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
}
示例13: rebuildDestinationCache
/**
* Rebuilds the cache of destination info for front-end display
*
* @return array
*/
public function rebuildDestinationCache()
{
$cache = array();
foreach ($this->getDestinations() as $destinationId => $destination) {
$cache[$destinationId] = XenForo_Application::arrayFilterKeys($destination, array('destination_id', 'name'));
}
$this->_getDataRegistryModel()->set('destinationsInfo', $cache);
return $cache;
}
示例14: _getPrivacyUsers
protected function _getPrivacyUsers($usernames, $serialize = true)
{
if (!is_array($usernames)) {
$usernames = explode(',', $usernames);
$usernames = array_filter($usernames);
}
$privacyUsers = array();
if (!empty($usernames)) {
$users = $this->_getUserModel()->getUsersByNames($usernames);
$userKeys = array('user_id', 'username');
foreach ($users as $key => $user) {
$privacyUsers[$key] = XenForo_Application::arrayFilterKeys($user, $userKeys);
}
}
if ($serialize) {
$privacyUsers = serialize($privacyUsers);
}
return $privacyUsers;
}
示例15: _getTaggableUsers
protected function _getTaggableUsers($usernames, $contentType, $contentId, $overwrite = false, $viewingUser = null)
{
$this->standardizeViewingUserReference($viewingUser);
if (!is_array($usernames)) {
$usernames = explode(',', $usernames);
$usernames = array_filter($usernames);
}
$tagUsers = $alertUsers = $directUsers = array();
if (!empty($usernames)) {
$userModel = $this->_getUserModel();
$users = $userModel->getUsersByNames($usernames, array('join' => XenForo_Model_User::FETCH_USER_PRIVACY | XenForo_Model_User::FETCH_USER_OPTION, 'followingUserId' => $viewingUser['user_id']));
$userKeys = array('user_id', 'username');
$taggedUsers = array();
if ($overwrite === false) {
$taggedUsers = $this->getTagsByContentId($contentType, $contentId);
}
$excludeArray = array();
if ($taggedUsers) {
foreach ($taggedUsers as $tagUser) {
$excludeArray[] = $tagUser['user_id'];
}
}
$xfContentType = '';
switch ($contentType) {
case sonnb_XenGallery_Model_Album::$contentType:
$xfContentType = sonnb_XenGallery_Model_Album::$xfContentType;
break;
case sonnb_XenGallery_Model_Photo::$contentType:
$xfContentType = sonnb_XenGallery_Model_Photo::$xfContentType;
break;
}
foreach ($users as $key => $user) {
if (in_array($key, $excludeArray)) {
continue;
}
$user = $userModel->prepareUser($user);
if ($this->canTagUser($user, $errorPhraseKey, $viewingUser)) {
$tagUsers[$key] = XenForo_Application::arrayFilterKeys($user, $userKeys);
if ($this->canDirectTagging($user, $viewingUser)) {
$directUsers[$key] = $user;
}
}
if ($viewingUser['user_id'] != $user['user_id'] && !$userModel->isUserIgnored($user, $viewingUser['user_id']) && XenForo_Model_Alert::userReceivesAlert($user, $xfContentType, 'tag')) {
$alertUsers[$key] = $user;
}
}
}
return array($tagUsers, $alertUsers, $directUsers);
}