当前位置: 首页>>代码示例>>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;未经允许,请勿转载。