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


PHP CKunenaLink::GetAttachmentLink方法代码示例

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


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

示例1: generate

 protected function generate()
 {
     require_once KPATH_SITE . '/lib/kunena.link.class.php';
     if (!isset($this->_shorttype)) {
         $this->_shorttype = $this->isImage($this->filetype) ? 'image' : $this->filetype;
         $this->_shortname = KunenaForumMessageAttachmentHelper::shortenFileName($this->filename);
         $config = KunenaFactory::getConfig();
         $this->_imagelink = null;
         $template = KunenaFactory::getTemplate();
         switch (strtolower($this->_shorttype)) {
             case 'image':
                 // Check for thumbnail and if available, use for display
                 if (file_exists(JPATH_ROOT . '/' . $this->folder . '/thumb/' . $this->filename)) {
                     $thumb = $this->folder . '/thumb/' . $this->filename;
                     $imgsize = '';
                 } else {
                     $thumb = $this->folder . '/' . $this->filename;
                     $imgsize = 'width="' . $config->thumbwidth . 'px" height="' . $config->thumbheight . 'px"';
                 }
                 $img = '<img title="' . $this->escape($this->filename) . '" ' . $imgsize . ' src="' . JURI::ROOT() . $thumb . '" alt="' . $this->escape($this->filename) . '" />';
                 $this->_thumblink = CKunenaLink::GetAttachmentLink($this->escape($this->folder), $this->escape($this->filename), $img, $this->escape($this->filename), $config->lightbox ? 'lightbox[thumb' . intval($this->mesid) . ']' : '');
                 $img = '<img title="' . $this->escape($this->filename) . '" src="' . JURI::ROOT() . $this->escape($this->folder) . '/' . $this->escape($this->filename) . '" alt="' . $this->escape($this->filename) . '" />';
                 $this->_imagelink = CKunenaLink::GetAttachmentLink($this->escape($this->folder), $this->escape($this->filename), $img, $this->escape($this->filename), $config->lightbox ? 'lightbox[imagelink' . intval($this->mesid) . ']' : '');
                 $this->_textLink = CKunenaLink::GetAttachmentLink($this->escape($this->folder), $this->escape($this->filename), $this->escape($this->_shortname), $this->escape($this->filename), $config->lightbox ? 'lightbox[simple' . $this->mesid . ']' . ' nofollow' : ' nofollow') . ' (' . number_format(intval($this->size) / 1024, 0, '', ',') . 'KB)';
                 break;
             default:
                 // Filetype without thumbnail or icon support - use default file icon
                 $img = '<img src="' . JURI::root() . 'media/kunena/images/attach_generic.png" alt="' . JText::_('COM_KUNENA_ATTACH') . '" />';
                 $this->_thumblink = CKunenaLink::GetAttachmentLink($this->escape($this->folder), $this->escape($this->filename), $img, $this->escape($this->filename), 'nofollow');
                 $this->_textLink = CKunenaLink::GetAttachmentLink($this->escape($this->folder), $this->escape($this->filename), $this->escape($this->_shortname), $this->escape($this->filename), 'nofollow') . ' (' . number_format(intval($this->size) / 1024, 0, '', ',') . 'KB)';
         }
         $this->_disabled = false;
         if (!KunenaUserHelper::getMyself()->exists()) {
             if ($this->_shorttype == 'image' && !$config->showimgforguest) {
                 $this->_disabled = true;
                 $this->_textLink = JText::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG');
             }
             if ($this->_shorttype != 'image' && !$config->showfileforguest) {
                 $this->_disabled = true;
                 $this->_textLink = JText::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE');
             }
             if ($this->_disabled) {
                 $this->_thumblink = '<img src="' . JURI::root() . 'media/kunena/images/attach_generic.png" alt="' . JText::_('COM_KUNENA_ATTACH') . '" />';
                 $this->_imagelink = null;
                 $this->size = 0;
             }
         }
     }
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:49,代码来源:attachment.php

示例2: _get

 function _get($attachments)
 {
     $ret = array();
     foreach ($attachments as $attachment) {
         // combine all images into one type
         $attachment->shorttype = $this->isImage($attachment->filetype) ? 'image' : $attachment->filetype;
         $attachment->shortname = CKunenaTools::shortenFileName($attachment->filename);
         switch (strtolower($attachment->shorttype)) {
             case 'image':
                 // Check for thumbnail and if available, use for display
                 if (file_exists(JPATH_ROOT . '/' . $attachment->folder . '/thumb/' . $attachment->filename)) {
                     $thumb = $attachment->folder . '/thumb/' . $attachment->filename;
                     $imgsize = '';
                 } else {
                     $thumb = $attachment->folder . '/' . $attachment->filename;
                     $imgsize = 'width="' . $this->_config->thumbwidth . 'px" height="' . $this->_config->thumbheight . 'px"';
                 }
                 $img = '<img title="' . $this->escape($attachment->filename) . '" ' . $imgsize . ' src="' . JURI::ROOT() . $thumb . '" alt="' . $this->escape($attachment->filename) . '" />';
                 $attachment->thumblink = CKunenaLink::GetAttachmentLink($this->escape($attachment->folder), $this->escape($attachment->filename), $img, $this->escape($attachment->filename), $this->_config->lightbox ? 'lightbox[thumb' . intval($attachment->mesid) . ']' : '');
                 $img = '<img title="' . $this->escape($attachment->filename) . '" src="' . JURI::ROOT() . $this->escape($attachment->folder) . '/' . $this->escape($attachment->filename) . '" alt="' . $this->escape($attachment->filename) . '" />';
                 $attachment->imagelink = CKunenaLink::GetAttachmentLink($this->escape($attachment->folder), $this->escape($attachment->filename), $img, $this->escape($attachment->filename), $this->_config->lightbox ? 'lightbox[imagelink' . intval($attachment->mesid) . ']' : '');
                 $attachment->textLink = CKunenaLink::GetAttachmentLink($this->escape($attachment->folder), $this->escape($attachment->filename), $this->escape($attachment->shortname), $this->escape($attachment->filename), $this->_config->lightbox ? 'lightbox[simple' . $attachment->mesid . ']' . ' nofollow' : ' nofollow') . ' (' . number_format(intval($attachment->size) / 1024, 0, '', ',') . 'KB)';
                 break;
             default:
                 // Filetype without thumbnail or icon support - use default file icon
                 $img = '<img src="' . KUNENA_URLICONSPATH . 'attach_generic.png" alt="' . JText::_('COM_KUNENA_ATTACH') . '" />';
                 $attachment->thumblink = CKunenaLink::GetAttachmentLink($this->escape($attachment->folder), $this->escape($attachment->filename), $img, $this->escape($attachment->filename), 'nofollow');
                 $attachment->textLink = CKunenaLink::GetAttachmentLink($this->escape($attachment->folder), $this->escape($attachment->filename), $this->escape($attachment->shortname), $this->escape($attachment->filename), 'nofollow') . ' (' . number_format(intval($attachment->size) / 1024, 0, '', ',') . 'KB)';
         }
         $attachment->disabled = false;
         if (!$this->_my->id) {
             if ($attachment->shorttype == 'image' && !$this->_config->showimgforguest) {
                 $attachment->disabled = true;
                 $attachment->textLink = JText::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG');
             }
             if ($attachment->shorttype != 'image' && !$this->_config->showfileforguest) {
                 $attachment->disabled = true;
                 $attachment->textLink = JText::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE');
             }
             if ($attachment->disabled) {
                 $attachment->thumblink = '<img src="' . KUNENA_URLICONSPATH . 'attach_generic.png" alt="' . JText::_('COM_KUNENA_ATTACH') . '" />';
                 unset($attachment->imagelink);
                 $attachment->size = 0;
             }
         }
         $this->_instances[$attachment->id] = $attachment;
         $ret[$attachment->mesid][$attachment->id] = $attachment;
     }
     return $ret;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:50,代码来源:kunena.attachments.class.php


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