本文整理汇总了PHP中Plugins::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::find方法的具体用法?PHP Plugins::find怎么用?PHP Plugins::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public static function find($filename)
{
if (($resource = Plugins::find(self::WWW_DIR . DIRECTORY_SEPARATOR . $filename)) !== null) {
return $resource;
}
if (($resource = Plugins::find(self::VENDOR_DIR . DIRECTORY_SEPARATOR . $filename)) !== null) {
return $resource;
}
return;
}
示例2: findTemplate
public static function findTemplate($filename)
{
if ($filename[0] != DIRECTORY_SEPARATOR) {
$template_file = Plugins::find(self::TEMPLATES_DIR . DIRECTORY_SEPARATOR . $filename);
if ($template_file !== null) {
return $template_file;
}
return false;
}
return file_exists($filename);
}
示例3: autoload
protected function autoload($class_name)
{
if (parent::autoload($class_name)) {
return true;
}
$class_name = $this->removeNamespace($class_name);
$plugin = Plugins::find(self::MODEL_DIR . DIRECTORY_SEPARATOR . $class_name . '.class.php');
if ($plugin !== null) {
require_once $plugin;
return true;
}
$plugin = Plugins::find(self::BASE_MODEL_DIR . DIRECTORY_SEPARATOR . $class_name . '.class.php');
if ($plugin !== null) {
require_once $plugin;
return true;
}
return false;
}
示例4: handle
public static function handle($method = null, $path = null)
{
if ($path == null) {
$path = @$_SERVER["PATH_INFO"];
}
if ($method == null) {
$method = $_SERVER["REQUEST_METHOD"];
}
while (strlen($path) > 0 && $path[0] == "/") {
$path = substr($path, 1);
}
if ($path == "") {
$path = "index";
}
$pos = strpos($path, "/");
if ($pos === false) {
$request = $path;
$next_path = "";
} else {
$request = substr($path, 0, $pos);
$next_path = substr($path, $pos);
}
$request = str_replace(".", "_", $request);
$request = str_replace("-", " ", $request);
$request = ucwords($request);
$request = str_replace(" ", "", $request) . "Rest";
$request_file = Plugins::find(self::REQUEST_DIR . DIRECTORY_SEPARATOR . $request . ".class.php");
if ($request_file === null) {
ErrorHandler::error(404, null, $request . ".class.php");
}
require_once $request_file;
$class_name = __NAMESPACE__ . "\\" . $request;
$instance = new $class_name();
$instance->handleRequest($method, $next_path);
ErrorHandler::error(204);
}