当前位置: 首页>>代码示例>>PHP>>正文


PHP eZURLAliasML::generateFullSelect方法代码示例

本文整理汇总了PHP中eZURLAliasML::generateFullSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::generateFullSelect方法的具体用法?PHP eZURLAliasML::generateFullSelect怎么用?PHP eZURLAliasML::generateFullSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZURLAliasML的用法示例。


在下文中一共展示了eZURLAliasML::generateFullSelect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchByPath

 public static function fetchByPath($uriString, $glob = false)
 {
     $uriString = eZURLAliasML::cleanURL($uriString);
     $db = eZDB::instance();
     if ($uriString == '' && $glob !== false) {
         $elements = array();
     } else {
         $elements = explode('/', $uriString);
     }
     $len = count($elements);
     $i = 0;
     $selects = array();
     $tables = array();
     $conds = array();
     $prevTable = false;
     foreach ($elements as $element) {
         $table = "e" . $i;
         $langMask = trim(eZContentLanguage::languagesSQLFilter($table, 'lang_mask'));
         if ($glob === false && $i == $len - 1) {
             $selects[] = eZURLAliasML::generateFullSelect($table);
         } else {
             $selects[] = eZURLAliasML::generateSelect($table, $i, $len);
         }
         $tables[] = "ezurlalias_ml " . $table;
         $conds[] = eZURLAliasML::generateCond($table, $prevTable, $i, $langMask, $element);
         $prevTable = $table;
         ++$i;
     }
     if ($glob !== false) {
         ++$len;
         $table = "e" . $i;
         $langMask = trim(eZContentLanguage::languagesSQLFilter($table, 'lang_mask'));
         $selects[] = eZURLAliasML::generateFullSelect($table);
         $tables[] = "ezurlalias_ml " . $table;
         $conds[] = eZURLAliasML::generateGlobCond($table, $prevTable, $i, $langMask, $glob);
         $prevTable = $table;
         ++$i;
     }
     $elementOffset = $i - 1;
     $query = "SELECT DISTINCT " . join(", ", $selects) . " FROM " . join(", ", $tables) . " WHERE " . join(" AND ", $conds);
     $pathRows = $db->arrayQuery($query);
     $elements = array();
     if (count($pathRows) > 0) {
         foreach ($pathRows as $pathRow) {
             $redirectLink = false;
             $table = "e" . $elementOffset;
             $element = array('id' => $pathRow[$table . "_id"], 'parent' => $pathRow[$table . "_parent"], 'lang_mask' => $pathRow[$table . "_lang_mask"], 'text' => $pathRow[$table . "_text"], 'action' => $pathRow[$table . "_action"], 'link' => $pathRow[$table . "_link"]);
             $path = array();
             $lastID = false;
             for ($i = 0; $i < $len; ++$i) {
                 $table = "e" . $i;
                 $id = $pathRow[$table . "_id"];
                 $link = $pathRow[$table . "_link"];
                 $path[] = $pathRow[$table . "_text"];
                 if ($link != $id) {
                     // Mark the redirect link
                     $redirectLink = $link;
                     $redirectOffset = $i;
                 }
                 $lastID = $link;
             }
             if ($redirectLink) {
                 $newLinkID = $redirectLink;
                 // Resolve new links until a real element is found.
                 // TODO: Add max redirection count?
                 while ($newLinkID) {
                     $query = "SELECT id, parent, lang_mask, text, link FROM ezurlalias_ml WHERE id={$newLinkID}";
                     $rows = $db->arrayQuery($query);
                     if (count($rows) == 0) {
                         return false;
                     }
                     $newLinkID = false;
                     if ($rows[0]['id'] != $rows[0]['link']) {
                         $newLinkID = (int) $rows[0]['link'];
                     }
                 }
                 $id = (int) $newLinkID;
                 $path = array();
                 // Fetch path 'text' elements of correct parent path
                 while ($id != 0) {
                     $query = "SELECT parent, lang_mask, text FROM ezurlalias_ml WHERE id={$id}";
                     $rows = $db->arrayQuery($query);
                     if (count($rows) == 0) {
                         break;
                     }
                     $result = eZURLAliasML::choosePrioritizedRow($rows);
                     if (!$result) {
                         $result = $rows[0];
                     }
                     $id = (int) $result['parent'];
                     array_unshift($path, $result['text']);
                 }
                 // Fill in end of path elements
                 for ($i = $redirectOffset; $i < $len; ++$i) {
                     $table = "e" . $i;
                     $path[] = $pathRow[$table . "_text"];
                 }
             }
             $element['path'] = implode('/', $path);
             $elements[] = $element;
//.........这里部分代码省略.........
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:101,代码来源:ezurlaliasml.php


注:本文中的eZURLAliasML::generateFullSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。