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


PHP StringUtil::encodeHTML方法代码示例

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


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

示例1: encodeHTML

 /**
  * Executes StringUtil::encodeHTML on the given text if disableEncoding is false.
  * @see	\wcf\util\StringUtil::encodeHTML()
  */
 protected function encodeHTML($text)
 {
     if (!$this->disableEncoding) {
         $text = StringUtil::encodeHTML($text);
     }
     return $text;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:11,代码来源:HtmlCheckboxesFunctionTemplatePlugin.class.php

示例2: parseKeywords

 /**
  * Parses search keywords.
  * 
  * @param	string		$keywordString
  */
 protected function parseKeywords($keywordString)
 {
     // convert encoding if necessary
     if (!StringUtil::isUTF8($keywordString)) {
         $keywordString = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $keywordString);
     }
     // remove bad wildcards
     $keywordString = preg_replace('/(?<!\\w)\\*/', '', $keywordString);
     // remove search operators
     $keywordString = preg_replace('/[\\+\\-><()~]+/', '', $keywordString);
     if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
         // phrases search
         $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
         if (!empty($keywordString)) {
             $this->keywords = array_merge($this->keywords, array(StringUtil::encodeHTML($keywordString)));
         }
     } else {
         // replace word delimiters by space
         $keywordString = str_replace(array('.', ','), ' ', $keywordString);
         $keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString)));
         if (!empty($keywords)) {
             $this->keywords = array_merge($this->keywords, $keywords);
         }
     }
 }
开发者ID:jacboy,项目名称:WCF,代码行数:30,代码来源:KeywordHighlighter.class.php

