本文整理汇总了PHP中JUDownloadHelper::getCategoryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getCategoryPath方法的具体用法?PHP JUDownloadHelper::getCategoryPath怎么用?PHP JUDownloadHelper::getCategoryPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::getCategoryPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategorySegment
public static function getCategorySegment($categoryId, &$query, $fullPath = 0)
{
if (isset($query['Itemid']))
{
unset($query['Itemid']);
}
$segments = array();
$params = JUDownloadHelper::getParams();
$rootCategory = JUDownloadFrontHelperCategory::getRootCategory();
$categoryObject = JUDownloadHelper::getCategoryById($categoryId);
if (!is_object($categoryObject))
{
return false;
}
if ($categoryObject->level == 0)
{
$itemIdTreeRoot = JUDownloadHelperRoute::getMenuItemIdOfViewCategoryTreeRoot();
if ($itemIdTreeRoot > 0)
{
$query['Itemid'] = $itemIdTreeRoot;
return $segments;
}
$query['Itemid'] = JUDownloadHelperRoute::getHomeMenuItemId();
$sefRootCategory = $rootCategory->id . ':' . $params->get('sef_root_cat', 'root');
$segments[] = JApplication::stringURLSafe($sefRootCategory);
return $segments;
}
elseif ($categoryObject->level == 1)
{
$menuItemIdsOfViewCategoryTreeLevel1 = JUDownloadHelperRoute::getMenuItemIdArrayOfViewCategoryTreeLevel1();
if (isset($menuItemIdsOfViewCategoryTreeLevel1[$categoryObject->id]))
{
$query['Itemid'] = $menuItemIdsOfViewCategoryTreeLevel1[$categoryObject->id];
return $segments;
}
$itemIdTreeRoot = JUDownloadHelperRoute::getMenuItemIdOfViewCategoryTreeRoot();
if ($itemIdTreeRoot > 0)
{
$query['Itemid'] = $itemIdTreeRoot;
$segments[] = $categoryObject->id . ":" . $categoryObject->alias;
return $segments;
}
$query['Itemid'] = JUDownloadHelperRoute::getHomeMenuItemId();
$sefRootCategory = $params->get('sef_root_cat', 'root');
$segments[] = JApplication::stringURLSafe($sefRootCategory);
$segments[] = $categoryObject->id . ":" . $categoryObject->alias;
return $segments;
}
else
{
$levelCats = JUDownloadHelper::getCatsByLevel(1, $categoryObject->id);
if (is_array($levelCats) && count($levelCats))
{
$categoryIdAncestorLevel1 = $levelCats[0]->id;
}
$menuItemIdsOfViewCategoryTreeLevel1 = JUDownloadHelperRoute::getMenuItemIdArrayOfViewCategoryTreeLevel1();
if (isset($menuItemIdsOfViewCategoryTreeLevel1[$categoryIdAncestorLevel1]))
{
$query['Itemid'] = $menuItemIdsOfViewCategoryTreeLevel1[$categoryIdAncestorLevel1];
if ($fullPath)
{
$categoryPath = JUDownloadHelper::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;
}
//.........这里部分代码省略.........
示例2: getBreadcrumbCategory
public static function getBreadcrumbCategory($categoryId)
{
$app = JFactory::getApplication();
$menus = $app->getMenu('site');
$categoryPath = JUDownloadHelper::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 = JUDownloadHelperRoute::findItemId($needles, true);
}
if (!$findMenuTreeLevel1)
{
$pathwayArray[] = JUDownloadFrontHelperBreadcrumb::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 = JUDownloadHelperRoute::getCategoryRoute($categoryPathItem->id, $topCategoryLevelId);
$pathwayArray[] = $pathwayItem;
}
}
}
return $pathwayArray;
}
示例3: getCatPluginParamRecursive
public static function getCatPluginParamRecursive($pluginName, $catId, $param, $default = '', $inheritParam = '', $globalParam = '', $inherit = '-1', $global = '-2')
{
$inheritParam = $inheritParam ? $inheritParam : $param;
$globalParam = $globalParam ? $globalParam : $param;
$path = JUDownloadHelper::getCategoryPath($catId);
$rootCat = $path[0];
$plugin = JPluginHelper::getPlugin('judownload', $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;
}
示例4: getDocumentLayoutFromCategory
public static function getDocumentLayoutFromCategory($categoryId)
{
$path = JUDownloadHelper::getCategoryPath($categoryId);
$pathCatToRoot = array_reverse($path);
foreach ($pathCatToRoot AS $category)
{
if ($category->layout_document == -2)
{
$params = JUDownloadHelper::getParams($categoryId);
$layout = $params->get('layout_document', '_:default');
return $layout;
}
elseif ($category->layout_document == -1)
{
if ($category->parent_id == 0)
{
$params = JUDownloadHelper::getParams($categoryId);
$layout = $params->get('layout_document', '_:default');
return $layout;
}
else
{
continue;
}
}
else
{
$layout = trim($category->layout_document);
return $layout;
}
}
return '_:default';
}
示例5: 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 = JUDownloadHelper::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];
}
示例6: getTemplateStyleOfCategory
public static function getTemplateStyleOfCategory($categoryId)
{
$categoryPath = JUDownloadHelper::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;
}