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


PHP rex_article::getRootArticles方法代码示例

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


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

示例1: getList

 public function getList($category_id)
 {
     $isRoot = $category_id === 0;
     $mountpoints = rex::getUser()->getComplexPerm('structure')->getMountpoints();
     if ($isRoot && count($mountpoints) == 0) {
         $articles = rex_article::getRootArticles();
     } else {
         $articles = rex_category::get($category_id)->getArticles();
     }
     return self::renderList($articles, $category_id);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:11,代码来源:renderer.php

示例2: generatePathFile

 public static function generatePathFile($params)
 {
     $setDomain = function (rex_yrewrite_domain &$domain, &$path, rex_structure_element $element) {
         $id = $element->getId();
         $clang = $element->getClang();
         if (isset(rex_yrewrite::$domainsByMountId[$id][$clang])) {
             $domain = rex_yrewrite::$domainsByMountId[$id][$clang];
             $path = rex_yrewrite::$scheme->getClang($clang, $domain);
         }
     };
     $setPath = function (rex_yrewrite_domain $domain, $path, rex_article $art) use($setDomain) {
         $setDomain($domain, $path, $art);
         if (($redirection = rex_yrewrite::$scheme->getRedirection($art, $domain)) instanceof rex_structure_element) {
             rex_yrewrite::$paths['redirections'][$art->getId()][$art->getClang()] = ['id' => $redirection->getId(), 'clang' => $redirection->getClang()];
             unset(rex_yrewrite::$paths['paths'][$domain->getName()][$art->getId()][$art->getClang()]);
             return;
         }
         unset(rex_yrewrite::$paths['redirections'][$art->getId()][$art->getClang()]);
         $url = rex_yrewrite::$scheme->getCustomUrl($art, $domain);
         if (!is_string($url)) {
             $url = rex_yrewrite::$scheme->appendArticle($path, $art, $domain);
         }
         rex_yrewrite::$paths['paths'][$domain->getName()][$art->getId()][$art->getClang()] = ltrim($url, '/');
     };
     $generatePaths = function (rex_yrewrite_domain $domain, $path, rex_category $cat) use(&$generatePaths, $setDomain, $setPath) {
         $path = rex_yrewrite::$scheme->appendCategory($path, $cat, $domain);
         $setDomain($domain, $path, $cat);
         foreach ($cat->getChildren() as $child) {
             $generatePaths($domain, $path, $child);
         }
         foreach ($cat->getArticles() as $art) {
             $setPath($domain, $path, $art);
         }
     };
     $ep = isset($params['extension_point']) ? $params['extension_point'] : '';
     switch ($ep) {
         // clang and id specific update
         case 'CAT_DELETED':
         case 'ART_DELETED':
             foreach (self::$paths['paths'] as $domain => $c) {
                 unset(self::$paths['paths'][$domain][$params['id']]);
             }
             unset(self::$paths['redirections'][$params['id']]);
             if (0 == $params['re_id']) {
                 break;
             }
             $params['id'] = $params['re_id'];
             // no break
         // no break
         case 'CAT_ADDED':
         case 'CAT_UPDATED':
         case 'CAT_STATUS':
         case 'ART_ADDED':
         case 'ART_UPDATED':
         case 'ART_STATUS':
             rex_article_cache::delete($params['id']);
             $domain = self::$domainsByMountId[0][$params['clang']];
             $path = self::$scheme->getClang($params['clang'], $domain);
             $art = rex_article::get($params['id'], $params['clang']);
             $tree = $art->getParentTree();
             if ($art->isStartArticle()) {
                 $cat = array_pop($tree);
             }
             foreach ($tree as $parent) {
                 $path = self::$scheme->appendCategory($path, $parent, $domain);
                 $setDomain($domain, $path, $parent);
                 $setPath($domain, $path, rex_article::get($parent->getId(), $parent->getClang()));
             }
             if ($art->isStartArticle()) {
                 $generatePaths($domain, $path, $cat);
             } else {
                 $setPath($domain, $path, $art);
             }
             break;
             // update all
         // update all
         case 'CLANG_DELETED':
         case 'CLANG_ADDED':
         case 'CLANG_UPDATED':
             //case 'ALL_GENERATED':
         //case 'ALL_GENERATED':
         default:
             self::$paths = ['paths' => [], 'redirections' => []];
             foreach (rex_clang::getAllIds() as $clangId) {
                 $domain = self::$domainsByMountId[0][$clangId];
                 $path = self::$scheme->getClang($clangId, $domain);
                 foreach (rex_category::getRootCategories(false, $clangId) as $cat) {
                     $generatePaths($domain, $path, $cat);
                 }
                 foreach (rex_article::getRootArticles(false, $clangId) as $art) {
                     $setPath($domain, $path, $art);
                 }
             }
             break;
     }
     rex_file::putCache(self::$pathfile, self::$paths);
 }
开发者ID:tzfrs,项目名称:redaxo_yrewrite,代码行数:97,代码来源:yrewrite.php


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