示例3: getImageTag

 /**
  * @see	\wcf\data\user\avatar\IUserAvatar::getImageTag()
  */
 public function getImageTag($size = null)
 {
     if ($size === null) {
         $size = $this->size;
     }
     return '<img src="' . StringUtil::encodeHTML($this->getURL($size)) . '" style="width: ' . $size . 'px; height: ' . $size . 'px" alt="" class="userAvatarImage" />';
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:DefaultAvatar.class.php

示例4: getOutput

 /**
  * @see	\wcf\system\option\user\IUserOptionOutput::getOutput()
  */
 public function getOutput(User $user, UserOption $option, $value)
 {
     if (empty($value)) {
         return '';
     }
     return '<img src="' . StringUtil::encodeHTML($value) . '" alt="" />';
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:ImageUserOptionOutput.class.php

示例5: getParsedTag

 /**
  * @see	\wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     $src = '';
     if (isset($openingTag['attributes'][0])) {
         $src = $openingTag['attributes'][0];
     }
     if ($parser->getOutputType() == 'text/html') {
         $float = '';
         if (isset($openingTag['attributes'][1])) {
             $float = $openingTag['attributes'][1];
         }
         $style = '';
         if ($float == 'left' || $float == 'right') {
             $style = 'float: ' . $float . '; margin: ' . ($float == 'left' ? '0 15px 7px 0' : '0 0 7px 15px') . ';';
         }
         $width = 0;
         if (isset($openingTag['attributes'][2])) {
             $width = $openingTag['attributes'][2];
             $style .= 'width: ' . $width . 'px;';
         }
         return '<img src="' . $src . '" class="jsResizeImage" alt=""' . ($style ? ' style="' . $style . '"' : '') . ' />';
     } else {
         if ($parser->getOutputType() == 'text/simplified-html') {
             $src = StringUtil::decodeHTML($src);
             $path = parse_url($src, PHP_URL_PATH);
             if ($path !== false) {
                 return StringUtil::encodeHTML(basename($path));
             }
             return '';
         }
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:35,代码来源:ImageBBCode.class.php

示例6: getOutput

 /**
  * @see	\wcf\system\option\user\IUserOptionOutput::getOutput()
  */
 public function getOutput(User $user, UserOption $option, $value)
 {
     if (empty($value) || $value == 'http://') {
         return '';
     }
     $value = self::getURL($value);
     $value = StringUtil::encodeHTML($value);
     return '<a href="' . $value . '" class="externalURL"' . (EXTERNAL_LINK_REL_NOFOLLOW ? ' rel="nofollow"' : '') . (EXTERNAL_LINK_TARGET_BLANK ? ' target="_blank"' : '') . '>' . $value . '</a>';
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:URLUserOptionOutput.class.php

示例7: cacheQuotes

 /**
  * @see	\wcf\system\bbcode\highlighter\Highlighter::cacheQuotes()
  */
 protected function cacheQuotes($string)
 {
     if ($this->quotesRegEx !== null) {
         $string = $this->quotesRegEx->replace($string, new Callback(function (array $matches) {
             return StringStack::pushToStringStack('<span class="hlQuotes">' . StringUtil::encodeHTML($matches[0]) . '</span>', 'highlighterQuotes', "");
         }));
     }
     return $string;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:SqlHighlighter.class.php

示例8: getOutput

 /**
  * @see	\wcf\system\option\user\IUserOptionOutput::getOutput()
  */
 public function getOutput(User $user, UserOption $option, $value)
 {
     if (empty($value)) {
         return '';
     }
     $url = StringUtil::encodeHTML('https://plus.google.com/' . $value . '/posts');
     $value = StringUtil::encodeHTML($value);
     return '<a href="' . $url . '" class="externalURL"' . (EXTERNAL_LINK_REL_NOFOLLOW ? ' rel="me nofollow"' : ' rel="me"') . (EXTERNAL_LINK_TARGET_BLANK ? ' target="_blank"' : '') . '>' . $value . '</a>';
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:GooglePlusUserOptionOutput.class.php

示例9: cacheQuotes

 /**
  * @see	\wcf\system\bbcode\highlighter\Highlighter::cacheQuotes()
  */
 protected function cacheQuotes($string)
 {
     $string = parent::cacheQuotes($string);
     // highlight CDATA-Tags as quotes
     $string = Regex::compile('<!\\[CDATA\\[.*?\\]\\]>', Regex::DOT_ALL)->replace($string, new Callback(function (array $matches) {
         return StringStack::pushToStringStack('<span class="hlQuotes">' . StringUtil::encodeHTML($matches[0]) . '</span>', 'highlighterQuotes');
     }));
     return $string;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:XmlHighlighter.class.php

示例10: getFormattedUsername

 /**
  * Returns the formatted username.
  * 
  * @return	string
  */
 public function getFormattedUsername()
 {
     $username = StringUtil::encodeHTML($this->username);
     if ($this->userOnlineMarking && $this->userOnlineMarking != '%s') {
         $username = str_replace('%s', $username, $this->userOnlineMarking);
     }
     if ($this->canViewOnlineStatus == 3) {
         $username .= WCF::getLanguage()->get('wcf.user.usersOnline.invisible');
     }
     return $username;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:UserOnline.class.php

示例11: getImage

 /**
  * Returns the image of this user rank.
  * 
  * @return	string		html code
  */
 public function getImage()
 {
     if ($this->rankImage) {
         $image = '<img src="' . (!preg_match('~^(/|https?://)~i', $this->rankImage) ? WCF::getPath() : '') . StringUtil::encodeHTML($this->rankImage) . '" alt="" />';
         if ($this->repeatImage > 1) {
             $image = str_repeat($image, $this->repeatImage);
         }
         return $image;
     }
     return '';
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:UserRank.class.php

示例12: encodeHTML

 /**
  * Converts html special characters in the given array.
  * 
  * @param	array		$array
  * @return	array
  */
 public static function encodeHTML($array)
 {
     if (!is_array($array)) {
         return StringUtil::encodeHTML($array);
     } else {
         foreach ($array as $key => $val) {
             $array[$key] = self::encodeHTML($val);
         }
         return $array;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:17,代码来源:ArrayUtil.class.php

示例13: setOptionValue

 /**
  * Sets option values for a specific user.
  * 
  * @param	\wcf\data\user\User	$user
  */
 public function setOptionValue(User $user)
 {
     $userOption = 'userOption' . $this->optionID;
     $optionValue = $user->{$userOption};
     // use output class
     if ($this->outputClass) {
         $outputObj = $this->getOutputObject();
         $this->optionValue = $outputObj->getOutput($user, $this->getDecoratedObject(), $optionValue);
     } else {
         $this->optionValue = StringUtil::encodeHTML($optionValue);
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:17,代码来源:ViewableUserOption.class.php

示例14: execute

 /**
  * @see wcf\system\template\IBlockTemplatePlugin::execute()
  */
 public function execute($tagArgs, $blockContent, TemplateEngine $tplObj)
 {
     if (!isset($tagArgs['controller'])) {
         throw new SystemException("missing 'controller' argument in link tag");
     }
     if (!isset($tagArgs['application']) || empty($tagArgs['application'])) {
         $tagArgs['application'] = 'wcf';
     }
     if (isset($tagArgs['encode']) && !$tagArgs['encode']) {
         return LinkHandler::getInstance()->getLink($tagArgs['controller'], $tagArgs, $blockContent);
     }
     return StringUtil::encodeHTML(LinkHandler::getInstance()->getLink($tagArgs['controller'], $tagArgs, $blockContent));
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:16,代码来源:LinkBlockTemplatePlugin.class.php

示例15: getFormElement

 /**
  * @see	\wcf\system\option\IOptionType::getFormElement()
  */
 public function getFormElement(Option $option, $value)
 {
     // get selected group
     $selectedGroups = explode(',', $value);
     // get all groups
     $groups = UserGroup::getGroupsByType();
     // generate html
     $html = '';
     foreach ($groups as $group) {
         $html .= '<label><input type="checkbox" name="values[' . StringUtil::encodeHTML($option->optionName) . '][]" value="' . $group->groupID . '" ' . (in_array($group->groupID, $selectedGroups) ? 'checked="checked" ' : '') . '/> ' . $group->getName() . '</label>';
     }
     return $html;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:UserGroupsUserGroupOptionType.class.php


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