本文整理汇总了PHP中eZCharsetInfo::characterEncodingScheme方法的典型用法代码示例。如果您正苦于以下问题:PHP eZCharsetInfo::characterEncodingScheme方法的具体用法?PHP eZCharsetInfo::characterEncodingScheme怎么用?PHP eZCharsetInfo::characterEncodingScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZCharsetInfo
的用法示例。
在下文中一共展示了eZCharsetInfo::characterEncodingScheme方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eZCodePage
function eZCodePage($charset_code, $use_cache = true)
{
$this->RequestedCharsetCode = $charset_code;
$this->CharsetCode = eZCharsetInfo::realCharsetCode($charset_code);
$this->CharsetEncodingScheme = eZCharsetInfo::characterEncodingScheme($charset_code);
$this->Valid = false;
$this->SubstituteChar = 63;
// the ? character
$this->MinCharValue = 0;
$this->MaxCharValue = 0;
$this->load($use_cache);
}
示例2: instance
/**
* Returns a shared instance of the eZTextCodec pr the
* $inputCharsetCode and $outputCharsetCode params.
*
* @param string|false $inputCharsetCode Uses {@link eZTextCodec::internalCharset()} if false
* @param string|false $outputCharsetCode Uses {@link eZTextCodec::internalCharset()} if false
* @param bool $alwaysReturn
* @return eZTextCodec|null Returns null if $alwaysReturn is false and text codec is not needed for
* current $inputCharsetCode and $outputCharsetCode.
*/
static function instance($inputCharsetCode, $outputCharsetCode = false, $alwaysReturn = true)
{
if ($inputCharsetCode === false or $outputCharsetCode === false) {
if (isset($GLOBALS['eZTextCodecInternalCharsetReal'])) {
$internalCharset = $GLOBALS['eZTextCodecInternalCharsetReal'];
} else {
$internalCharset = eZTextCodec::internalCharset();
}
}
if ($inputCharsetCode === false) {
$realInputCharsetCode = $inputCharsetCode = $internalCharset;
} else {
$realInputCharsetCode = eZCharsetInfo::realCharsetCode($inputCharsetCode);
}
if ($outputCharsetCode === false) {
$realOutputCharsetCode = $outputCharsetCode = $internalCharset;
} else {
$realOutputCharsetCode = eZCharsetInfo::realCharsetCode($outputCharsetCode);
}
$check =& $GLOBALS["eZTextCodecCharsetCheck"]["{$realInputCharsetCode}-{$realOutputCharsetCode}"];
if (!$alwaysReturn and isset($check) and !$check) {
$check = null;
return $check;
}
if (isset($check) and is_object($check)) {
return $check;
}
if (!$realInputCharsetCode) {
$realInputCharsetCode = eZCharsetInfo::realCharsetCode($inputCharsetCode);
}
if (!$realOutputCharsetCode) {
$realOutputCharsetCode = eZCharsetInfo::realCharsetCode($outputCharsetCode);
}
$inputEncoding = eZCharsetInfo::characterEncodingScheme($realInputCharsetCode, true);
$outputEncoding = eZCharsetInfo::characterEncodingScheme($realOutputCharsetCode, true);
if (!$alwaysReturn and $inputEncoding == 'singlebyte' and $inputEncoding == $outputEncoding and $realInputCharsetCode == $realOutputCharsetCode) {
$check = null;
return $check;
}
$globalsKey = "eZTextCodec-{$realInputCharsetCode}-{$realOutputCharsetCode}";
if (!isset($GLOBALS[$globalsKey]) || !$GLOBALS[$globalsKey] instanceof eZTextCodec) {
$GLOBALS[$globalsKey] = new eZTextCodec($inputCharsetCode, $outputCharsetCode, $realInputCharsetCode, $realOutputCharsetCode, $inputEncoding, $outputEncoding);
}
$check = $GLOBALS[$globalsKey];
return $GLOBALS[$globalsKey];
}