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


PHP StringUtil::getAnchorTag方法代码示例

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


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

示例1: getParsedTag

 /**
  * @see	\wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     $url = '';
     if (isset($openingTag['attributes'][0])) {
         $url = $openingTag['attributes'][0];
     }
     $noTitle = $content == $url;
     $url = StringUtil::decodeHTML($url);
     // add protocol if necessary
     if (!preg_match("/[a-z]:\\/\\//si", $url)) {
         $url = 'http://' . $url;
     }
     return StringUtil::getAnchorTag($url, !$noTitle ? $content : '', false);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:17,代码来源:URLBBCode.class.php

示例2: getParsedTag

 /**
  * @see	\wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     $content = StringUtil::trim($content);
     if ($parser->getOutputType() == 'text/html') {
         foreach (BBCodeMediaProvider::getCache() as $provider) {
             if ($provider->matches($content)) {
                 return $provider->getOutput($content);
             }
         }
     }
     if ($parser->getOutputType() == 'text/simplified-html') {
         foreach (BBCodeMediaProvider::getCache() as $provider) {
             if ($provider->matches($content)) {
                 return StringUtil::getAnchorTag($content);
             }
         }
     }
     return StringUtil::encodeHTML($content);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:22,代码来源:MediaBBCode.class.php

示例3: getWebsiteAnchorTag

 /**
  * Returns the website as anchor tag.
  * 
  * @return	string
  */
 public function getWebsiteAnchorTag()
 {
     return StringUtil::getAnchorTag($this->website);
 }
开发者ID:Griborim,项目名称:de.incendium.cms.filebase,代码行数:9,代码来源:Entry.class.php

示例4: getLink

 /**
  * Returns the link of this source.
  * @return	string
  */
 public function getLink()
 {
     return StringUtil::getAnchorTag($this->sourceLink);
 }
开发者ID:joshuaruesweg,项目名称:de.voolia.news,代码行数:8,代码来源:NewsSource.class.php

