本文整理汇总了PHP中Loader::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::load方法的具体用法?PHP Loader::load怎么用?PHP Loader::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @return mixed
*/
public function getData()
{
if (!$this->dataLoaded) {
$this->data = (array) $this->loader->load($this->path);
$this->dataLoaded = TRUE;
}
return $this->data;
}
示例2: instance
public static function instance($model_name, $action)
{
Loader::load('mutator', self::get_file_name($model_name, $action));
$mutation_name = $action . $model_name;
$reflection = new ReflectionClass($mutation_name);
return $reflection->newInstance($model_name, $action);
}
示例3: __construct
/**
* Constructor.
* Acts as mini Router that picks up at the Controller level, post-routing.
* Searches for files in directory relative to delegating class.
*
* Uses argument already set in Router as provided in URL.
*
* The URL parameter that would ordinarily be the method is now the subdirectory
* The URL parameter that would be the first method parameter is now the controller.
* The URL paramter that would be the second method parameter is now the method.
*
* Any remaining URL parameters are passed along as method parameters for the
* Subcontroller invoked.
*/
public function __construct()
{
// Find the file in the directory relative to the original Controller.
$subdirectory = dirname($this->file) . '/' . Router::$method;
$file = strtolower(array_shift(Router::$arguments));
$path = $subdirectory . '/' . $file . FILE_EXTENSION;
$default_path = $subdirectory . '/' . Router::$method . FILE_EXTENSION;
if (file_exists($path)) {
Loader::load($path);
$controller = ucfirst($file) . '_Controller';
if (count(Router::$arguments)) {
Router::$method = array_shift(Router::$arguments);
} else {
Router::$method = Registry::$config['core']['default_controller_method'];
}
Core::run_controller($controller);
} elseif (file_exists($default_path)) {
// Check for a default file of the same name as the directory, and load that with the default method.
Loader::load($default_path);
$controller = ucfirst(strtolower(Router::$method)) . '_Controller';
Router::$method = Registry::$config['core']['default_controller_method'];
Core::run_controller($controller);
} else {
// No matches.
Core::error_404();
}
// Exit to prevent Router from continuing in Core.
exit;
}
示例4: init
/**
* 初始化函数
*
* @access public
* @param string $driver 驱动名称
* @param array $option 实例化驱动时需要的参数
* @return void
**/
public static function init($driver, $option)
{
Loader::load('parse.driver.' . ucfirst(strtolower($driver)) . 'Driver');
$class = ucfirst($driver) . 'Driver';
$instance = new ReflectionClass($class);
self::$_driver = $instance->newInstanceArgs($option);
}
示例5: 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}");
}
}
示例6: init
/**
* 初始化Loader
* @return Object
*/
public static function init()
{
if (!is_object(self::$load)) {
self::$load = new Loader();
}
return self::$load;
}
示例7: load
/**
* 装载业务模型文件
*
* @param string $name
*/
public function load($name)
{
if (isset($this->models[$name])) {
return true;
}
$this->models[$name] = 1;
Loader::load('app/Models/' . $name . $this->getFileSubfix());
}
示例8: activate
public function activate()
{
$this->set_data();
$this->set_footer();
Loader::load('view', 'part/Head', $this->data_array['head']);
Loader::load('view', "body/{$this->body_view}", $this->data_array['body']);
Loader::load('view', 'part/Foot', $this->data_array['foot']);
}
示例9: __construct
function __construct($find_router = true)
{
Loader::load('utility', 'router/SiteRouter');
Loader::load('controller', '/controller/Controller');
if ($find_router) {
$this->findRouter();
}
}
示例10: getSession
public function getSession()
{
if (!isset($this->passinggreensession)) {
Loader::load("model", "com/passinggreen/PassinggreenSession");
$this->passinggreensession = new PassinggreenSession($this->getDBValue(self::$SESSION_ID));
}
return $this->passinggreensession;
}
示例11: instance
/**
* register instance
*
* @param string $name
* @return object
*/
public function instance($name)
{
if ($this->exists($name)) {
return $this->get($name);
}
$class = ucfirst($name);
Loader::load($this->getPath($class));
return $this->set($name, new $class());
}
示例12: dependencies
public static function dependencies()
{
\Loader::load('actions/controller', 'helper');
\Loader::load('actions/module', 'helper');
\Loader::load('actions/testers', 'helper');
\Loader::load('app/controller', 'interface');
\Loader::load('app/event', 'interface');
\Loader::load('app/model', 'interface');
\Loader::load('app/view', 'interface');
}
示例13: Output
public function Output($template)
{
if (file_exists(dirname(__FILE__) . DS . "template" . DS . $template)) {
Loader::load(dirname(__FILE__) . DS . "template" . DS . $template);
$this->TemplateFile = new TemplateFile();
print_r($this->TemplateFile->FinalTemplate($this->Header(), $this->HtmlDir(), $this->HtmlTitle(), $this->RtlCss(), $this->drawBackground(), $this->drawLogo(), $this->drawPaidWatermark(), $this->drawInvoiceType(), $this->drawInvoiceInfo(), $this->drawReturnAddress(), $this->drawAddress(), $this->drawLineHeader(), $this->drawInvoice(), $this->SubTotals(), $this->Taxes(), $this->Totals(), $this->PublicNotes(), $this->drawPayments(), $this->drawTerms(), $this->Footer(), $this->PrintBtn(), $this->DownloadBtn(), $this->PaymentBtn(), $this->EditBtn()));
} else {
throw new Exception("Template : " . $template . " not found");
}
}
示例14: import
/**
* import file
*
* @param string $name
*/
public static function import($name)
{
$type = false !== strpos($name, '/') ? '' : 'Libraries/';
$file = 'app/' . $type . $name;
if (Loader::checkPath($file)) {
return Loader::load($file);
} elseif (Loader::checkPath('vendor/Imp/' . $type . '/' . $name)) {
return Loader::load('vendor/Imp/' . $type . '/' . $name);
}
}
示例15: custom_fetch
/**
* 判断是否有用户自定义的业务逻辑
**/
public function custom_fetch($path, $ext)
{
$hooks = Loader::load_config('hooks', false);
if ($hooks && $hooks['parse']) {
Loader::load('parse.' . strtolower($hooks['parse']['class']));
$obj = new $hooks['parse']['class']();
$args = array($this, $path, $ext);
call_user_func_array(array($obj, $hooks['parse']['method']), $args);
}
}