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


PHP JUDirectoryHelper::getCategoryPath方法代码示例

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


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

示例1: getCatPluginParamRecursive

 public static function getCatPluginParamRecursive($pluginName, $catId, $param, $default = '', $inheritParam = '', $globalParam = '', $inherit = '-1', $global = '-2')
 {
     $inheritParam = $inheritParam ? $inheritParam : $param;
     $globalParam = $globalParam ? $globalParam : $param;
     $path = JUDirectoryHelper::getCategoryPath($catId);
     $rootCat = $path[0];
     $plugin = JPluginHelper::getPlugin('judirectory', $pluginName);
     $pluginParamsStr = isset($plugin->params) ? $plugin->params : '{}';
     $pluginParams = new JRegistry($pluginParamsStr);
     $pathCatToRoot = array_reverse($path);
     foreach ($pathCatToRoot as $category) {
         $plugin_params = $category->plugin_params;
         if ($plugin_params) {
             $plugins = new JRegistry($plugin_params);
             $pluginObject = $plugins->get($pluginName, "");
             $pluginRegistry = new JRegistry($pluginObject);
             if ($pluginRegistry->get($inheritParam, '') !== $inherit) {
                 if ($pluginRegistry->get($globalParam, '') === $global) {
                     return $pluginParams->get($param, $default);
                 } else {
                     return $pluginRegistry->get($param, $default);
                 }
             } else {
                 if ($category->parent_id == $rootCat->id) {
                     return $pluginParams->get($param, $default);
                 } else {
                     continue;
                 }
             }
         } else {
             return $default;
         }
     }
     return $default;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:35,代码来源:pluginparams.php

示例2: canDoCategory

 public static function canDoCategory($categoryId, $checkAccess = false, &$error = array())
 {
     if (!$categoryId) {
         return false;
     }
     $storeId = md5(__METHOD__ . "::{$categoryId}::" . (int) $checkAccess);
     $storeId_AccessibleCategoryIds = md5(__CLASS__ . '::AccessibleCategoryIds');
     if (isset(self::$cache[$storeId_AccessibleCategoryIds])) {
         $categoryIdArrayCanAccess = self::$cache[$storeId_AccessibleCategoryIds];
         if (!empty($categoryIdArrayCanAccess) && in_array($categoryId, $categoryIdArrayCanAccess)) {
             self::$cache[$storeId] = true;
             return self::$cache[$storeId];
         } else {
             self::$cache[$storeId] = false;
             return self::$cache[$storeId];
         }
     }
     if (!isset(self::$cache[$storeId])) {
         if (!$categoryId) {
             self::$cache[$storeId] = false;
             return self::$cache[$storeId];
         }
         $path = JUDirectoryHelper::getCategoryPath($categoryId);
         if (!$path) {
             self::$cache[$storeId] = false;
             return self::$cache[$storeId];
         }
         $user = JFactory::getUser();
         $levels = $user->getAuthorisedViewLevels();
         $nowDate = JFactory::getDate()->toSql();
         foreach ($path as $category) {
             if ($category->published != 1) {
                 $error = array("code" => 404, "message" => JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
                 self::$cache[$storeId] = false;
                 return self::$cache[$storeId];
             }
             if ($category->publish_up > $nowDate || intval($category->publish_down) > 0 && $category->publish_down < $nowDate) {
                 $error = array("code" => 404, "message" => JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
                 self::$cache[$storeId] = false;
                 return self::$cache[$storeId];
             }
             if ($checkAccess && !in_array($category->access, $levels)) {
                 $error = array("code" => 403, "message" => JText::_('JERROR_ALERTNOAUTHOR'));
                 self::$cache[$storeId] = false;
                 return self::$cache[$storeId];
             }
         }
         self::$cache[$storeId] = true;
     }
     return self::$cache[$storeId];
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:51,代码来源:permission.php

示例3: getBreadcrumbCategory

 public static function getBreadcrumbCategory($categoryId)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $categoryPath = JUDirectoryHelper::getCategoryPath($categoryId);
     $pathwayArray = array();
     if (!empty($categoryPath)) {
         if (!isset($categoryPath[1])) {
             $findMenuTreeLevel1 = false;
         } else {
             $topCategoryLevelId = $categoryPath[1]->id;
             $needles = array('tree' => array((int) $topCategoryLevelId));
             $findMenuTreeLevel1 = JUDirectoryHelperRoute::findItemId($needles, true);
         }
         if (!$findMenuTreeLevel1) {
             $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::getRootPathway();
             array_shift($categoryPath);
         } else {
             $menuTreeLevel1 = $menus->getItem($findMenuTreeLevel1);
             $pathwayItem = new stdClass();
             $pathwayItem->name = html_entity_decode($menuTreeLevel1->title, ENT_COMPAT, 'UTF-8');
             $pathwayItem->link = JRoute::_($menuTreeLevel1->link);
             $pathwayArray[] = $pathwayItem;
             array_shift($categoryPath);
             array_shift($categoryPath);
         }
         if (!empty($categoryPath)) {
             foreach ($categoryPath as $categoryPathItem) {
                 $pathwayItem = new stdClass();
                 $pathwayItem->name = html_entity_decode($categoryPathItem->title, ENT_COMPAT, 'UTF-8');
                 $pathwayItem->link = JUDirectoryHelperRoute::getCategoryRoute($categoryPathItem->id, $topCategoryLevelId);
                 $pathwayArray[] = $pathwayItem;
             }
         }
     }
     return $pathwayArray;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:37,代码来源:breadcrumb.php

示例4: getTemplateStyleOfCategory

 public static function getTemplateStyleOfCategory($categoryId)
 {
     $categoryPath = JUDirectoryHelper::getCategoryPath($categoryId);
     $categoryPathReverse = array_reverse($categoryPath);
     foreach ($categoryPathReverse as $categoryObject) {
         if ($categoryObject->style_id == -2) {
             $templateStyleObject = self::getDefaultTemplateStyle();
             return $templateStyleObject;
         } elseif ($categoryObject->style_id == -1) {
             if ($categoryObject->parent_id == 0) {
                 $templateStyleObject = self::getDefaultTemplateStyle();
                 return $templateStyleObject;
             } else {
                 continue;
             }
         } else {
             $templateStyleObject = self::getTemplateStyleObject($categoryObject->style_id);
             if (is_object($templateStyleObject)) {
                 return $templateStyleObject;
             }
         }
     }
     $templateStyleObject = self::getDefaultTemplateStyle();
     return $templateStyleObject;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:template.php

示例5: getListingLayoutFromCategory

 public static function getListingLayoutFromCategory($categoryId)
 {
     $path = JUDirectoryHelper::getCategoryPath($categoryId);
     $pathCatToRoot = array_reverse($path);
     foreach ($pathCatToRoot as $category) {
         if ($category->layout_listing == -2) {
             $params = JUDirectoryHelper::getParams($categoryId);
             $layout = $params->get('layout_listing', '_:default');
             return $layout;
         } elseif ($category->layout_listing == -1) {
             if ($category->parent_id == 0) {
                 $params = JUDirectoryHelper::getParams($categoryId);
                 $layout = $params->get('layout_listing', '_:default');
                 return $layout;
             } else {
                 continue;
             }
         } else {
             $layout = trim($category->layout_listing);
             return $layout;
         }
     }
     return '_:default';
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:24,代码来源:listing.php

示例6: getCategorySegment

 public static function getCategorySegment($categoryId, &$query, $fullPath = 0)
 {
     if (isset($query['Itemid'])) {
         unset($query['Itemid']);
     }
     $segments = array();
     $params = JUDirectoryHelper::getParams();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryObject = JUDirectoryHelper::getCategoryById($categoryId);
     if (!is_object($categoryObject)) {
         return false;
     }
     if ($categoryObject->level == 0) {
         $itemIdTreeRoot = JUDirectoryHelperRoute::getMenuItemIdOfViewCategoryTreeRoot();
         if ($itemIdTreeRoot > 0) {
             $query['Itemid'] = $itemIdTreeRoot;
             return $segments;
         }
         $query['Itemid'] = JUDirectoryHelperRoute::getHomeMenuItemId();
         $sefRootCategory = $rootCategory->id . ':' . $params->get('sef_root_cat', 'root');
         $segments[] = JApplication::stringURLSafe($sefRootCategory);
         return $segments;
     } elseif ($categoryObject->level == 1) {
         $menuItemIdsOfViewCategoryTreeLevel1 = JUDirectoryHelperRoute::getMenuItemIdArrayOfViewCategoryTreeLevel1();
         if (isset($menuItemIdsOfViewCategoryTreeLevel1[$categoryObject->id])) {
             $query['Itemid'] = $menuItemIdsOfViewCategoryTreeLevel1[$categoryObject->id];
             return $segments;
         }
         $itemIdTreeRoot = JUDirectoryHelperRoute::getMenuItemIdOfViewCategoryTreeRoot();
         if ($itemIdTreeRoot > 0) {
             $query['Itemid'] = $itemIdTreeRoot;
             $segments[] = $categoryObject->id . ":" . $categoryObject->alias;
             return $segments;
         }
         $query['Itemid'] = JUDirectoryHelperRoute::getHomeMenuItemId();
         $sefRootCategory = $params->get('sef_root_cat', 'root');
         $segments[] = JApplication::stringURLSafe($sefRootCategory);
         $segments[] = $categoryObject->id . ":" . $categoryObject->alias;
         return $segments;
     } else {
         $levelCats = JUDirectoryHelper::getCatsByLevel(1, $categoryObject->id);
         if (is_array($levelCats) && count($levelCats)) {
             $categoryIdAncestorLevel1 = $levelCats[0]->id;
         }
         $menuItemIdsOfViewCategoryTreeLevel1 = JUDirectoryHelperRoute::getMenuItemIdArrayOfViewCategoryTreeLevel1();
         if (isset($menuItemIdsOfViewCategoryTreeLevel1[$categoryIdAncestorLevel1])) {
             $query['Itemid'] = $menuItemIdsOfViewCategoryTreeLevel1[$categoryIdAncestorLevel1];
             if ($fullPath) {
                 $categoryPath = JUDirectoryHelper::getCategoryPath($categoryId);
                 if (is_array($categoryPath) && count($categoryPath)) {
                     foreach ($categoryPath as $categoryPathValue) {
                         if ($categoryPathValue->level > 1 && $categoryPathValue->id != $categoryObject->id) {
                             $segments[] = $categoryPathValue->alias;
                         }
                     }
                 }
             }
             $segments[] = $categoryObject->id . ":" . $categoryObject->alias;
             return $segments;
         }
         $itemIdTreeRoot = JUDirectoryHelperRoute::getMenuItemIdOfViewCategoryTreeRoot();
         if ($itemIdTreeRoot > 0) {
             $query['Itemid'] = $itemIdTreeRoot;
             if ($fullPath) {
                 $categoryPath = JUDirectoryHelper::getCategoryPath($categoryId);
                 if (is_array($categoryPath) && count($categoryPath)) {
                     foreach ($categoryPath as $categoryPathValue) {
                         if ($categoryPathValue->level > 0 && $categoryPathValue->id != $categoryObject->id) {
                             $segments[] = $categoryPathValue->alias;
                         }
                     }
                 }
             }
             $segments[] = $categoryObject->id . ":" . $categoryObject->alias;
             return $segments;
         }
         $query['Itemid'] = JUDirectoryHelperRoute::getHomeMenuItemId();
         if ($fullPath) {
             $sefRootCategory = $params->get('sef_root_cat', 'root');
             $segments[] = JApplication::stringURLSafe($sefRootCategory);
             $categoryPath = JUDirectoryHelper::getCategoryPath($categoryId);
             if (is_array($categoryPath) && count($categoryPath)) {
                 foreach ($categoryPath as $categoryPathValue) {
                     if ($categoryPathValue->level > 0 && $categoryPathValue->id != $categoryObject->id) {
                         $segments[] = $categoryPathValue->alias;
                     }
                 }
             }
         }
         $segments[] = $categoryObject->id . ":" . $categoryObject->alias;
         return $segments;
     }
     return $segments;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:94,代码来源:route.php


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