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


PHP Loader::getPath方法代码示例

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


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

示例1: activate

 function activate()
 {
     $setup = Config::get('RPC');
     $class = URL::getPathPart($setup['class']);
     $method = URL::getPathPart($setup['method']);
     list($action, $type) = explode('.', URL::getPathPart($setup['action']), 2);
     $path = $setup["path"] . "/" . $class . "/" . ucwords($method) . ucwords($action) . "Controller";
     if (file_exists(Loader::getPath("controller", $path))) {
         Debugger::log("CONTROLLER: <span style=\"color: #990000\">" . ucwords($method) . ucwords($action) . "Controller</span>");
         $controller = Loader::loadNew("controller", $path);
         $controller->activate();
         if (is_callable(array($controller, $type))) {
             echo $controller->{$type}();
         }
         return;
     }
     $controller_class = ucwords($class) . ucwords($method) . ucwords($action) . "Controller";
     Debugger::log("CONTROLLER: <span style=\"color: #990000\">{$controller_class}</span>");
     if (file_exists(Loader::getPath("controller", "{$setup['path']}/{$controller_class}"))) {
         $controller = Loader::loadNew("controller", "{$setup['path']}/{$controller_class}");
         $controller->activate();
     } else {
         Loader::load("utility", "Server");
         $ip = Server::getIP();
         $self = Server::getSelf();
         Debugger::log("Possible RPC Injection: RPC call to non-existent controller at path {$setup["path"]}/{$controller_class} {$ip} {$self}");
         error_log("Possible RPC Injection: RPC call to non-existent controller at path {$setup['path']}/{$controller_class} {$ip} {$self}");
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:29,代码来源:RpcController.class.inc.php

示例2: getLayoutPath

 /**
  * Get layout path
  *
  * @param $layout
  * @return string
  */
 private function getLayoutPath($layout)
 {
     $segments = explode('\\', get_class($this));
     $path_to_pkg = \Loader::getPath(array_shift($segments));
     $view_dir_name = str_replace('Controller', '', array_pop($segments));
     return realpath($path_to_pkg . '/views/' . $view_dir_name . '/' . $layout . '.php');
 }
开发者ID:benms,项目名称:MK_Framework,代码行数:13,代码来源:Controller.php

示例3: error404

 protected function error404()
 {
     $controller = '/controller/Error404Controller';
     if (file_exists(Loader::getPath('controller', 'Error404Controller'))) {
         $controller = 'Error404Controller';
     }
     Loader::loadNew('controller', $controller)->activate();
     exit;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:9,代码来源:Controller.class.inc.php

示例4: render

 /**
  * Render full path to $layout. Finally '/var/www/mindkblog.com/src/Blog/views/Post/index.html.php'.
  *
  * @param $layout
  * @param null $data
  * @return Response
  */
 public function render($layout, $data = null)
 {
     $controller_class = get_class($this);
     $segments = explode('\\', $controller_class);
     $root_namespace = array_shift($segments);
     $path_to_pkg = \Loader::getPath($root_namespace);
     $ctrl = array_pop($segments);
     $view_dir_name = str_replace('Controller', '', $ctrl);
     $layout_full_path = realpath($path_to_pkg . '/views/' . $view_dir_name . '/' . $layout . '.php');
     $renderer = new Renderer($layout_full_path, $data);
     $response = new Response($renderer->render());
     return $response;
 }
开发者ID:jurazubach,项目名称:Framework,代码行数:20,代码来源:Controller.php

示例5: detect_fatal_error

function detect_fatal_error()
{
    $last_error = error_get_last();
    if ($last_error && ($last_error['type'] == E_ERROR || $last_error['type'] == E_PARSE) && class_exists('Loader')) {
        try {
            Loader::load('utility', 'Template');
            if (file_exists(Loader::getPath('view', 'FatalError'))) {
                Debugger::log("Type {$last_error["type"]}: {$last_error["message"]} in {$last_error["file"]} on line {$last_error["line"]}");
                ob_clean();
                header('HTTP/1.1 503 Service Temporarily Unavailable');
                header('Status: 503 Service Temporarily Unavailable');
                Template::insert('FatalError');
                error_log("[Error Caught] {$last_error['message']} in {$last_error['file']} on line {$last_error['line']}");
                ob_end_flush();
            }
        } catch (Exception $e) {
            //echo "We've encountered an error. Please go back and try again.";
        }
    }
}
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:20,代码来源:prepend.php

示例6: getControllerFromUrl

 static function getControllerFromUrl($url = null)
 {
     if (!isset($url)) {
         $url = self::getCurrent();
     }
     $url = self::parsePath($url);
     $controller = self::findDynamicPath($url);
     if (!$controller) {
         $controller = self::findParamPath($url);
     }
     if (!$controller) {
         $controller = self::findStaticPath($url);
     }
     if (!$controller) {
         $controller = '/controller/Error404Controller';
         if (file_exists(Loader::getPath('controller', 'Error404Controller'))) {
             $controller = 'Error404Controller';
         }
     }
     if (substr($controller, 0, 10) == 'redirect=>') {
         $controller = self::parseRedirect($url, $controller);
     }
     return $controller;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:24,代码来源:URL.class.inc.php

示例7: insert

 static function insert($view_file, $args = array())
 {
     extract($args);
     include Loader::getPath('view', $view_file);
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:5,代码来源:Template.class.inc.php


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