本文整理汇总了PHP中TYPO3\CMS\Core\Charset\CharsetConverter::utf8_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP CharsetConverter::utf8_encode方法的具体用法?PHP CharsetConverter::utf8_encode怎么用?PHP CharsetConverter::utf8_encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Charset\CharsetConverter
的用法示例。
在下文中一共展示了CharsetConverter::utf8_encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charsetEntity2utf8
/**
* Convert character set and HTML entities in the value of input content array keys
*
* @param array Standard content array
* @param string Charset of the input content (converted to utf-8)
* @return void
*/
public function charsetEntity2utf8(&$contentArr, $charset)
{
// Convert charset if necessary
foreach ($contentArr as $key => $value) {
if ((string) $contentArr[$key] !== '') {
if ($charset !== 'utf-8') {
$contentArr[$key] = $this->csObj->utf8_encode($contentArr[$key], $charset);
}
// decode all numeric / html-entities in the string to real characters:
$contentArr[$key] = $this->csObj->entities_to_utf8($contentArr[$key], TRUE);
}
}
}
示例2: tempPageCacheContent
/**
* Temp cache content
* The temporary cache will expire after a few seconds (typ. 30) or will be cleared by the rendered page, which will also clear and rewrite the cache.
*
* @return void
* @todo Define visibility
*/
public function tempPageCacheContent()
{
$this->tempContent = FALSE;
if (!$this->no_cache) {
$seconds = 30;
$title = htmlspecialchars($this->tmpl->printTitle($this->page['title']));
$request_uri = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'));
$stdMsg = '
<strong>Page is being generated.</strong><br />
If this message does not disappear within ' . $seconds . ' seconds, please reload.';
$message = $this->config['config']['message_page_is_being_generated'];
if (strcmp('', $message)) {
// This page is always encoded as UTF-8
$message = $this->csConvObj->utf8_encode($message, $this->renderCharset);
$message = str_replace('###TITLE###', $title, $message);
$message = str_replace('###REQUEST_URI###', $request_uri, $message);
} else {
$message = $stdMsg;
}
$temp_content = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>' . $title . '</title>
<meta http-equiv="refresh" content="10" />
</head>
<body style="background-color:white; font-family:Verdana,Arial,Helvetica,sans-serif; color:#cccccc; text-align:center;">' . $message . '
</body>
</html>';
// Fix 'nice errors' feature in modern browsers
$padSuffix = '<!--pad-->';
// prevent any trims
$padSize = 768 - strlen($padSuffix) - strlen($temp_content);
if ($padSize > 0) {
$temp_content = str_pad($temp_content, $padSize, LF) . $padSuffix;
}
if (!$this->headerNoCache() && ($cachedRow = $this->getFromCache_queryRow())) {
// We are here because between checking for cached content earlier and now some other HTTP-process managed to store something in cache AND it was not due to a shift-reload by-pass.
// This is either the "Page is being generated" screen or it can be the final result.
// In any case we should not begin another rendering process also, so we silently disable caching and render the page ourselves and thats it.
// Actually $cachedRow contains content that we could show instead of rendering. Maybe we should do that to gain more performance but then we should set all the stuff done in $this->getFromCache()... For now we stick to this...
$this->set_no_cache();
} else {
$this->tempContent = TRUE;
// This flag shows that temporary content is put in the cache
$this->setPageCacheContent($temp_content, $this->config, $GLOBALS['EXEC_TIME'] + $seconds);
}
}
}
示例3: recodeString
/**
* Recode string
* Used with text strings for fonts when languages has other character sets.
*
* @param string The text to recode
* @return string The recoded string. Should be UTF-8 output. MAY contain entities (eg. { or &#quot; which should render as real chars).
*/
public function recodeString($string)
{
// Recode string to UTF-8 from $this->nativeCharset:
if ($this->nativeCharset && $this->nativeCharset != 'utf-8') {
// Convert to UTF-8
$string = $this->csConvObj->utf8_encode($string, $this->nativeCharset);
}
return $string;
}