本文整理汇总了PHP中eZURLAliasML::sanitizeURL方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::sanitizeURL方法的具体用法?PHP eZURLAliasML::sanitizeURL怎么用?PHP eZURLAliasML::sanitizeURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::sanitizeURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
while (true) {
// Validate the wildcards
if (!preg_match("#^(.*)\\*\$#", $sourceWildcard, $matches)) {
logError("Invalid source wildcard '{$sourceWildcard}', item is skipped, URL entry ID is " . $row['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$fromPath = $matches[1];
$fromPath = eZURLAliasML::sanitizeURL($fromPath);
if (!preg_match("#^(.*)\\{1\\}\$#", $destinationWildcard, $matches)) {
logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $row['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$toPath = $matches[1];
$toPath = eZURLAliasML::sanitizeURL($toPath);
$newWildcard = $toPath . '/*';
$newWildcardSQL = $db->escapeString($newWildcard);
$query = "SELECT * FROM ezurlalias WHERE source_url = '{$newWildcardSQL}' AND is_wildcard=1";
$rowsw = $db->arrayQuery($query);
if (count($rowsw) == 0) {
// The redirection has stopped, we can use the destination
break;
}
$newSourceWildcard = $rowsw[0]['destination_url'];
if (!preg_match("#^(.*)\\{1\\}\$#", $newSourceWildcard, $matches)) {
logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $rowsw[0]['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$newSourceWildcard = $matches[1];
示例2: testSanitizeURL
public function testSanitizeURL()
{
$url1 = "/content/view/full/2";
$url2 = "/////content/view/full/2/";
$url3 = "/content/view/full/2///";
$url4 = "///content/view/full/2///";
$url5 = "///content///view////full//2///";
self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url1));
self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url2));
self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url3));
self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url4));
self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url5));
// Make sure funky characters doesn't get messed up
$invalidUrl = "//ウ//ー//ラ//";
self::assertEquals("ウ/ー/ラ", eZURLAliasML::sanitizeURL($invalidUrl));
}
示例3: while
while (true) {
// Validate the wildcards
if (!preg_match("#^(.*)\\*\$#", $sourceWildcard, $matches)) {
logError("Invalid source wildcard '{$sourceWildcard}', item is skipped, URL entry ID is " . $row['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$fromPath = $matches[1];
$fromPath = eZURLAliasML::sanitizeURL($fromPath, true);
if (!preg_match("#^(.*)\\{1\\}\$#", $destinationWildcard, $matches)) {
logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $row['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$toPath = $matches[1];
$toPath = eZURLAliasML::sanitizeURL($toPath, true);
$newWildcard = $toPath . '/*';
$newWildcardSQL = $db->escapeString($newWildcard);
$query = "SELECT * FROM ezurlalias WHERE source_url = '{$newWildcardSQL}' AND is_wildcard=1";
$rowsw = $db->arrayQuery($query);
if (count($rowsw) == 0) {
// The redirection has stopped, we can use the destination
break;
}
$newSourceWildcard = $rowsw[0]['destination_url'];
if (!preg_match("#^(.*)\\{1\\}\$#", $newSourceWildcard, $matches)) {
logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $rowsw[0]['id']);
list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
continue 2;
}
$newSourceWildcard = $matches[1];