本文整理汇总了PHP中CComponentEngine::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::getComponent方法的具体用法?PHP CComponentEngine::getComponent怎么用?PHP CComponentEngine::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::getComponent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveSocNetPathComponentEngine
/**
* Resolves path in complex component (socialnetwork) and find target file or folder.
* @param \CComponentEngine $engine Component engine.
* @param array $pageCandidates Page candidates.
* @param array &$variables Output variables.
* @return int|string
*/
public function resolveSocNetPathComponentEngine(\CComponentEngine $engine, $pageCandidates, &$variables)
{
$component = $engine->getComponent();
if (!$component) {
list($pageId, $variables) = each($pageCandidates);
return $pageId;
}
$storage = null;
foreach ($pageCandidates as $pageId => $variablesTmp) {
if (!empty($variablesTmp["PATH"]) && is_string($variablesTmp["PATH"])) {
$storage = $this->getStorageByVariables($variablesTmp);
if (!$storage) {
return '';
}
$variables = array_merge($variablesTmp, $this->resolvePathToFolder($storage, $variablesTmp["PATH"]));
if (empty($variables['FOLDER_ID'])) {
return '';
}
return $pageId;
} elseif (!empty($variablesTmp["FILE_PATH"]) && is_string($variablesTmp["FILE_PATH"])) {
$storage = $this->getStorageByVariables($variablesTmp);
if (!$storage) {
return '';
}
$variables = array_merge($variablesTmp, $this->resolvePathToFile($storage, $variablesTmp["FILE_PATH"]));
if (empty($variables['FILE_ID'])) {
return '';
}
return $pageId;
} elseif (!empty($variablesTmp["TRASH_PATH"]) && is_string($variablesTmp["TRASH_PATH"])) {
$storage = $this->getStorageByVariables($variablesTmp);
if (!$storage) {
return '';
}
$variables = array_merge($variablesTmp, $this->resolvePathToTrashFolder($storage, $variablesTmp["TRASH_PATH"]));
if (empty($variables['FOLDER_ID'])) {
return '';
}
return $pageId;
} elseif (!empty($variablesTmp["TRASH_FILE_PATH"]) && is_string($variablesTmp["TRASH_FILE_PATH"])) {
$storage = $this->getStorageByVariables($variablesTmp);
if (!$storage) {
return '';
}
$variables = array_merge($variablesTmp, $this->resolvePathToTrashFile($storage, $variablesTmp["TRASH_FILE_PATH"]));
if (empty($variables['FILE_ID'])) {
return '';
}
return $pageId;
}
}
list($pageId, $variables) = each($pageCandidates);
return $pageId;
}