本文整理汇总了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;
}