本文整理汇总了PHP中APP::getModules方法的典型用法代码示例。如果您正苦于以下问题:PHP APP::getModules方法的具体用法?PHP APP::getModules怎么用?PHP APP::getModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APP
的用法示例。
在下文中一共展示了APP::getModules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url
/**
* Retorna url formatada
* @param type $Controller_Action
* @param array $Variables
* @param type $Modulo
* @param array $VariaveisGet
* @param boolean $secure
* @return string
*/
function url($Controller_Action = '', array $Variables = null, $Modulo = null, array $VariaveisGet = null, $secure = false)
{
# Base
$url = base_url();
# Modulo
if ($Modulo === null) {
$Modulo = APP::getCurrentModule();
}
if ($Modulo != APP::getDefaultModule() or $Controller_Action and APP::getModules(explode('/', $Controller_Action)[0])) {
$url .= '/' . $Modulo;
}
# Controller/Action
if (!empty($Controller_Action)) {
if ($Variables) {
if (count($ex = explode('/', $Controller_Action)) == 1) {
if (controller_exists($ex[0])) {
$url .= "/{$ex[0]}/index";
} else {
$url .= '/index/' . $ex[0];
}
} else {
$url .= '/' . $Controller_Action;
}
} else {
$url .= '/' . $Controller_Action;
}
} else {
if ($Variables) {
$url .= 'index/index';
}
}
# Variaveis
if ($Variables) {
# Chaves númericas
if (key($Variables) === 0) {
foreach ($Variables as $key => $value) {
$url .= '/' . url_paranformat($value);
}
} else {
foreach ($Variables as $key => $value) {
$url .= '/' . url_paranformat($key) . '/' . url_paranformat($value);
}
}
}
# Retornando a URL
if ($VariaveisGet) {
$url .= '?' . http_build_query($VariaveisGet);
}
# HTTPS
if ($secure) {
$url = str_replace('http:', 'https:', $url);
}
return $url;
}
示例2: get_all_paths
/**
* Retorna todas as pasta para o include
* @return array
*/
function get_all_paths()
{
# Pega o valor já gravado
if (APP::getGlobal('get_all_paths')) {
return APP::getGlobal('get_all_paths');
}
# Pastas do sistema
$Paths = ['', 'system', 'system/core', 'system/crud', 'system/helpers', 'system/helpers/Bootstrap', 'system/models', 'system/libraries', 'system/models', 'system/valueobject'];
# Não possuí cache listando pastas
if (!APP::getCurrentModule()) {
return $Paths;
} else {
$Paths = array_merge([APP::getCurrentModule(true)], list_paths(APP::getCurrentModule(true)), $Paths);
$module = APP::getModules()[APP::getCurrentModule()];
$general = is_array(get_config('library')) ? get_config('library') : [];
if (is_array($module)) {
foreach (['library'] as $key => $value) {
if (is_array($value)) {
$general = array_merge($general, $value);
} else {
$general[] = $value;
}
}
}
foreach ($general as $key => $path) {
$Paths = array_merge([$path], list_paths($path), $Paths);
}
APP::setGlobal('get_all_paths', $Paths);
return $Paths;
}
}