本文整理汇总了PHP中StringUtil::encodeHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::encodeHTML方法的具体用法?PHP StringUtil::encodeHTML怎么用?PHP StringUtil::encodeHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::encodeHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encodeHTML
/**
* Executes StringUtil::encodeHTML on the given text if disableEncoding is false.
* @see StringUtil::encodeHTML()
*/
protected function encodeHTML($text)
{
if (!$this->disableEncoding) {
$text = StringUtil::encodeHTML($text);
}
return $text;
}
示例2: getFormattedDescription
/**
* Returns the formatted description of this class.
*
* @return string
*/
public function getFormattedDescription()
{
if ($this->description) {
return nl2br(StringUtil::encodeHTML($this->description));
}
return '';
}
示例3: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (MODULE_USERS_ONLINE == 1) {
if ($eventObj->activeCategory == 'profile') {
if ($eventName == 'validate') {
if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) {
if (isset($_POST['userOnlineGroupID'])) {
$this->userOnlineGroupID = intval($_POST['userOnlineGroupID']);
}
// validate user online group id
if ($this->userOnlineGroupID) {
try {
$sql = "SELECT\t\tgroupID\n\t\t\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\t\t\tWHERE\t\tgroupID = " . $this->userOnlineGroupID . "\n\t\t\t\t\t\t\t\t\t\t\tAND groupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")";
$row = WCF::getDB()->getFirstRow($sql);
if (!isset($row['groupID'])) {
throw new UserInputException('userOnlineGroupID');
}
// save rankid
$eventObj->additionalFields['userOnlineGroupID'] = $this->userOnlineGroupID;
} catch (UserInputException $e) {
$eventObj->errorType[$e->getField()] = $e->getType();
}
}
}
} else {
if ($eventName == 'assignVariables') {
if (!count($_POST)) {
// get current values
$this->userOnlineGroupID = WCF::getUser()->userOnlineGroupID;
}
$fields = array();
// get user online markings
if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) {
$markings = array();
$sql = "SELECT\t\tgroupID, groupName, userOnlineMarking\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\tWHERE\t\tgroupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")\n\t\t\t\t\t\t\tORDER BY\tgroupID ASC";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['userOnlineMarking'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML(WCF::getUser()->username));
$markings[] = $row;
}
if (count($markings) > 1) {
WCF::getTPL()->assign(array('markings' => $markings, 'userOnlineGroupID' => $this->userOnlineGroupID));
$fields[] = array('optionName' => 'userOnlineGroupID', 'divClass' => 'formRadio', 'beforeLabel' => false, 'isOptionGroup' => true, 'html' => WCF::getTPL()->fetch('userProfileEditOnlineMarkingSelect'));
}
}
// add fields
if (count($fields) > 0) {
foreach ($eventObj->options as $key => $category) {
if ($category['categoryName'] == 'profile.rank') {
$eventObj->options[$key]['options'] = array_merge($category['options'], $fields);
return;
}
}
$eventObj->options[] = array('categoryName' => 'profile.rank', 'categoryIconM' => '', 'options' => $fields);
}
}
}
}
}
}
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:63,代码来源:UserProfileEditFormOnlineMarkingListener.class.php
示例4: __construct
public function __construct($data, $boxname = "")
{
$this->TopData['templatename'] = "topthanksgivinguser";
$this->getBoxStatus($data);
$this->TopData['boxID'] = $data['boxID'];
if (!defined('TOPTHANKSGIVINGUSER_COUNT_ACP')) {
define('TOPTHANKSGIVINGUSER_COUNT_ACP', 10);
}
if (!defined('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP')) {
define('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP', 28);
}
if (!defined('TOPTHANKSGIVINGUSER_SBCOLOR_ACP')) {
define('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', 2);
}
if (!defined('TOPTHANKSGIVINGUSER_HITS_ACP')) {
define('TOPTHANKSGIVINGUSER_HITS_ACP', true);
}
$sql = "SELECT wcf.userID, wcf.username, wbb.thanks_got" . "\n FROM wcf" . WCF_N . "_user wcf" . "\n LEFT JOIN wbb" . WBB_N . "_user wbb ON (wbb.userid = wcf.userid)" . "\n WHERE wbb.thanks_got > 0" . "\n ORDER BY wbb.thanks_got DESC, wcf.username" . "\n LIMIT 0, " . TOPTHANKSGIVINGUSER_COUNT_ACP;
$result = WBBCore::getDB()->sendQuery($sql);
while ($row = WBBCore::getDB()->fetchArray($result)) {
$plainUser = $row['username'];
$row['thanks_got'] = StringUtil::formatInteger($row['thanks_got']);
if (TOPTHANKSGIVINGUSER_TITLELENGTH_ACP != 0 && strlen($plainUser) > TOPTHANKSGIVINGUSER_TITLELENGTH_ACP) {
$row['username'] = StringUtil::substring($plainUser, 0, TOPTHANKSGIVINGUSER_TITLELENGTH_ACP - 3) . '...';
}
$row['username'] = StringUtil::encodeHTML($row['username']);
$this->TopData['thanksgivinguser'][] = $row;
}
WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', intval(TOPTHANKSGIVINGUSER_SBCOLOR_ACP));
WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_HITS_ACP', TOPTHANKSGIVINGUSER_HITS_ACP);
}
示例5: __construct
public function __construct($data, $boxname = "")
{
$this->TopData['templatename'] = "topthreads";
$this->getBoxStatus($data);
$this->TopData['boxID'] = $data['boxID'];
if (!defined('TOPTHREADS_COUNT')) {
define('TOPTHREADS_COUNT', 10);
}
if (!defined('TOPTHREADS_TITLELENGTH')) {
define('TOPTHREADS_TITLELENGTH', 25);
}
if (!defined('TOPTHREADS_SBCOLOR_ACP')) {
define('TOPTHREADS_SBCOLOR_ACP', 2);
}
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$boardIDs = Board::getAccessibleBoards();
if (!empty($boardIDs)) {
$sql = "SELECT thread.*" . "\n FROM wbb" . WBB_N . "_thread thread" . "\n WHERE thread.boardID IN (0" . $boardIDs . ")" . "\n ORDER BY thread.replies DESC" . "\n LIMIT 0, " . TOPTHREADS_COUNT;
$result = WBBCore::getDB()->sendQuery($sql);
while ($row = WBBCore::getDB()->fetchArray($result)) {
$row['replies'] = StringUtil::formatInteger($row['replies']);
$row['title'] = StringUtil::encodeHTML($row['topic']) . ' - ' . $row['replies'];
if (TOPTHREADS_TITLELENGTH != 0 && strlen($row['topic']) > TOPTHREADS_TITLELENGTH) {
$row['topic'] = StringUtil::substring($row['topic'], 0, TOPTHREADS_TITLELENGTH - 3) . '...';
}
$row['topic'] = StringUtil::encodeHTML($row['topic']);
$this->TopData['threads'][] = $row;
}
}
}
示例6: parseKeywords
/**
* Parses search keywords.
*
* @param string $keywordString
*/
protected static function parseKeywords($keywordString)
{
// convert encoding if necessary
if (CHARSET == 'UTF-8' && !StringUtil::isASCII($keywordString) && !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 (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') {
// phrases search
$keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1));
if (!empty($keywordString)) {
self::$keywords = array_merge(self::$keywords, array(StringUtil::encodeHTML($keywordString)));
}
} else {
// replace word delimiters by space
$keywordString = preg_replace('/[.,]/', ' ', $keywordString);
$keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString)));
if (count($keywords) > 0) {
self::$keywords = array_merge(self::$keywords, $keywords);
}
}
}
示例7: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventName == 'init') {
$eventObj->sqlSelects .= 'wbb_user.posts,';
$eventObj->sqlJoins .= ' LEFT JOIN wbb' . WBB_N . '_user wbb_user
ON (wbb_user.userID = user.userID) ';
} else {
if ($eventName == 'assignVariables') {
$user = $eventObj->frame->getUser();
$eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('postM.png'), 'title' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => '<a href="index.php?form=Search&types[]=post&userID=' . $user->userID . SID_ARG_2ND . '" title="' . WCF::getLanguage()->get('wcf.user.profile.search', array('$username' => StringUtil::encodeHTML($user->username))) . '">' . StringUtil::formatInteger(intval($user->posts)) . ($user->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->get('wcf.user.postsPerDay', array('$posts' => StringUtil::formatDouble($user->posts / $user->getProfileAge()))) : '') . '</a>');
// show last 5 posts
if (PROFILE_SHOW_LAST_POSTS) {
require_once WBB_DIR . 'lib/data/post/ViewablePost.class.php';
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$boardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
if (count($boardIDArray)) {
$posts = array();
$sql = "SELECT\t\tpost.postID, post.time,\n\t\t\t\t\t\t\t\tCASE WHEN post.subject <> '' THEN post.subject ELSE thread.topic END AS subject\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_user_last_post user_last_post\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tON\t\t(post.postID = user_last_post.postID)\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\t\tWHERE\t\tuser_last_post.userID = " . $user->userID . "\n\t\t\t\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t\t\t\tAND thread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? "AND thread.languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\tORDER BY\tuser_last_post.time DESC";
$result = WCF::getDB()->sendQuery($sql, 5);
while ($row = WCF::getDB()->fetchArray($result)) {
$posts[] = new ViewablePost(null, $row);
}
if (count($posts)) {
WCF::getTPL()->assign(array('posts' => $posts, 'user' => $user));
WCF::getTPL()->append('additionalContent2', WCF::getTPL()->fetch('userProfileLastPosts'));
}
}
}
}
}
}
示例8: getOutput
/**
* @see UserOptionOutput::getOutput()
*/
public function getOutput(User $user, $optionData, $value)
{
if (empty($value)) {
return '';
}
return '<img src="' . StringUtil::encodeHTML($value) . '" alt="" />';
}
示例9: getImage
/**
* Returns the icon html code.
*
* @return string
*/
protected function getImage(User $user, $imageSize = 'M')
{
$title = WCF::getLanguage()->get('wcf.user.profile.' . $this->type . '.title', array('$username' => StringUtil::encodeHTML($user->username)));
if (class_exists('StyleManager')) {
return '<img src="' . StyleManager::getStyle()->getIconPath($this->type . $imageSize . '.png') . '" alt="" title="' . $title . '" />';
}
return '<img src="' . RELATIVE_WCF_DIR . 'icon/' . $this->type . $imageSize . '.png' . '" alt="" title="' . $title . '" />';
}
示例10: getImage
/**
* Generates an image button.
*
* @see UserOptionOutput::getShortOutput()
*/
protected function getImage(User $user, $value, $imageSize = 'M')
{
if (empty($value) || $value == 'http://') {
return '';
}
$value = self::getURL($value);
$title = WCF::getLanguage()->get('wcf.user.profile.homepage.title', array('$username' => StringUtil::encodeHTML($user->username)));
return '<a href="' . StringUtil::encodeHTML($value) . '"><img src="' . StyleManager::getStyle()->getIconPath('website' . $imageSize . '.png') . '" alt="" title="' . $title . '" /></a>';
}
示例11: __construct
public function __construct($data, $boxname = "")
{
if (!defined('BUDDIESBOX_SBCOLOR_ACP')) {
define('BUDDIESBOX_SBCOLOR_ACP', 2);
}
if (!defined('BUDDIESBOX_SHOWDEL_ACP')) {
define('BUDDIESBOX_SHOWDEL_ACP', false);
}
if (!defined('BUDDIESBOX_SHOWUSERMARKING_ACP')) {
define('BUDDIESBOX_SHOWUSERMARKING_ACP', false);
}
if (!defined('BUDDIESBOX_SHOWONLYONLINE_ACP')) {
define('BUDDIESBOX_SHOWONLYONLINE_ACP', true);
}
if (!defined('BUDDIESBOX_HIDEIFEMPTY_ACP')) {
define('BUDDIESBOX_HIDEIFEMPTY_ACP', true);
}
$this->BuddiesData['templatename'] = "buddiesbox";
$this->getBoxStatus($data);
$this->BuddiesData['boxID'] = $data['boxID'];
$this->BuddiesData['showBuddiesBox'] = false;
// $buddies = WCF::getUser()->buddies;
if (WCF::getUser()->userID != 0) {
require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
$cnt = 0;
$sql = "SELECT u.*, uo.*, wcg.*" . "\n FROM wcf" . WCF_N . "_user_whitelist wcu" . "\n JOIN wcf" . WCF_N . "_user u ON (u.userID = wcu.whiteUserID)" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = u.userOnlineGroupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID . "\n ORDER BY u.username";
$result = WBBCore::getDB()->sendQuery($sql);
while ($row = WBBCore::getDB()->fetchArray($result)) {
$user = new UserProfile(null, $row);
if (BUDDIESBOX_SHOWONLYONLINE_ACP && !$user->isOnline()) {
continue;
}
if ($user->isOnline()) {
$this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.online', array('$username' => $row['username'])));
$this->BuddiesData['buddies'][$cnt]['img'] = 'onlineS.png';
} else {
$this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.offline', array('$username' => $row['username'])));
$this->BuddiesData['buddies'][$cnt]['img'] = 'offlineS.png';
}
if ($user->acceptPm) {
$this->BuddiesData['buddies'][$cnt]['pm'] = '1';
} else {
$this->BuddiesData['buddies'][$cnt]['pm'] = '';
}
$this->BuddiesData['buddies'][$cnt]['userID'] = $row['userID'];
$this->BuddiesData['buddies'][$cnt]['username'] = StringUtil::encodeHTML($row['username']);
// userOnlineMarking...
if (BUDDIESBOX_SHOWUSERMARKING_ACP && !empty($row['userOnlineMarking']) && $row['userOnlineMarking'] != '%s') {
$this->BuddiesData['buddies'][$cnt]['username'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML($row['username']));
}
$cnt++;
}
if ($cnt > 0 || !BUDDIESBOX_HIDEIFEMPTY_ACP) {
$this->BuddiesData['showBuddiesBox'] = true;
}
}
}
示例12: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (!USERGUESTBOOK_SHOWINSIDEBAR) {
return;
}
if (!WCF::getUser()->getPermission('user.guestbook.canRead')) {
return;
}
if (empty($eventObj->postList->posts)) {
return;
}
$seen = $ret = array();
$ret = WCF::getTPL()->get('additionalSidebarUserContacts');
$link = '<a href="index.php?page=UserGuestbook&userID=%1$d' . SID_ARG_2ND . '"><img src="' . RELATIVE_WCF_DIR . 'icon/guestbookS.png" alt="" title="%2$s" /></a>';
$curUserID = WCF::getUser()->userID;
$curUserCanUse = WCF::getUser()->getPermission('user.guestbook.canUseOwn');
$gbEnableOption = 'userOption' . User::getUserOptionID('userGuestbook_enable');
require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
foreach ($eventObj->postList->posts as $post) {
if ($post->userID) {
if ($curUserID == $post->userID && !$curUserCanUse) {
continue;
} else {
if (!$post->{$gbEnableOption}) {
continue;
} else {
if (array_key_exists($post->userID, $seen)) {
if (!empty($seen[$post->userID])) {
if (isset($ret[$post->postID])) {
$ret[$post->postID] .= ' ' . $seen[$post->userID];
} else {
$ret[$post->postID] = $seen[$post->userID];
}
}
} else {
$add = '';
$user = new UserProfile($post->userID, null, null, null);
if ($user->getPermission('user.guestbook.canUseOwn')) {
$username = StringUtil::encodeHTML($user->username);
$title = WCF::getLanguage()->get('wcf.user.guestbook.title', array('$user->username' => $username));
$add = sprintf($link, $post->userID, $title);
if (isset($ret[$post->postID])) {
$ret[$post->postID] .= ' ' . $add;
} else {
$ret[$post->postID] = $add;
}
}
$seen[$post->userID] = $add;
}
}
}
}
}
if (count($ret)) {
WCF::getTPL()->assign('additionalSidebarUserContacts', $ret);
}
}
示例13: rewriteCallback
public function rewriteCallback($match) {
$args = array();
if (isset($match[2]))
parse_str(StringUtil::decodeHTML($match[2]), $args);
if ($newUrl = $this->rewriteUrl($args))
return StringUtil::encodeHTML($newUrl);
return $match[0];
}
示例14: encodeHTML
/**
* Converts html special characters in arrays.
*
* @param array $array
* @return array $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;
}
}
示例15: 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) ? RELATIVE_WCF_DIR : '') . StringUtil::encodeHTML($this->rankImage) . '" alt="" />';
if ($this->repeatImage > 1) {
$image = str_repeat($image, $this->repeatImage);
}
return $image;
}
return '';
}