本文整理汇总了PHP中CComponentUtil::GetComponentsTree方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentUtil::GetComponentsTree方法的具体用法?PHP CComponentUtil::GetComponentsTree怎么用?PHP CComponentUtil::GetComponentsTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentUtil
的用法示例。
在下文中一共展示了CComponentUtil::GetComponentsTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleComp2Tree
function handleComp2Tree()
{
$allowed_components = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
// Name filter exists
if (strlen($allowed_components) > 0) {
$arAC = explode("\n", $allowed_components);
$arAC = array_unique($arAC);
$arAllowedComponents = array();
foreach ($arAC as $f) {
$f = preg_replace("/\\s/is", "", $f);
$f = preg_replace("/\\./is", "\\.", $f);
$f = preg_replace("/\\*/is", ".*", $f);
$arAllowedComponents[] = '/^' . $f . '$/';
}
$components_namespace = 'bitrix';
$mask = substr(md5($allowed_components), 2, 6);
} else {
$arAllowedComponents = false;
$components_namespace = false;
$mask = 0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
global $CACHE_MANAGER;
$cache = array();
$arTree = false;
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : LANGUAGE_ID;
$cache_name = 'fileman_component_tree_array_' . $lang;
if (isset($_GET['clear_comp2_cache']) && $_GET['clear_comp2_cache'] == 'Y') {
$CACHE_MANAGER->CleanDir("fileman_component_tree_array");
}
$ttl = 10 * 24 * 60 * 60;
// Time of life
if ($CACHE_MANAGER->Read($ttl, $cache_name, "fileman_component_tree_array")) {
$cache = $CACHE_MANAGER->Get($cache_name);
if (isset($cache[$mask])) {
$arTree = $cache[$mask];
}
}
if ($arTree === false) {
$arTree = $cache[$mask] = CComponentUtil::GetComponentsTree($components_namespace, $arAllowedComponents);
$CACHE_MANAGER->Set($cache_name, $cache);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
if (isset($arTree['#'])) {
handleChildren($arTree['#'], '');
}
}
示例2: GetComponents
public static function GetComponents($Params, $bClearCache = false)
{
global $CACHE_MANAGER;
$allowed = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
$mask = $allowed === '' ? 0 : substr(md5($allowed), 0, 10);
$lang = isset($Params['lang']) ? $Params['lang'] : LANGUAGE_ID;
$cache_name = 'component_tree_array_'.$lang.'_'.$mask;
$table_id = "fileman_component_tree";
if ($bClearCache)
{
$CACHE_MANAGER->CleanDir($table_id);
}
if($CACHE_MANAGER->Read(self::CACHE_TIME, $cache_name, $table_id))
{
self::$arComponents = $CACHE_MANAGER->Get($cache_name);
}
if (empty(self::$arComponents))
{
// Name filter exists
if ($allowed !== '')
{
$arAC = explode("\n", $allowed);
$arAC = array_unique($arAC);
$arAllowed = Array();
foreach ($arAC as $f)
{
$f = preg_replace("/\s/is", "", $f);
$f = preg_replace("/\./is", "\\.", $f);
$f = preg_replace("/\*/is", ".*", $f);
$arAllowed[] = '/^'.$f.'$/';
}
$namespace = 'bitrix';
}
else
{
$arAllowed = false;
$namespace = false;
}
$arTree = CComponentUtil::GetComponentsTree($namespace, $arAllowed);
self::$arComponents = array(
'items' => array(),
'groups' => array()
);
self::$thirdLevelId = 0;
if (isset($arTree['#']))
{
self::_HandleComponentElement($arTree['#'], '');
}
$CACHE_MANAGER->Set($cache_name, self::$arComponents);
}
return self::$arComponents;
}
示例3: GetComponents
public static function GetComponents($Params, $bClearCache = false)
{
$allowed = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
$mask = $allowed === '' ? 0 : substr(md5($allowed), 0, 10);
if (empty(self::$arComponents))
{
// Name filter exists
if ($allowed !== '')
{
$arAC = explode("\n", $allowed);
$arAC = array_unique($arAC);
$arAllowed = Array();
foreach ($arAC as $f)
{
$f = preg_replace("/\s/is", "", $f);
$f = preg_replace("/\./is", "\\.", $f);
$f = preg_replace("/\*/is", ".*", $f);
$arAllowed[] = '/^'.$f.'$/';
}
$namespace = 'freetrix';
}
else
{
$arAllowed = false;
$namespace = false;
}
$arTree = CComponentUtil::GetComponentsTree($namespace, $arAllowed);
self::$arComponents = array(
'items' => array(),
'groups' => array()
);
self::$thirdLevelId = 0;
if (isset($arTree['#']))
{
self::_HandleComponentElement($arTree['#'], '');
}
}
return self::$arComponents;
}