本文整理汇总了PHP中Functions::scanOnlyDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::scanOnlyDir方法的具体用法?PHP Functions::scanOnlyDir怎么用?PHP Functions::scanOnlyDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::scanOnlyDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scanControllers
/**
* captura somente diretórios recursivamente
* @param [type] $dir [description]
* @param [type] $extra [description]
* @return [type] [description]
*/
public function scanControllers($dir, $extra = null, $pathunion = null, $nivel = 0, $dirBase = null)
{
if ($extra == null) {
$extra = function () {
return true;
};
}
$dirAppArray = Functions::scanOnlyDir($dir, $extra);
if (count($dirAppArray) < 1) {
return null;
}
$pathunion = '';
foreach ($dirAppArray as $key => $value) {
$path = $dir . $value . '/';
if ($pathunion == null) {
if ($nivel == 0) {
$dirBase = $dir;
}
$nivel++;
}
$pathunion = $pathunion . $value . '/';
//echo $value.'<br>';
$pathreplace = $path;
//$pathreplace = str_replace(Globals::get('path/app/modules/path'), '', $path);
// $pathreplace = str_replace($dirBase, '', $path);
$dirArray[$value]['name'] = $value;
$dirArray[$value]['controller'] = $pathreplace;
//$pathreplace;
$options = $this->getOptionsFile($pathreplace);
$dirArray[$value]['inner'] = $this->scanControllers($path, $extra, $pathunion, $nivel, $dirBase);
// $optionsSequence[] = $dirArray[$value]['inner'];
$parent = str_replace($dirBase, '', $pathreplace);
$dirArray[$value]['parent'] = $parent;
if (count($options) > 0) {
foreach ($options as $keyOptions => $valueOptions) {
$dirArray[$value][$keyOptions] = $valueOptions;
}
// ajusta o atributo 'parent' em caso ser definido o atributo inner no options
if (is_object($dirArray[$value][$keyOptions])) {
$keyInner = key($dirArray[$value][$keyOptions]);
if (is_object($dirArray[$value][$keyOptions]->{$keyInner})) {
$innerParent = str_replace($dirBase, '', $pathreplace) . $keyInner;
$dirArray[$value][$keyOptions]->{$keyInner}->parent = $innerParent;
//str_replace($dirBase, '', $pathreplace);
}
}
}
}
// ordena por prioridade no options
$price = array();
foreach ($dirArray as $key => $row) {
//echo print_r($row['priority']).'==<br>';
//
$price[$key] = isset($row['priority']) ? $row['priority'] : 100;
}
array_multisort($price, SORT_ASC, $dirArray);
return $dirArray;
}
示例2: checkFirstAccess
/**
* verifica estrutura da aplicação esta correta
* @return [type] [description]
*/
public function checkFirstAccess()
{
$pathApp = Globals::get('path/app/appbase/path');
$dirArray = Functions::scanOnlyDir($pathApp);
if (count($dirArray) < 1) {
return true;
} else {
return false;
}
}
示例3: load
//.........这里部分代码省略.........
//if($result == false){
// verifica as informações iniciais, como estrutura de diretórios e outros
$resultCheckStruct = $settings->checkStruct();
if ($resultCheckStruct == false) {
// anexa evento
$resultEvents = Events::Attach('error[app_not_found]', array('value' => '', 'action' => ''));
if (!$resultEvents) {
$html = '<h1>Suite</h1>';
$html .= '<h3>Application not found</h3>';
$html .= '<p>';
$html .= '<strong>Name:</strong> ' . Globals::get('path/app/name');
$html .= '<br><strong>Path:</strong> ' . Globals::get('path/app/path');
$html .= '</p>';
echo $html;
exit;
}
}
//}
}
// captura a lista de plugins
$pluginsList = $plugins->getList();
// redefine ordem dos plugins
$pluginsList = $plugins->reDefinePlugins($pluginsList);
// cria um objeto com todos os plugins
$pluginsObj = $plugins->getPlugins($pluginsList);
Globals::set("plugins")->inner('list', $pluginsList);
Globals::set("plugins")->inner('action', $pluginsObj);
// redireciona a página se foi setado um preixo para a url
$http->checkPrefixUrl($settings, $path);
// executa caso o plugin for chamado diretamente via url ou código
$plugins->callDirect($http, $path);
//captura todos os controllers e as options
$controllersList = $controller->getControllers();
$appListArray = Functions::scanOnlyDir(Globals::get('path/app/appbase/path'));
Globals::set('app')->list = $appListArray;
Globals::set('app')->options = array('master' => $controller->getOptionMaster(), 'modules' => $controllersList);
$controllersManagerList = $controller->getControllers(Globals::get()->path->manager->modules->path);
Globals::set('manager')->options = array('master' => $controller->getOptionMaster(Globals::get('path/manager/modules/path')), 'modules' => $controllersManagerList);
//Globals::set('manager')->access = "";
// verifica dependencias de plugins no controler Master
$resultDependenceMaster = $plugins->checkDependence('_control');
$resultDependenceMasterObj = json_decode($resultDependenceMaster);
Globals::set('plugins')->dependence = array("_control" => $resultDependenceMasterObj->data[0]);
$lastaction = Globals::get('http/controllers/lastaction');
// verifica dependencias de plugins no controler Master
$resultDependenceModules = $plugins->checkDependence($lastaction);
$resultDependenceModulesObj = json_decode($resultDependenceModules);
Globals::set('plugins')->inner('dependence')->add(array($lastaction => $resultDependenceModulesObj->data[0]));
//Globals::set('plugins')->dependence = array("_control"=>$resultDependenceMasterObj->data[0]);
if (Globals::get('app/run') == '!') {
$result = Functions::checkModeAdmin();
if ($result == false) {
$queryurl = Globals::get('http/query');
$queryurl = substr($queryurl, 4);
header("location: " . Globals::get('path/manager/link') . "/manager/access&destin=" . $queryurl);
return;
} else {
// verifica dependencia da aplicação
//$plugins->checkDependence('_control');
}
// verifica se esta online no Manager ------------------------------
$result = Functions::checkOnline(false);
if ($result == true) {
// cria um menu baseado nos controllers -----------------------
$controllerArray = Globals::get('manager/options/modules');
//$controller->getControllers('');
示例4: scanOnlyDirRecursive
/**
* captura somente diretórios recursivamente
* @param [type] $dir [description]
* @param [type] $extra [description]
* @return [type] [description]
*/
public static function scanOnlyDirRecursive($dir, $extra = null)
{
if ($extra == null) {
$extra = function () {
return true;
};
}
$dirAppArray = Functions::scanOnlyDir($dir, $extra);
if (count($dirAppArray) < 1) {
return null;
}
foreach ($dirAppArray as $key => $value) {
$path = $dir . $value . '/';
$dirArray[$value] = Functions::scanOnlyDirRecursive($path, $extra);
}
return $dirArray;
}