本文整理匯總了PHP中eZCharTransform::commandUrlCleanupIRI方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZCharTransform::commandUrlCleanupIRI方法的具體用法?PHP eZCharTransform::commandUrlCleanupIRI怎麽用?PHP eZCharTransform::commandUrlCleanupIRI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZCharTransform
的用法示例。
在下文中一共展示了eZCharTransform::commandUrlCleanupIRI方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeCommandCode
function executeCommandCode(&$text, $command, $charsetName)
{
if ($command['command'] == 'url_cleanup_iri') {
$text = eZCharTransform::commandUrlCleanupIRI($text, $charsetName);
return true;
} else {
if ($command['command'] == 'url_cleanup') {
$text = eZCharTransform::commandUrlCleanup($text, $charsetName);
return true;
} else {
if ($command['command'] == 'url_cleanup_compat') {
$text = eZCharTransform::commandUrlCleanupCompat($text, $charsetName);
return true;
} else {
if ($command['command'] == 'identifier_cleanup') {
$text = strtolower($text);
$text = preg_replace(array("#[^a-z0-9_ ]#", "/ /", "/__+/", "/^_|_\$/"), array(" ", "_", "_", ""), $text);
return true;
} else {
if ($command['command'] == 'search_cleanup') {
$nonCJKCharsets = $this->nonCJKCharsets();
if (!in_array($charsetName, $nonCJKCharsets)) {
// 4 Add spaces after chinese / japanese / korean multibyte characters
$codec = eZTextCodec::instance(false, 'unicode');
$unicodeValueArray = $codec->convertString($text);
$normalizedTextArray = array();
$bFlag = false;
foreach (array_keys($unicodeValueArray) as $valueKey) {
// Check for word characters that should be broken up for search
if ($unicodeValueArray[$valueKey] >= 12289 and $unicodeValueArray[$valueKey] <= 12542 or $unicodeValueArray[$valueKey] >= 13312 and $unicodeValueArray[$valueKey] <= 40863 or $unicodeValueArray[$valueKey] >= 44032 and $unicodeValueArray[$valueKey] <= 55203) {
if ($bFlag) {
$normalizedTextArray[] = $unicodeValueArray[$valueKey];
}
$normalizedTextArray[] = 32;
// A space
$normalizedTextArray[] = $unicodeValueArray[$valueKey];
$bFlag = true;
} else {
if ($bFlag) {
$normalizedTextArray[] = 32;
// A space
}
$normalizedTextArray[] = $unicodeValueArray[$valueKey];
$bFlag = false;
}
}
if ($bFlag) {
$normalizedTextArray[count($normalizedTextArray) - 1] = 32;
}
$revCodec = eZTextCodec::instance('unicode', false);
// false means use internal charset
$text = $revCodec->convertString($normalizedTextArray);
}
// Make sure dots inside words/numbers are kept, the rest is turned into space
$text = preg_replace(array("#(\\.){2,}#", "#^\\.#", "#\\s\\.#", "#\\.\\s#", "#\\.\$#", "#([^0-9])%#"), array(" ", " ", " ", " ", " ", "\$1 "), $text);
$ini = eZINI::instance();
if ($ini->variable('SearchSettings', 'EnableWildcard') != 'true') {
$text = str_replace("*", " ", $text);
}
$charset = eZTextCodec::internalCharset();
$hasUTF8 = $charset == "utf-8";
if ($hasUTF8) {
$text = preg_replace("#(\\s+)#u", " ", $text);
} else {
$text = preg_replace("#(\\s+)#", " ", $text);
}
return true;
} else {
$ini = eZINI::instance('transform.ini');
$commands = $ini->variable('Extensions', 'Commands');
if (isset($commands[$command['command']])) {
list($path, $className) = explode(':', $commands[$command['command']], 2);
if (file_exists($path)) {
include_once $path;
$text = call_user_func_array(array($className, 'executeCommand'), array($text, $command['command'], $charsetName));
return true;
} else {
eZDebug::writeError("Could not locate include file '{$path}' for transformation '" . $command['command'] . "'");
}
}
}
}
}
}
}
return false;
}