本文整理汇总了PHP中StringUtil::decodeHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::decodeHTML方法的具体用法?PHP StringUtil::decodeHTML怎么用?PHP StringUtil::decodeHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::decodeHTML方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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;
}
}
}
示例2: 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];
}
示例3: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
foreach ($eventObj->categories as $categoryKey => $category) {
foreach ($category['options'] as $optionKey => $option) {
if ($option['optionType'] == 'text' && $option['outputClass'] == '' && $option['searchable'] == 1) {
$values = preg_split('/\\s*(?:,|;|&)\\s*/', StringUtil::decodeHTML($option['optionValue']));
$newValue = '';
foreach ($values as $value) {
if (!empty($newValue)) {
$newValue .= ', ';
}
$newValue .= '<a href="index.php?form=MembersSearch&values[' . $option['optionName'] . ']=' . StringUtil::encodeHTML(rawurlencode($value)) . SID_ARG_2ND . '">' . StringUtil::encodeHTML($value) . '</a>';
}
$eventObj->categories[$categoryKey]['options'][$optionKey]['optionValue'] = $newValue;
}
}
}
}
示例4: getParsedTag
/**
* @see BBCode::getParsedTag()
*/
public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser)
{
$url = '';
if (isset($openingTag['attributes'][0])) {
$url = $openingTag['attributes'][0];
}
$noTitle = $content == $url;
// add protocol if necessary
if (!preg_match("/[a-z]:\\/\\//si", $url)) {
$url = 'http://' . $url;
}
if ($parser->getOutputType() == 'text/html') {
$external = true;
if (($newURL = $this->isInternalURL($url)) !== false) {
$url = $newURL;
$external = false;
}
// cut visible url
if ($noTitle) {
$decodedContent = StringUtil::decodeHTML($content);
if (StringUtil::length($decodedContent) > 60) {
$content = StringUtil::encodeHTML(StringUtil::substring($decodedContent, 0, 40)) . '…' . StringUtil::encodeHTML(StringUtil::substring($decodedContent, -15));
}
} else {
$content = StringUtil::trim($content);
}
return '<a href="' . $url . '"' . ($external ? ' class="externalURL"' : '') . '>' . $content . '</a>';
} else {
if ($parser->getOutputType() == 'text/plain') {
if ($noTitle) {
return $url;
}
return $content . ': ' . $url;
}
}
}
示例5: normalizeTitle
/**
* Converts the encoding of an title into the charset used from the database
*
* @param string $title the title to be converted
* @param string $fromCharset the charset of the title, using 'auto' if not set
*/
protected static function normalizeTitle($title, $fromCharset = 'auto')
{
//remove uneccessary empty characters und convert html special chars
$title = StringUtil::convertEncoding($fromCharset, WCF::getDB()->getCharset(), $title);
//return title converted to the used charset.
return StringUtil::decodeHTML(StringUtil::trim($title));
}
示例6: parseURLsCallback
private static function parseURLsCallback($matches)
{
$url = $title = $matches[0];
$decodedTitle = StringUtil::decodeHTML($title);
if (StringUtil::length($decodedTitle) > 60) {
$title = StringUtil::encodeHTML(StringUtil::substring($decodedTitle, 0, 40)) . '…' . StringUtil::encodeHTML(StringUtil::substring($decodedTitle, -15));
}
// add protocol if necessary
if (!preg_match("/[a-z]:\\/\\//si", $url)) {
$url = 'http://' . $url;
}
$external = true;
if (($newURL = self::isInternalURL($url)) !== false) {
$url = $newURL;
$external = false;
}
return '<a href="' . $url . '"' . ($external ? ' class="externalURL"' : '') . '>' . $title . '</a>';
}
示例7: parse
/**
* Formats a message for search result output.
*
* @param string $text
* @return string
*/
public static function parse($text)
{
// remove html codes
$text = StringUtil::stripHTML($text);
// decode html
$text = StringUtil::decodeHTML($text);
// get abstract
$text = self::getMessageAbstract($text);
// encode html
$text = StringUtil::encodeHTML($text);
// do highlighting
return KeywordHighlighter::doHighlight($text);
}
示例8: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
// check permission
WCF::getUser()->checkPermission('admin.user.canPMToUserGroups');
$sql = "SELECT COUNT(DISTINCT u.userID) AS cnt" . "\n FROM wcf" . WCF_N . "_user u" . "\n LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n AND v.optionValue = '1'" . "\n AND u.userID != " . $this->userID . "\n AND g.groupID IN (" . $this->pmData['groupIDs'] . ")";
$row = WCF::getDB()->getFirstRow($sql);
$count = $row['cnt'];
if (!$count > 0) {
// clear session
if (isset($this->pmData)) {
$pmData = WCF::getSession()->getVar('pmData');
unset($pmData[$this->pmSessionID]);
WCF::getSession()->register('pmData', $pmData);
}
$this->finish('wcf.pmToUgrps.error.noRecipients', 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
if ($count <= $this->limit * $this->loop) {
$endTime = TIME_NOW;
$lf = "\n";
// remove from outbox
$sql = "UPDATE wcf" . WCF_N . "_pm" . "\n SET saveInOutbox = 0" . "\n WHERE pmID = " . $this->pmID;
WCF::getDB()->sendQuery($sql);
// groups...
$groups = '';
$sql = "SELECT groupName" . "\n FROM wcf" . WCF_N . "_group" . "\n WHERE groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY groupName";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (!empty($groups)) {
$groups .= ', ';
}
$groups .= StringUtil::decodeHTML($row['groupName']);
}
// log...
$log = '';
$subject = WCF::getLanguage()->get('wcf.pmToUgrps.log.subject', array('$pmID' => $this->pmID)) . ' ' . $this->pmData['subject'];
if ($this->pmData['enableHtml']) {
$log .= '<pre>';
}
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.started', array('$startTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $this->pmData['startTime']))) . $lf;
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.finished', array('$endTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $endTime))) . $lf;
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.recipients', array('$groups' => $groups, '$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)))) . $lf;
$log .= str_repeat('-', 60) . $lf;
if ($this->pmData['enableHtml']) {
$log .= '</pre>' . $lf;
}
$log .= $this->pmData['text'];
$this->recipientArray = $this->blindCopyArray = array();
$this->recipientArray[0]['userID'] = $this->userID;
$this->recipientArray[0]['username'] = $this->username;
PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $subject, $log, $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => false));
// clear session
$pmData = WCF::getSession()->getVar('pmData');
unset($pmData[$this->pmSessionID]);
WCF::getSession()->register('pmData', $pmData);
$this->calcProgress();
$msg = WCF::getLanguage()->get('wcf.pmToUgrps.finish', array('$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)), '$startTime' => DateUtil::formatShortTime('%H:%M:%S', $this->pmData['startTime']), '$endTime' => DateUtil::formatShortTime('%H:%M:%S', $endTime)));
$this->finish($msg, 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
// get users
$sql = "SELECT DISTINCT u.userID, u.username" . "\n FROM wcf" . WCF_N . "_user u" . "\n LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n AND v.optionValue = '1'" . "\n AND u.userID != " . $this->userID . "\n AND g.groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY u.userID";
$this->blindCopyArray = array();
$i = 0;
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->blindCopyArray[$i]['userID'] = $row['userID'];
$this->blindCopyArray[$i]['username'] = $row['username'];
$i++;
}
if (count($this->blindCopyArray)) {
if (empty($this->pmID)) {
$tmp = PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $this->pmData['subject'], $this->pmData['text'], $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => $this->pmData['showSignature']));
if ($tmp->pmID) {
$this->pmID = intval($tmp->pmID);
$pmData = WCF::getSession()->getVar('pmData');
$pmData[$this->pmSessionID]['pmID'] = $this->pmID;
WCF::getSession()->register('pmData', $pmData);
$mlt = intval($this->pmData['maxLifeTime']);
if ($mlt > 0) {
$mlt = $this->pmData['startTime'] + 86400 * $mlt;
} else {
$mlt = 0;
}
$sql = "INSERT IGNORE INTO wcf" . WCF_N . "_pm_bulk_mailing" . "\n (pmID, elapsedTime, time, userID)" . "\nVALUES (" . $this->pmID . ", " . $mlt . ", " . $this->pmData['startTime'] . ", " . $this->userID . ")";
WCF::getDB()->sendQuery($sql);
}
} else {
$recipientIDs = $inserts = '';
foreach ($this->blindCopyArray as $k => $v) {
$username = WCF::getDB()->escapeString($this->blindCopyArray[$k]['username']);
if (!empty($recipientIDs)) {
$recipientIDs .= ',';
}
$recipientIDs .= $this->blindCopyArray[$k]['userID'];
if (!empty($inserts)) {
$inserts .= ',';
}
//.........这里部分代码省略.........
示例9: buildURLTag
/**
* Builds the url bbcode tag.
*
* @param string $url
* @param integer $id
* @param boolean $isPost
*/
protected function buildURLTag($url, $id, $isPost = false)
{
if ($isPost) {
if (isset($this->postIDToThreadID[$id])) {
$id = $this->postIDToThreadID[$id];
} else {
$id = 0;
}
}
if ($id != 0 && isset($this->threads[$id])) {
return (!empty($this->threads[$id]['prefix']) ? '[b]' . StringUtil::decodeHTML(WCF::getLanguage()->get(StringUtil::encodeHTML($this->threads[$id]['prefix']))) . '[/b] ' : '') . '[url=\'' . $url . '\']' . $this->threads[$id]['topic'] . '[/url]';
}
return '[url]' . $url . '[/url]';
}
示例10: cronRunJournal
public function cronRunJournal($pmDelCnt = 0, $cLog = 0, $cStat = 0, $cAdminMail = 0)
{
if (!empty($cLog) || !empty($cStat)) {
require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
require_once WCF_DIR . 'lib/data/user/User.class.php';
require_once WCF_DIR . 'lib/system/language/Language.class.php';
$pR = 45;
$pL = 35;
// get default language
$sql = "SELECT languageID" . "\n FROM wcf" . WCF_N . "_language" . "\n WHERE isDefault = 1";
$tmp = WCF::getDB()->getFirstRow($sql);
$lang = $tmp['languageID'] == WCF::getLanguage()->getLanguageID() ? WCF::getLanguage() : new Language($tmp['languageID']);
$useStrftime = DateUtil::$useStrftime;
DateUtil::$useStrftime = $lang->get('wcf.global.dateMethod') == 'strftime';
$currentDate = DateUtil::formatDate($lang->get('wcf.global.dateFormat'), TIME_NOW);
$previousDayStart = mktime(0, 0, 0, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW) - 1, (int) date("Y", TIME_NOW));
$previousDayEnd = mktime(0, 0, -1, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW), (int) date("Y", TIME_NOW));
$logDate = DateUtil::formatDate($lang->get('wcf.global.dateFormat'), $previousDayStart);
$spacer = str_repeat('-', 80);
$mailUserHeader = "\n" . self::str_pad("USER", 26, " ") . self::str_pad("USERID", 12, " ", STR_PAD_LEFT) . " " . self::str_pad("REG-DATE", 20, " ") . "LAST-ACTIVE" . "\n" . $spacer;
$subject = $lang->get('wcf.acp.adminTools.cron.mail.subject', array('PAGE_TITLE' => PAGE_TITLE, '$currentDate' => $currentDate));
$message = $lang->get('wcf.acp.adminTools.cron.mail.header', array('PAGE_TITLE' => PAGE_TITLE));
// log -----------------------------------------
if (!empty($cLog)) {
$message .= "\n\n" . $spacer;
$message .= "\n" . $lang->get('wcf.acp.adminTools.cron.mail.logHeader', array('$logDate' => $logDate));
$message .= "\n" . $spacer;
// deleted PMs -----------------------------
if (!empty($pmDelCnt)) {
$message .= "\n\n" . $lang->get('wcf.acp.adminTools.cron.mail.statsCntDeletedPMs') . ' ' . StringUtil::decodeHTML(StringUtil::formatInteger($pmDelCnt));
}
// registrations ---------------------------
$mailMsg = '';
$cnt = 0;
$sql = "SELECT userID" . "\n FROM wcf" . WCF_N . "_user" . "\n WHERE registrationDate >= " . $previousDayStart . "\n AND registrationDate <= " . $previousDayEnd . "\n ORDER BY LOWER(username)";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$user = new User($row['userID']);
$cnt++;
$mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . " " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
}
$message .= "\n\n";
$message .= $lang->get('wcf.acp.adminTools.cron.mail.registrations') . ' ' . $cnt . $mailUserHeader;
if (!empty($cnt)) {
$message .= $mailMsg;
} else {
$message .= "\n-";
}
// user quits ------------------------------
$mailMsg = '';
$cnt = 0;
$sql = "SELECT userID" . "\n FROM wcf" . WCF_N . "_user" . "\n WHERE quitStarted > 0" . "\n ORDER BY LOWER(username)";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$user = new User($row['userID']);
$cnt++;
$mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . " " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
$quitStarted = DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->quitStarted);
$quitExec = DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->quitStarted + 7 * 86400);
$mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($lang->get('wcf.acp.adminTools.cron.mail.quitInfo', array('$quitStarted' => $quitStarted, '$quitExec' => $quitExec))), $pL + $pR, " ", STR_PAD_LEFT);
}
$message .= "\n\n";
$message .= $lang->get('wcf.acp.adminTools.cron.mail.quit') . ' ' . $cnt . $mailUserHeader;
if (!empty($cnt)) {
$message .= $mailMsg;
} else {
$message .= "\n-";
}
// inactive ------------------------------------
$mailMsg = '';
$cnt = 0;
$sql = "SELECT userID" . "\n FROM wcf" . WCF_N . "_user" . "\n WHERE activationCode > 0" . "\n ORDER BY LOWER(username)";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$user = new User($row['userID']);
$cnt++;
$mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . " " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
}
$message .= "\n\n";
$message .= $lang->get('wcf.acp.adminTools.cron.mail.inactives') . ' ' . $cnt . $mailUserHeader;
if (!empty($cnt)) {
$message .= $mailMsg;
} else {
$message .= "\n-";
}
// banned --------------------------------------
$mailMsg = '';
$cnt = 0;
$sql = "SELECT userID" . "\n FROM wcf" . WCF_N . "_user" . "\n WHERE banned > 0" . "\n ORDER BY LOWER(username)";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$user = new User($row['userID']);
$cnt++;
$mailMsg .= "\n" . self::str_pad(StringUtil::encodeHTML($user->username), 26, " ") . self::str_pad($user->userID, 12, " ", STR_PAD_LEFT) . " " . self::str_pad(DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate($lang->get('wcf.global.timeFormat'), $user->lastActivityTime);
}
$message .= "\n\n";
$message .= $lang->get('wcf.acp.adminTools.cron.mail.banned') . ' ' . $cnt . $mailUserHeader;
if (!empty($cnt)) {
$message .= $mailMsg;
} else {
//.........这里部分代码省略.........