當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZURLAliasML::sanitizeURL方法代碼示例

本文整理匯總了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];
開發者ID:legende91,項目名稱:ez,代碼行數:31,代碼來源:updateniceurls.php

示例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));
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:16,代碼來源:urlaliasml_test.php

示例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];
開發者ID:nlenardou,項目名稱:ezpublish,代碼行數:31,代碼來源:updateniceurls.php


注:本文中的eZURLAliasML::sanitizeURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。