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


PHP Loader::loadNew方法代码示例

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


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

 private function redirectToComment($commentId)
 {
     $url = '';
     $url .= $this->fullPath;
     $url .= "#comment-{$commentId}";
     Loader::loadNew('controller', 'Error303Controller', array($url))->activate();
     exit;
 }
开发者ID:jacobemerick,项目名称:web,代码行数:8,代码来源:CommentSubmitModule.class.inc.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: direct

 private function direct()
 {
     $link_map = $this->construct_direct_link_map();
     $uri = Request::getServer('REQUEST_URI');
     if (array_key_exists($uri, $link_map)) {
         $controller = Loader::loadNew('controller', $link_map[$uri]);
     } else {
         $controller = Loader::loadNew('controller', 'Error404Controller');
     }
     $controller->activate();
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:11,代码来源:Router.class.inc.php

示例5: check_for_special_redirect

 protected function check_for_special_redirect($uri)
 {
     if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) {
         $alias = $matches[1];
         $alias = str_replace("'", '', $alias);
         $alias .= '-falls';
         $result = WaterfallCollector::getByOldAlias($alias);
         if ($result !== null) {
             return "/{$result->watercourse_alias}/{$result->alias}/";
         } else {
             Loader::loadNew('controller', '/Error404Controller')->activate();
         }
     }
     if (preg_match('@^/photos/([a-z\'-]+)-([^/]+)(/?)$@', $uri, $matches)) {
         $alias = $matches[1];
         $alias = explode('-', $alias);
         array_pop($alias);
         $alias = implode('-', $alias);
         $alias = str_replace("'", '', $alias);
         $alias .= '-falls';
         $result = WaterfallCollector::getByOldAlias($alias);
         if ($result !== null) {
             return "/{$result->watercourse_alias}/{$result->alias}/";
         } else {
             Loader::loadNew('controller', '/Error404Controller')->activate();
         }
     }
     if (preg_match('@/log/([a-z]+-\\d{2}-\\d{4})(/?)$@', $uri, $matches)) {
         $date = $matches[1];
         $date = explode('-', $date);
         $date = mktime(0, 0, 0, date('n', strtotime($date[0])), $date[1], $date[2]);
         $date = date('Y-m-d', $date);
         $result = LogCollector::getByDate($date);
         if ($result !== null) {
             return "/journal/{$result->alias}/";
         } else {
             Loader::loadNew('controller', '/Error404Controller')->activate();
         }
     }
     if (preg_match('@/map/([a-z\'-]+)(/?)$@', $uri, $matches)) {
         $alias = $matches[1];
         $alias = str_replace("'", '', $alias);
         $alias .= '-falls';
         $result = WaterfallCollector::getByOldAlias($alias);
         if ($result !== null) {
             return "/map/#{$result->watercourse_alias}/{$result->alias}";
         } else {
             Loader::loadNew('controller', '/Error404Controller')->activate();
         }
     }
     return $uri;
 }
开发者ID:jacobemerick,项目名称:web,代码行数:52,代码来源:WaterfallRouter.class.inc.php

示例6: check_for_special_redirect

	protected function check_for_special_redirect($uri)
	{
		if(preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches))
		{
        global $container;
        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
        $post = $repository->findPostByPath($matches[2]);

			if(!$post)
			{
				Loader::loadNew('controller', '/Error404Controller')
					->activate();
			}
			
			Loader::load('utility', 'Content');
			$uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
		}
		else
		{
			$post_uri = URLDecode::getPiece(1);
			if($post_uri !== null)
			{
        global $container;
        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
        $post = $repository->findPostByPath($post_uri);

				if($post != false)
				{
					Loader::load('utility', 'Content');
					$uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
				}
			}
		}
		if($uri == '/search/')
		{
			if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search'))
			{
				$uri .= Request::getGet('search');
				$uri .= '/';
			}
		}
		return $uri;
	}
开发者ID:jacobemerick,项目名称:web,代码行数:43,代码来源:BlogRouter.class.inc.php

示例7: loadController

 protected function loadController($controller, $args = array(), $class = null)
 {
     Debugger::log("CONTROLLER: <span style=\"color:#4882c0;\">{$controller}");
     return Loader::loadNew('controller', $controller, $args, $class);
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:5,代码来源:SiteRouter.class.inc.php

示例8: __construct

 function __construct()
 {
     parent::__construct();
     Config::set('HideDebugger', true);
     $this->captcha = Loader::loadNew('utility', 'captcha/Captcha');
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:6,代码来源:CaptchaController.class.inc.php

示例9: check_for_redirect

	final protected function check_for_redirect($redirect_uri)
	{
		foreach($this->get_redirect_array() as $check)
		{
			$redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri);
		}
		
		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
		
		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
			$redirect_uri .= '/';
		
        if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
            $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
            $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri;
        }
        
		if($redirect_uri == URLDecode::getURI())
			return;
		
		$controller_check = $redirect_uri;
		if(substr($redirect_uri, 0, 4) == 'http') {
      $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
			$controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri);
    }
		
		$controller = $this->get_controller($controller_check);
		if($controller == '/Error404Controller')
		{
			Loader::loadNew('controller', '/Error404Controller')
				->activate();
			exit;
		}

		if(substr($redirect_uri, 0, 4) != 'http')
		{
			$redirect_uri = substr($redirect_uri, 1);
			$redirect_uri = URLDecode::getBase() . $redirect_uri;
		}
		
		Loader::loadNew('controller', '/Error301Controller', (array) $redirect_uri)
			->activate();
	}
开发者ID:jacobemerick,项目名称:web,代码行数:43,代码来源:Router.class.inc.php

示例10: eject

 protected function eject()
 {
     Loader::loadNew('controller', 'Error404Controller')->activate();
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:4,代码来源:PageController.class.inc.php

示例11: loadRouter

 function loadRouter($router, $args = array(), $class = null)
 {
     $this->router = Loader::loadNew('utility', "router/sites/{$router}", $args, $class);
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:4,代码来源:MasterRouter.class.inc.php

示例12: error_reporting

<?php

return;
include_once 'utility/Loader.class.inc.php';
error_reporting(-1);
date_default_timezone_set('America/Chicago');
Loader::setRoot(dirname(__FILE__));
Loader::load('model', array('DataObject', 'DataCollection'));
Loader::load('mutator', 'Mutator');
Loader::loadNew('utility', 'Router');
开发者ID:jacobemerick,项目名称:crawler,代码行数:10,代码来源:initiator.php

示例13: handle_comment_submit

	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
	{
		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
		{
			$parameters = array($site_id, $path, $redirect_url, $page_title);
			$this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate();
		}
		
		return;
	}
开发者ID:jacobemerick,项目名称:web,代码行数:10,代码来源:PageController.class.inc.php


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