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


PHP CComponentUtil::__BuildTree方法代码示例

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


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

示例1: __GetComponentsTree

 public static function __GetComponentsTree($filterNamespace = false, $arNameFilter = false)
 {
     $arTree = array();
     $io = CBXVirtualIo::GetInstance();
     $folders = array("/local/components", "/bitrix/components");
     foreach ($folders as $componentFolder) {
         if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"] . $componentFolder)) {
             while (($file = readdir($handle)) !== false) {
                 if ($file == "." || $file == "..") {
                     continue;
                 }
                 if (is_dir($_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file)) {
                     if (CComponentUtil::isComponent($componentFolder . "/" . $file)) {
                         // It's component
                         if ($filterNamespace !== false && strlen($filterNamespace) > 0) {
                             continue;
                         }
                         if ($arNameFilter !== false && !CComponentUtil::CheckComponentName($file, $arNameFilter)) {
                             continue;
                         }
                         if (file_exists($_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file . "/.description.php")) {
                             CComponentUtil::__IncludeLang($componentFolder . "/" . $file, ".description.php");
                             $arComponentDescription = array();
                             include $_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file . "/.description.php";
                             if (array_key_exists("PATH", $arComponentDescription) && array_key_exists("ID", $arComponentDescription["PATH"])) {
                                 $arComponent = array();
                                 $arComponent["NAME"] = $file;
                                 $arComponent["NAMESPACE"] = "";
                                 $arComponent["TITLE"] = trim($arComponentDescription["NAME"]);
                                 $arComponent["DESCRIPTION"] = $arComponentDescription["DESCRIPTION"];
                                 if (array_key_exists("ICON", $arComponentDescription)) {
                                     $arComponentDescription["ICON"] = ltrim($arComponentDescription["ICON"], "/");
                                     if ($arComponentDescription["ICON"] != "" && $io->FileExists($io->RelativeToAbsolutePath($componentFolder . "/" . $file . "/" . $arComponentDescription["ICON"]))) {
                                         $arComponent["ICON"] = $componentFolder . "/" . $file . "/" . $arComponentDescription["ICON"];
                                     } else {
                                         $arComponent["ICON"] = "/bitrix/images/fileman/htmledit2/component.gif";
                                     }
                                 }
                                 if (array_key_exists("COMPLEX", $arComponentDescription) && $arComponentDescription["COMPLEX"] == "Y") {
                                     $arComponent["COMPLEX"] = "Y";
                                 } else {
                                     $arComponent["COMPLEX"] = "N";
                                 }
                                 $arComponent["SORT"] = IntVal($arComponentDescription["SORT"]);
                                 if ($arComponent["SORT"] <= 0) {
                                     $arComponent["SORT"] = 100;
                                 }
                                 $arComponent["SCREENSHOT"] = array();
                                 if (array_key_exists("SCREENSHOT", $arComponentDescription)) {
                                     if (!is_array($arComponentDescription["SCREENSHOT"])) {
                                         $arComponentDescription["SCREENSHOT"] = array($arComponentDescription["SCREENSHOT"]);
                                     }
                                     for ($i = 0, $cnt = count($arComponentDescription["SCREENSHOT"]); $i < $cnt; $i++) {
                                         $arComponent["SCREENSHOT"][] = $componentFolder . "/" . $file . $arComponentDescription["SCREENSHOT"][$i];
                                     }
                                 }
                                 CComponentUtil::__BuildTree($arComponentDescription["PATH"], $arTree, $arComponent);
                             }
                         }
                     } else {
                         // It's not a component
                         if ($filterNamespace !== false && (strlen($filterNamespace) <= 0 || $filterNamespace != $file)) {
                             continue;
                         }
                         if ($handle1 = @opendir($_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file)) {
                             while (($file1 = readdir($handle1)) !== false) {
                                 if ($file1 == "." || $file1 == "..") {
                                     continue;
                                 }
                                 if (is_dir($_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file . "/" . $file1)) {
                                     if (CComponentUtil::isComponent($componentFolder . "/" . $file . "/" . $file1)) {
                                         if ($arNameFilter !== false && !CComponentUtil::CheckComponentName($file1, $arNameFilter)) {
                                             continue;
                                         }
                                         // It's component
                                         if (file_exists($_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file . "/" . $file1 . "/.description.php")) {
                                             CComponentUtil::__IncludeLang($componentFolder . "/" . $file . "/" . $file1, ".description.php");
                                             $arComponentDescription = array();
                                             include $_SERVER["DOCUMENT_ROOT"] . $componentFolder . "/" . $file . "/" . $file1 . "/.description.php";
                                             if (array_key_exists("PATH", $arComponentDescription) && array_key_exists("ID", $arComponentDescription["PATH"])) {
                                                 $arComponent = array();
                                                 $arComponent["NAME"] = $file . ":" . $file1;
                                                 $arComponent["NAMESPACE"] = $file;
                                                 $arComponent["TITLE"] = trim($arComponentDescription["NAME"]);
                                                 $arComponent["DESCRIPTION"] = $arComponentDescription["DESCRIPTION"];
                                                 if (array_key_exists("ICON", $arComponentDescription)) {
                                                     $arComponentDescription["ICON"] = ltrim($arComponentDescription["ICON"], "/");
                                                     if ($arComponentDescription["ICON"] != "" && $io->FileExists($io->RelativeToAbsolutePath($componentFolder . "/" . $file . "/" . $file1 . "/" . $arComponentDescription["ICON"]))) {
                                                         $arComponent["ICON"] = $componentFolder . "/" . $file . "/" . $file1 . "/" . $arComponentDescription["ICON"];
                                                     } else {
                                                         $arComponent["ICON"] = "/bitrix/images/fileman/htmledit2/component.gif";
                                                     }
                                                 }
                                                 if (array_key_exists("COMPLEX", $arComponentDescription) && $arComponentDescription["COMPLEX"] == "Y") {
                                                     $arComponent["COMPLEX"] = "Y";
                                                 } else {
                                                     $arComponent["COMPLEX"] = "N";
                                                 }
                                                 $arComponent["SORT"] = IntVal($arComponentDescription["SORT"]);
                                                 if ($arComponent["SORT"] <= 0) {
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:component_util.php

示例2: __GetComponentsTree

	function __GetComponentsTree($filterNamespace = False, $arNameFilter = False)
	{
		$arTree = array();

		if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"]."/bitrix/components"))
		{
			while (($file = readdir($handle)) !== false)
			{
				if ($file == "." || $file == "..")
					continue;

				if (is_dir($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file))
				{
					if (CComponentUtil::isComponent("/bitrix/components/".$file))
					{
						// It's component
						if ($filterNamespace !== False && StrLen($filterNamespace) > 0)
							continue;
						if ($arNameFilter !== False && !CComponentUtil::CheckComponentName($file, $arNameFilter))
							continue;

						if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file."/.description.php"))
						{
							CComponentUtil::__IncludeLang("/bitrix/components/".$file, ".description.php");

							$arComponentDescription = array();
							$componentName = $file;
							include($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file."/.description.php");

							if (array_key_exists("PATH", $arComponentDescription) && array_key_exists("ID", $arComponentDescription["PATH"]))
							{
								$arComponent = array();
								$arComponent["NAME"] = $file;
								$arComponent["NAMESPACE"] = "";
								$arComponent["TITLE"] = Trim($arComponentDescription["NAME"]);
								$arComponent["DESCRIPTION"] = $arComponentDescription["DESCRIPTION"];
								if (array_key_exists("ICON", $arComponentDescription))
									$arComponent["ICON"] = "/bitrix/components/".$file.$arComponentDescription["ICON"];
								if (array_key_exists("COMPLEX", $arComponentDescription) && $arComponentDescription["COMPLEX"] == "Y")
									$arComponent["COMPLEX"] = "Y";
								else
									$arComponent["COMPLEX"] = "N";
								$arComponent["SORT"] = IntVal($arComponentDescription["SORT"]);
								if ($arComponent["SORT"] <= 0)
									$arComponent["SORT"] = 100;

								$arComponent["SCREENSHOT"] = array();
								if (array_key_exists("SCREENSHOT", $arComponentDescription))
								{
									if (!is_array($arComponentDescription["SCREENSHOT"]))
										$arComponentDescription["SCREENSHOT"] = array($arComponentDescription["SCREENSHOT"]);

									for ($i = 0, $cnt = count($arComponentDescription["SCREENSHOT"]); $i < $cnt; $i++)
										$arComponent["SCREENSHOT"][] = "/bitrix/components/".$file.$arComponentDescription["SCREENSHOT"][$i];
								}

								CComponentUtil::__BuildTree($arComponentDescription["PATH"], $arTree, $arComponent);
							}
						}
					}
					else
					{
						// It's not a component
						if ($filterNamespace !== False && (StrLen($filterNamespace) <= 0 || $filterNamespace != $file))
							continue;

						if ($handle1 = @opendir($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file))
						{
							while (($file1 = readdir($handle1)) !== false)
							{
								if ($file1 == "." || $file1 == "..")
									continue;

								if (is_dir($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file."/".$file1))
								{
									if (CComponentUtil::isComponent("/bitrix/components/".$file."/".$file1))
									{
										if ($arNameFilter !== False && !CComponentUtil::CheckComponentName($file1, $arNameFilter))
											continue;
										// It's component
										if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file."/".$file1."/.description.php"))
										{

											CComponentUtil::__IncludeLang("/bitrix/components/".$file."/".$file1, ".description.php");

											$arComponentDescription = array();
											$componentName = $file.":".$file1;
											include($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/".$file."/".$file1."/.description.php");

											if (array_key_exists("PATH", $arComponentDescription) && array_key_exists("ID", $arComponentDescription["PATH"]))
											{
												$arComponent = array();
												$arComponent["NAME"] = $file.":".$file1;
												$arComponent["NAMESPACE"] = $file;
												$arComponent["TITLE"] = Trim($arComponentDescription["NAME"]);
												$arComponent["DESCRIPTION"] = $arComponentDescription["DESCRIPTION"];
												if (array_key_exists("ICON", $arComponentDescription))
													$arComponent["ICON"] = "/bitrix/components/".$file."/".$file1.$arComponentDescription["ICON"];
												if (array_key_exists("COMPLEX", $arComponentDescription) && $arComponentDescription["COMPLEX"] == "Y")
													$arComponent["COMPLEX"] = "Y";
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:component_util.php


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