本文整理汇总了PHP中KunenaAttachmentHelper::shortenFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaAttachmentHelper::shortenFileName方法的具体用法?PHP KunenaAttachmentHelper::shortenFileName怎么用?PHP KunenaAttachmentHelper::shortenFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaAttachmentHelper
的用法示例。
在下文中一共展示了KunenaAttachmentHelper::shortenFileName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShortName
/**
* This function shortens long filenames for display purposes.
*
* The first 8 characters of the filename, followed by three dots and the last 5 character of the filename.
*
* @param int $front
* @param int $back
* @param string $filler
* @param bool $escape
*
* @return string
*
* @since K4.0
*/
public function getShortName($front = 10, $back = 8, $filler = '...', $escape = true)
{
if ($this->shortname === null) {
$this->shortname = KunenaAttachmentHelper::shortenFileName($this->getFilename(false), $front, $back, $filler);
}
return $escape ? htmlspecialchars($this->shortname, ENT_COMPAT, 'UTF-8') : $this->shortname;
}
示例2: defined
<?php
/**
* Kunena Component
*
* @package Kunena.Template.Crypsis
* @subpackage BBCode
*
* @copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
defined('_JEXEC') or die ();
/** @var KunenaAttachment $attachment */
$attachment = $this->attachment;
$config = KunenaConfig::getInstance();
$attributesLink = $attachment->isImage() && $config->lightbox ? ' class="fancybox-button" rel="fancybox-button"' : '';
?>
<a class="btn btn-small" rel="popover" data-placement="bottom" data-trigger="hover" target="_blank" data-content="Filesize: <?php echo number_format($attachment->size / 1024, 0, '', ',') . JText::_('COM_KUNENA_USER_ATTACHMENT_FILE_WEIGHT'); ?>
" data-original-title="<?php echo $attachment->getShortName(); ?>" href="<?php echo $attachment->getUrl(); ?>" title="<?php echo KunenaAttachmentHelper::shortenFileName($attachment->getFilename(), 0, 26); ?>">
<i class="icon icon-info"></i>
</a>
示例3: defined
*
* @package Kunena.Template.Crypsis
* @subpackage BBCode
*
* @copyright (C) 2008 - 2015 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
**/
defined('_JEXEC') or die;
/** @var KunenaAttachment $attachment */
$attachment = $this->attachment;
$config = KunenaConfig::getInstance();
$attributesLink = $attachment->isImage() && $config->lightbox ? ' class="fancybox-button" rel="fancybox-button"' : '';
?>
<a class="btn btn-small" rel="popover" data-placement="bottom" data-trigger="hover" data-content="Filesize: <?php
echo number_format($attachment->size / 1024, 0, '', ',') . JText::_('COM_KUNENA_USER_ATTACHMENT_FILE_WEIGHT');
?>
" data-original-title="<?php
echo $attachment->getShortName();
?>
" href="<?php
echo $attachment->getUrl();
?>
" title="<?php
echo KunenaAttachmentHelper::shortenFileName($attachment->getFilename(), 0, 26);
?>
">
<i class="icon icon-info"></i>
</a>
示例4: defined
<?php
/**
* Kunena Component
* @package Kunena.Template.Crypsis
* @subpackage BBCode
*
* @copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
defined ( '_JEXEC' ) or die ();
/** @var KunenaAttachment $attachment */
$attachment = $this->attachment;
if (!$attachment->isImage()) return;
$config = KunenaConfig::getInstance();
$attributesLink = $config->lightbox ? ' rel="lightbox[imagelink' . $attachment->mesid . ']"' : '';
$attributesImg = ' style="max-height:' . (int) $config->imageheight . 'px;"';
?>
<a href="<?php echo $attachment->getUrl(); ?>" title="<?php echo KunenaAttachmentHelper::shortenFileName($attachment->getFilename(), 0,7); ?>"<?php echo $attributesLink; ?>>
<img src="<?php echo $attachment->getUrl(); ?>"<?php echo $attributesImg; ?> alt="" />
</a>