示例5: getParsedTag

 /**
  * @see	\wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     // get attachment id
     $attachmentID = 0;
     if (isset($openingTag['attributes'][0])) {
         $attachmentID = $openingTag['attributes'][0];
     }
     // get embedded object
     $attachment = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.attachment', $attachmentID);
     if ($attachment === null) {
         if (self::$attachmentList !== null) {
             $attachments = self::$attachmentList->getGroupedObjects(self::$objectID);
             if (isset($attachments[$attachmentID])) {
                 $attachment = $attachments[$attachmentID];
                 // mark attachment as embedded
                 $attachment->markAsEmbedded();
             }
         }
     }
     if ($attachment !== null) {
         if ($attachment->showAsImage() && $attachment->canViewPreview() && $parser->getOutputType() == 'text/html') {
             // image
             $alignment = isset($openingTag['attributes'][1]) ? $openingTag['attributes'][1] : '';
             $width = isset($openingTag['attributes'][2]) ? $openingTag['attributes'][2] : 0;
             // check if width is valid and the original is accessible by viewer
             if ($width > 0) {
                 if ($attachment->canDownload()) {
                     // check if width exceeds image width
                     if ($width > $attachment->width) {
                         $width = $attachment->width;
                     }
                 } else {
                     $width = 0;
                 }
             }
             $result = '';
             if ($width > 0) {
                 $class = '';
                 if ($alignment == 'left' || $alignment == 'right') {
                     $class = 'messageFloatObject' . ucfirst($alignment);
                 }
                 $source = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment)));
                 $title = StringUtil::encodeHTML($attachment->filename);
                 $result = '<a href="' . $source . '" title="' . $title . '" class="embeddedAttachmentLink jsImageViewer' . ($class ? ' ' . $class : '') . '"><img src="' . $source . '" style="width: ' . $width . 'px" alt="" /></a>';
             } else {
                 $linkParameters = array('object' => $attachment);
                 if ($attachment->hasThumbnail()) {
                     $linkParameters['thumbnail'] = 1;
                 }
                 $class = '';
                 if ($alignment == 'left' || $alignment == 'right') {
                     $class = 'messageFloatObject' . ucfirst($alignment);
                 }
                 $imageClasses = '';
                 if (!$attachment->hasThumbnail()) {
                     $imageClasses = 'embeddedAttachmentLink jsResizeImage';
                 }
                 if ($class && (!$attachment->hasThumbnail() || !$attachment->canDownload())) {
                     $imageClasses .= ' ' . $class;
                 }
                 $result = '<img src="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', $linkParameters)) . '"' . ($imageClasses ? ' class="' . $imageClasses . '"' : '') . ' style="width: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailWidth : $attachment->width) . 'px; height: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailHeight : $attachment->height) . 'px;" alt="" />';
                 if ($attachment->hasThumbnail() && $attachment->canDownload()) {
                     $result = '<a href="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))) . '" title="' . StringUtil::encodeHTML($attachment->filename) . '" class="embeddedAttachmentLink jsImageViewer' . ($class ? ' ' . $class : '') . '">' . $result . '</a>';
                 }
             }
             return $result;
         } else {
             // file
             return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment)), !empty($content) && $content != $attachmentID ? $content : $attachment->filename);
         }
     }
     // fallback
     return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', array('id' => $attachmentID)));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:77,代码来源:AttachmentBBCode.class.php

示例6: insertCachedURLs

 /**
  * Reinserts cached URLs and e-mails.
  * 
  * @param	string		$text
  * @return	string
  */
 protected function insertCachedURLs($text)
 {
     foreach ($this->cachedURLs as $hash => $url) {
         // add protocol if necessary
         if (!preg_match("/[a-z]:\\/\\//si", $url)) {
             $url = 'http://' . $url;
         }
         $text = str_replace($hash, StringUtil::getAnchorTag($url), $text);
     }
     foreach ($this->cachedEmails as $hash => $email) {
         $email = StringUtil::encodeHTML($email);
         $text = str_replace($hash, '<a href="mailto:' . $email . '">' . $email . '</a>', $text);
     }
     return $text;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:21,代码来源:SimpleMessageParser.class.php

示例7: getParsedTag

 /**
  * @see \wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     // call copyright
     TeraliosBBCodesCopyright::callCopyright();
     // default values
     $attachmentID = 0;
     $float = 'none';
     $type = 'default';
     $link = '';
     $text = '';
     $isImage = false;
     // parameter values
     $attachmentID = isset($openingTag['attributes'][0]) ? intval($openingTag['attributes'][0]) : 0;
     $float = isset($openingTag['attributes'][1]) ? mb_strtolower($openingTag['attributes'][1]) : 'none';
     switch ($float) {
         case 'left':
         case 'right':
         case 'none':
             break;
         default:
             $float = 'none';
     }
     $text = StringUtil::trim($content);
     $title = WCF::getLanguage()->getDynamicVariable('wcf.bbcode.xattach.title', array('xaID' => $attachmentID));
     // get attachment
     $attachment = MessageEmbeddedObjectManager::getInstance()->getObject('de.teralios.bbcodes.attachment', $attachmentID);
     if ($attachment === null) {
         if (static::$attachmentList !== null) {
             $attachments = static::$attachmentList->getGroupedObjects(static::$objectID);
             if (isset($attachments[$attachmentID])) {
                 $attachment = $attachments[$attachmentID];
                 $attachment->markAsEmbedded();
             }
         }
     }
     // Attachment
     if ($attachment !== null) {
         $title = !empty($attachment->filename) ? WCF::getLanguage()->getDynamicVariable('wcf.bbcode.xattach.title.full', array('xaFilename' => $attachment->filename, 'xaDownloads' => $attachment->downloads)) : $title;
         $linkParameters = array('object' => $attachment);
         // can view image
         if ($attachment->showAsImage() && $attachment->canViewPreview()) {
             if ($attachment->hasThumbnail()) {
                 $linkParameters['thumbnail'] = 1;
             }
             $isImage = true;
             $link = '<img src="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', $linkParameters)) . '"' . (!$attachment->hasThumbnail() ? ' class="embeddedAttachmentLink jsResizeImage"' : '') . ' style="width: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailWidth : $attachment->width) . 'px; height: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailHeight : $attachment->height) . 'px" alt="" />';
             if ($attachment->hasThumbnail() && $attachment->canDownload()) {
                 $link = '<a href="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))) . '" title="' . $title . '" class="embeddedAttachmentLink jsImageViewer">' . $link . '</a>';
             }
         } else {
             if ($attachment->showAsImage()) {
                 $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment)));
                 $type = 'image';
             } else {
                 $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment)));
                 $type = self::getType($attachment);
             }
         }
     } else {
         $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('id' => $attachmentID)));
     }
     if ($parser->getOutputType() == 'text/html') {
         WCF::getTPL()->assign(array('xaLink' => $link, 'xaTitle' => $title, 'xaIcon' => self::choseIcon($type), 'xaIsImage' => $isImage, 'xaText' => $text, 'xaFloat' => $float, 'xaNoBorder' => BBCODES_XATTACH_FREESTYLE));
         $result = WCF::getTPL()->fetch('xAttachBBCode');
     } else {
         $result = StringUtil::getAnchorTag($link, $title) . (!empty($text) ? ' (' . $text . ')' : '');
     }
     return $result;
 }
开发者ID:Zumarta,项目名称:de.teralios.bbcodes,代码行数:72,代码来源:XAttachBBCode.class.php


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