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


PHP eZURLAliasML::urlToAction方法代碼示例

本文整理匯總了PHP中eZURLAliasML::urlToAction方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZURLAliasML::urlToAction方法的具體用法?PHP eZURLAliasML::urlToAction怎麽用?PHP eZURLAliasML::urlToAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZURLAliasML的用法示例。


在下文中一共展示了eZURLAliasML::urlToAction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testURLToAction

 public function testURLToAction()
 {
     $url1 = "content/view/full/123";
     $url2 = "user/register";
     $invalidUrl1 = "/content/view/full/123";
     $invalidUrl2 = "unknown/module";
     // Test valid urls
     self::assertEquals("eznode:123", eZURLAliasML::urlToAction($url1));
     self::assertEquals("module:user/register", eZURLAliasML::urlToAction($url2));
     // Test invalid urls
     self::assertEquals(false, eZURLAliasML::urlToAction($invalidUrl1));
     self::assertEquals(false, eZURLAliasML::urlToAction($invalidUrl2));
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:13,代碼來源:urlaliasml_test.php

示例2: reverseTranslate

 public static function reverseTranslate(&$uri, $uriString, $internalURIString)
 {
     $db = eZDB::instance();
     $action = eZURLAliasML::urlToAction($internalURIString);
     if ($action !== false) {
         $langMask = trim(eZContentLanguage::languagesSQLFilter('ezurlalias_ml', 'lang_mask'));
         $actionStr = $db->escapeString($action);
         $query = "SELECT id, parent, lang_mask, text, action FROM ezurlalias_ml WHERE ({$langMask}) AND action='{$actionStr}' AND is_original = 1 AND is_alias = 0";
         $rows = $db->arrayQuery($query);
         $path = array();
         $count = count($rows);
         if ($count != 0) {
             $row = eZURLAliasML::choosePrioritizedRow($rows);
             if ($row === false) {
                 $row = $rows[0];
             }
             $paren = (int) $row['parent'];
             $path[] = $row['text'];
             // We have the parent so now do an iterative lookup until we have the top element
             while ($paren != 0) {
                 $query = "SELECT id, parent, lang_mask, text FROM ezurlalias_ml WHERE ({$langMask}) AND id={$paren} AND is_original = 1 AND is_alias = 0";
                 $rows = $db->arrayQuery($query);
                 $count = count($rows);
                 if ($count != 0) {
                     $row = eZURLAliasML::choosePrioritizedRow($rows);
                     if ($row === false) {
                         $row = $rows[0];
                     }
                     $paren = (int) $row['parent'];
                     array_unshift($path, $row['text']);
                 } else {
                     eZDebug::writeError("Lookup of parent ID {$paren} failed, cannot perform reverse lookup of alias.");
                     return false;
                 }
             }
             $uriString = join('/', $path);
             if ($uri instanceof eZURI) {
                 $uri->setURIString($uriString, false);
             } else {
                 $uri = $uriString;
             }
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
開發者ID:patrickallaert,項目名稱:ezpublish-legacy-php7,代碼行數:48,代碼來源:ezurlaliasml.php

示例3:

     $infoData['language'] = $languageCode;
 } else {
     if (strlen($aliasText) == 0) {
         $infoCode = "error-no-alias-text";
     } else {
         if (strlen(trim($aliasDestinationTextUnmodified)) == 0) {
             $infoCode = "error-no-alias-destination-text";
         } else {
             $parentID = 0;
             // Start from the top
             $linkID = 0;
             $mask = $language->attribute('id');
             if ($isAlwaysAvailable) {
                 $mask |= 1;
             }
             $action = eZURLAliasML::urlToAction($aliasDestinationText);
             if (!$action) {
                 $elements = eZURLAliasML::fetchByPath($aliasDestinationText);
                 if (count($elements) > 0) {
                     $action = $elements[0]->attribute('action');
                     $linkID = $elements[0]->attribute('link');
                 }
             }
             if (!$action) {
                 $infoCode = "error-action-invalid";
                 $infoData['aliasText'] = $aliasDestinationText;
             } else {
                 $origAliasText = $aliasText;
                 if ($linkID == 0) {
                     $linkID = true;
                 }
開發者ID:nfrp,項目名稱:ezpublish,代碼行數:31,代碼來源:urlalias_global.php


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