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


PHP XenForo_Template_Helper_Core::helperSnippet方法代码示例

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


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

示例1: _importMedia

    protected function _importMedia(array $item, array $options)
    {
        $sDb = $this->_sourceDb;
        $xfDb = $this->_xfDb;
        if (!$this->_fileRoot) {
            $this->_fileRoot = $sDb->fetchOne('SELECT setting FROM ' . $this->_prefix . 'settings WHERE varname = \'datafull\'');
        }
        $originalFilePath = sprintf('%s/%d/%s', $this->_fileRoot, $item['cat'], $item['bigimage']);
        if (!file_exists($originalFilePath)) {
            return false;
        }
        $xenOptions = XenForo_Application::getOptions();
        $imageExtensions = preg_split('/\\s+/', trim($xenOptions->xengalleryImageExtensions));
        $videoExtensions = preg_split('/\\s+/', trim($xenOptions->xengalleryVideoExtensions));
        $extension = XenForo_Helper_File::getFileExtension($originalFilePath);
        if (in_array($extension, $imageExtensions)) {
            $mediaType = 'image_upload';
        } else {
            if (in_array($extension, $videoExtensions)) {
                $mediaType = 'video_upload';
            } else {
                return false;
            }
        }
        $tempFile = tempnam(XenForo_Helper_File::getTempDir(), 'xfmg');
        copy($originalFilePath, $tempFile);
        $model = $this->_getMediaGalleryImportersModel();
        $albumId = 0;
        $categoryId = 0;
        $privacy = 'public';
        if ($item['cattype'] == 'a') {
            $albumId = $model->mapAlbumId($item['cat']);
            $privacy = $item['private'] == 'yes' ? 'private' : 'public';
        } elseif ($item['cattype'] == 'c') {
            $categoryId = $model->mapCategoryId($item['cat']);
            $privacy = 'category';
        }
        $user = $xfDb->fetchRow('
			SELECT user_id, username
			FROM xf_user
			WHERE user_id = ?
		', $item['userid']);
        if (!$user) {
            return false;
        }
        $xengalleryMedia = array('media_title' => $this->_convertToUtf8($item['title'], true), 'media_description' => XenForo_Template_Helper_Core::helperSnippet($this->_convertToUtf8($item['description'], true), 0, array('stripHtml' => true)), 'media_date' => $item['date'], 'last_edit_date' => $item['lastpost'], 'last_comment_date' => $item['lastpost'], 'media_type' => $mediaType, 'media_state' => 'visible', 'album_id' => $albumId, 'category_id' => $categoryId, 'media_privacy' => $privacy, 'attachment_id' => 0, 'user_id' => $user['user_id'], 'username' => $user['username'], 'ip_id' => $model->getLatestIpIdFromUserId($user['user_id']), 'likes' => 0, 'like_users' => array(), 'comment_count' => $item['numcom'], 'rating_count' => 0, 'media_view_count' => $item['views']);
        $xfAttachment = array('data_id' => 0, 'content_type' => 'xengallery_media', 'content_id' => 0, 'attach_date' => $item['date'], 'temp_hash' => '', 'unassociated' => 0, 'view_count' => $item['views']);
        $xfAttachmentData = array('user_id' => $user['user_id'], 'upload_date' => $item['date'], 'filename' => $item['bigimage'], 'attach_count' => 1);
        $importedMediaId = $model->importMedia($item['id'], $tempFile, '', $xengalleryMedia, $xfAttachment, $xfAttachmentData);
        @unlink($tempFile);
        return $importedMediaId;
    }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:52,代码来源:PhotopostXf.php

示例2: _importCategory

 protected function _importCategory(array $category, array $options)
 {
     $model = $this->_getMediaGalleryImportersModel();
     $xengalleryCategory = array('category_title' => $this->_convertToUtf8($category['title'], true), 'category_description' => XenForo_Template_Helper_Core::helperSnippet($this->_convertToUtf8($category['description'], true), 0, array('stripHtml' => true)), 'upload_user_groups' => $category['hasimages'] ? unserialize('a:1:{i:0;i:-1;}') : unserialize('a:0:{}'), 'view_user_groups' => unserialize('a:1:{i:0;i:-1;}'), 'allowed_types' => unserialize('a:1:{i:0;s:3:"all";}'), 'parent_category_id' => $category['parent'], 'display_order' => $category['displayorder'], 'category_breadcrumb' => unserialize('a:0:{}'), 'depth' => 0, 'category_media_count' => $category['imagecount'], 'field_cache' => unserialize('a:0:{}'));
     $importedCategoryId = $model->importCategory($category['catid'], $xengalleryCategory);
     return $importedCategoryId;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:7,代码来源:PhotopostVbGallery.php

示例3: _importMedia

 protected function _importMedia(array $item, array $options)
 {
     $originalFilePath = $this->_config['ipboard_path'] . '/uploads/' . $item['image_directory'] . '/' . $item['image_masked_file_name'];
     if (!file_exists($originalFilePath)) {
         return false;
     }
     $tempFile = tempnam(XenForo_Helper_File::getTempDir(), 'xfmg');
     copy($originalFilePath, $tempFile);
     /** @var XenGallery_Model_Album $albumModel */
     $albumModel = XenForo_Model::create('XenGallery_Model_Album');
     $model = $this->_getMediaGalleryImportersModel();
     $mediaPrivacy = 'private';
     $albumId = 0;
     $categoryId = 0;
     if ($item['image_album_id'] > 0) {
         $albumId = $model->mapAlbumId($item['image_album_id']);
         $permission = $albumModel->getUserAlbumPermission($albumId, 'view');
         if ($permission) {
             $mediaPrivacy = $permission['access_type'];
         }
     } else {
         if ($item['image_album_id'] == 0 && $item['image_category_id'] > 0) {
             $categoryId = $model->mapCategoryId($item['image_category_id']);
             $mediaPrivacy = 'category';
         }
     }
     $userId = $this->_userIdMap[$item['image_member_id']];
     $xengalleryMedia = array('media_title' => $this->_convertToUtf8($item['image_caption'], true), 'media_description' => XenForo_Template_Helper_Core::helperSnippet($this->_convertToUtf8($item['image_description'], true), 0, array('stripHtml' => true)), 'media_date' => $item['image_date'], 'last_edit_date' => $item['image_date'], 'last_comment_date' => $item['image_last_comment'], 'media_type' => 'image_upload', 'media_state' => 'visible', 'album_id' => $albumId, 'category_id' => $categoryId, 'media_privacy' => $mediaPrivacy, 'attachment_id' => 0, 'user_id' => $userId, 'username' => $item['name'], 'ip_id' => $model->getLatestIpIdFromUserId($userId), 'likes' => 0, 'like_users' => array(), 'comment_count' => $item['image_comments'], 'rating_count' => 0, 'media_view_count' => $item['image_views']);
     $xfAttachment = array('data_id' => 0, 'content_type' => 'xengallery_media', 'content_id' => 0, 'attach_date' => $item['image_date'], 'temp_hash' => '', 'unassociated' => 0, 'view_count' => $item['image_views']);
     $xfAttachmentData = array('user_id' => $userId, 'upload_date' => $item['image_date'], 'filename' => utf8_substr($this->_convertToUtf8($item['image_file_name']), 0, 100), 'attach_count' => 1);
     $importedMediaId = $model->importMedia($item['image_id'], $tempFile, '', $xengalleryMedia, $xfAttachment, $xfAttachmentData);
     @unlink($tempFile);
     return $importedMediaId;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:34,代码来源:IPGallery50x.php

示例4: getContentTitle

 public function getContentTitle(array $content)
 {
     return XenForo_Template_Helper_Core::helperSnippet($content['message'], 150, array('stripQuote' => true));
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:4,代码来源:Comment.php


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