/** * 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; }
<?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>
* * @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>
<?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>