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


PHP APP::getCurrentModule方法代码示例

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


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

示例1: __construct

 /**
  * Inicia uma sessão
  * @param string $sessionName
  */
 public function __construct($sessionName, $ProtectedModule = false)
 {
     self::start();
     $this->SessionName = ($ProtectedModule ? (is_string($ProtectedModule) ? $ProtectedModule : APP::getCurrentModule()) . '-' : null) . $sessionName;
     if (!isset($_SESSION[self::$_SESSION_][$this->SessionName])) {
         $_SESSION[self::$_SESSION_][$this->SessionName] = null;
     }
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:12,代码来源:Session.class.php

示例2: 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;
}
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:63,代码来源:url.php

示例3: Initialize

 /**
  * Inicia a aplicação
  * @param array $APPConfig
  * @param string $PublicPath
  */
 static function Initialize(array $APPConfig, $PublicPath = 'public_html')
 {
     APP::setGlobal('public_path', $PublicPath);
     $Action = $Controller = null;
     self::$APP_CONFIG = $APPConfig;
     self::$Modules = isset(self::$APP_CONFIG['modules']) ? self::$APP_CONFIG['modules'] : self::$APP_CONFIG;
     self::$DefaultModule = key(self::$Modules);
     # URL Variables
     $values = !empty($_GET['GET_VARS']) ? explode('/', strtolower($_GET['GET_VARS'])) : [self::$DefaultModule, 'index', 'index'];
     # Modulo
     if (isset(self::$Modules[$values[0]])) {
         self::$CurrentModule = $values[0];
         unset($values[0]);
         $values = array_values($values);
     } else {
         self::$CurrentModule = self::$DefaultModule;
     }
     # Controller
     if (empty($values[0]) or controller_exists(strtolower($values[0])) === false) {
         $Controller = 'index';
     } else {
         $Controller = $values[0];
         unset($values[0]);
         $values = array_values($values);
     }
     # Action
     if (empty($values[0]) and controller_action_exists($Controller, 'index')) {
         $Action = 'indexAction';
     } else {
         if (empty($values[0]) or !($Action = controller_action_exists($Controller, $values[0]))) {
             self::$Parans['action'] = strtolower(@$values[0]);
             $Action = 'notFoundPage';
         } else {
             unset($values[0]);
             $values = array_values($values);
         }
     }
     # Parâmetros númericos
     self::$Parans = $values;
     # Parâmetros nomeados
     if (count(self::$Parans) > 1) {
         for ($i = 0; $i < count($values); $i += 2) {
             if (isset($values[$i + 1])) {
                 self::$Parans[$values[$i]] = $values[$i + 1];
             }
         }
     }
     # Modulo
     if (!isset(self::$Parans['module'])) {
         self::$Parans['module'] = APP::getCurrentModule();
     }
     # Controller
     if (!isset(self::$Parans['controller'])) {
         self::$Parans['controller'] = APP::getControllerName();
     }
     # Action
     if (!isset(self::$Parans['action'])) {
         self::$Parans['action'] = $Action;
     }
     # Valores GET
     if (preg_match('/\\?/', inputServer('REQUEST_URI'))) {
         parse_str(preg_replace('/.*\\?/', NULL, inputServer('REQUEST_URI')), $getValues);
         foreach ($getValues as $key => $value) {
             $_GET[$key] = $value;
             if (!isset(self::$Parans[$key])) {
                 self::$Parans[$key] = $value;
             }
         }
     }
     # Action
     self::$Action = $Action;
     # Cria instancia do modulo
     if (file_exists($ModuleClass = ABSPATH . '/' . self::getCurrentModule(true) . '/Module.class.php')) {
         file_include($ModuleClass);
         self::$Module = new Module();
     }
     # Executando a action
     self::setController($Controller);
     self::getController()->{$Action}();
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:85,代码来源:APP.class.php

示例4: 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;
    }
}
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:35,代码来源:core.php

示例5: displayFooter

 /**
  * Display all scripts
  */
 public static function displayFooter()
 {
     print "\n\t";
     print "<!-- JavaScript -->\n\t";
     print "<script type='text/javascript' ><!--" . "\n\t\tvar URL_APP = '" . base_url() . "';" . "\n\t\tvar URL_MODULE = '" . url() . "';" . "\n\t\tvar CONTROLLER = '" . APP::getControllerName() . "';" . "\n\t\tvar ACTION = '" . APP::getAction() . "';" . "\n\t\tvar MODULE = '" . APP::getCurrentModule() . "';" . "\n\t\tvar MODULE_DEFAULT = '" . APP::getDefaultModule() . "';" . "\n\t--></script>\n\t";
     if (count(self::$JS) > 0) {
         foreach (self::$JS as $src) {
             if (!preg_match('/^<script/i', $src)) {
                 print "<script type=\"text/javascript\" language=\"javascript\" src=\"{$src}\" charset=\"" . self::$Charset . "\" ></script>\n\t";
             } else {
                 print "{$src}\n\t";
             }
         }
     }
     print "<!-- Tempo de execução: " . calc_execution_time(2) . " milesegundos -->\n\n\t";
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:19,代码来源:Seo.class.php


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