瀏覽代碼

first commit

master
Robbe 2 年之前
當前提交
75e026106b

+ 23
- 0
.vscode/launch.json 查看文件

@@ -0,0 +1,23 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": { "/src": "${workspaceRoot}/backend" }
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

+ 8
- 0
README.md 查看文件

@@ -0,0 +1,8 @@
<!-- Welcome to the Sh*itter Read me

To launch the app:

1. cd backend -> docker run --rm -t -i -v $PWD:/src -p 8000:8000 debaetsr/php_xdebug

2. cd ../
3. cd frontend -> npm run serve -->

+ 1
- 0
backend/.gitignore 查看文件

@@ -0,0 +1 @@
.DS_Store

+ 9
- 0
backend/.htaccess 查看文件

@@ -0,0 +1,9 @@

# Disable magic quotes by default
# php_value magic_quotes_gpc off

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

+ 21
- 0
backend/LICENSE 查看文件

@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2014 Artur Heinze, [http://agentejo.com](http://agentejo.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 275
- 0
backend/README.md 查看文件

@@ -0,0 +1,275 @@
Lime
====

Lime is a micro web framework for quickly creating web applications in PHP with minimal effort.

```php
$app = new Lime\App();

$app->bind("/", function() {
return "Hello World!";
});

$app->run();
```

Just include one file (~ 35KB) and you're ready to go.


## Routes

In Lime, a route is an HTTP method paired with a URL-matching pattern. Each route is associated with a block:

```php
$app->get("/", function() {
return "This was a GET request...";
});

$app->post("/", function() {
return "This was a POST request...";
});

$app->bind("/", function() {
return "This was a GET or POST request...";
});
```

Routes are matched in the order they are defined. The first route that matches the request is invoked.

Route patterns may include named parameters, accessible via the params hash:

```php
$app->get("/posts/:id/:name", function($params) {
return $params["id"].'-'.$params["name"];
});

$app->post("/misc/*", function($params) {
return $params[":splat"];
});

$app->bind("#/pages/(about|contact)#", function($params) {
return implode("\n", $params[":captures"]);
});
```


## Conditions

Routes may include a variety of matching conditions, such as the user agent:

```php
$app->get("/foo", function() {
// GET request...
}, strpos($_SERVER['HTTP_USER_AGENT'], "Safari")!==false);
```

## Create Urls

```php
$route = $app->routeUrl('/my/route');
$url = $app->baseUrl('/assets/script.js');
```

## Templates

In general you can utilize any template engine you want. Lime provides a simple template engine:

```php
$app->get("/", function() {

$data = array(
"name" => 'Frank',
"title" => 'Template demo'
);

return $this->render("views/view.php with views/layout.php", $data);
});
```

views/view.php:

```php
<p>
Hello <?=$name?>.
</p>
```

views/layout.php:

```php
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title><?=$title?></title>
</head>
<body>
<a href="<?=$this->routeUrl('/')?>">Home</a>
<hr>
<?php echo $content_for_layout;?>
</body>
</html>
```

## You like OO style?

Just bind a class:

```php
class Pages {

protected $app;

public function __construct($app){
$this->app = $app;
}

/*
accessible via
/pages or /pages/index
*/
public function index() {
return $this->app->render("pages/index.php");
}

/*
accessible via
/pages/contact
*/
public function contact() {
return $this->app->render("pages/contact.php");
}

/*
accessible via
/pages/welcome/foo
*/
public function welcome($name) {
return $this->app->render("pages/welcome.php", array("name"=>$name));
}
}

// bind Class to map routes
$app->bindClass("Pages");
```

## Registry

Store any values by setting a key to the $app object.

```php
$app["config.mykey"] = array('test' => 123);
```

Path access helper with <code>/</code>

```php
$value = $app["config.mykey/test"]; // will return 123
```

## Paths

Register paths for quicker access

```php
$app->path('views', __DIR__.'/views');

$view = $app->path('views:detail.php');
$view = $app->render('views:detail.php');
```

Gets url to file

```php
$url = $app->pathToUrl('folder/file.php');
$url = $app->pathToUrl('view:file.php');
```

## Dependency injection

```php
$app->service("db", function(){

// object will be lazy created after accessing $app['db']
$obj = new PDO(...);

return $obj;

});

$app["db"]->query(...);
```

## Events


```php

// register callback
$app->on("customevent", function(){
// code to execute on event
}, $priority = 0);

// trigger custom events
$app->trigger("customevent", $params=array());
```

You can utilize three system events: before, after and shutdown

```php
// render custom error pages

$app->on("after", function() {

switch($this->response->status){
case "404":
$this->response->body = $this->render("views/404.php");
break;
case "500":
$this->response->body = $this->render("views/500.php");
break;
}
});
```




## Helpers

You can extend Lime by using your custom helpers:

```php
class MyHelperClass extends Lime\Helper {

public function test(){
echo "Hello!";
}
}

$app->helpers["myhelper"] = 'MyHelperClass';

$app("myhelper")->test();
```

#### Build in helpers

**Session**

```php
$app("session")->init($sessionname=null);
$app("session")->write($key, $value);
$app("session")->read($key, $default=null);
$app("session")->delete($key);
$app("session")->destroy();
```

**Cache**

```php
$app("cache")->setCachePath($path);
$app("cache")->write($key, $value, $duration = -1);
$app("cache")->read($key, $default=null);
$app("cache")->delete($key);
$app("cache")->clear();
```

+ 31
- 0
backend/composer.json 查看文件

@@ -0,0 +1,31 @@
{
"name": "aheinze/lime",
"description": "The PHP micro-framework",
"keywords": [
"php",
"micro-framework",
"microframework",
"lime"
],
"homepage": "https://github.com/aheinze/Lime",
"license": "MIT",
"authors": [
{
"name": "Artur Heinze",
"email": "faulancer@gmail.com",
"homepage": "http://agentejo.com/",
"role": "Developer"
}
],
"require": {
"php": ">=5.6.0"
},
"autoload": {
"psr-4": {
"App\\": "src/"
},
"psr-0": {
"Lime": "src/"
}
}
}

+ 20
- 0
backend/composer.lock 查看文件

@@ -0,0 +1,20 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "23853615a827859dfd15c68fc7ca4b77",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.6.0"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

二進制
backend/db/db_blog.db 查看文件


+ 45
- 0
backend/public/index.php 查看文件

@@ -0,0 +1,45 @@
<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');

use App\Controller\BlogController;
use App\DB\DB;

require __DIR__ . '/../vendor/autoload.php';

// use App\Lime\App as App;
// use Lime\DB\DB;

$app = new Lime\App();

// $app->path('views', __DIR__ . '../views');

$app->service("db", function () {
$db = new DB;
return $db;
});
/* ======================
// Posts
=======================*/

$app->bindClass(BlogController::class, 'api');

/* ======================
// Test
=======================*/
$app->get("/hello/:name", function ($params) {;
return "Hello" . " " . $params["name"];
});

$app->get("/", function () {

$data = array(
"name" => 'Test',
);

return $this->render("../views/layout.php", $data);
});

$app->run();

+ 40
- 0
backend/src/Controller/BlogController.php 查看文件

@@ -0,0 +1,40 @@
<?php

namespace App\Controller;

use Lime\App as App;

class BlogController
{

protected App $app;
protected $db;

public function __construct(App $app)
{
$this->app = $app;
}

public function getPosts()
{
$db = $this->app["db"];
$postsdb = new \App\DB\BlogDB($db);
$blogPosts = $postsdb->getPosts();
return $blogPosts;
}

public function addPost()
{

$data = json_decode(file_get_contents('php://input'));
if ($data !== NULL) {
$db = $this->app["db"];
$newPost = new \App\DB\BlogDB($db);
$newPost->addPost($data);

return "TRUE";
}

return "FALSE";
}
}

+ 100
- 0
backend/src/DB/BlogDB.php 查看文件

@@ -0,0 +1,100 @@
<?php

namespace App\DB;

use \App\DB\DB;

class BlogDB
{
protected $db;

public function __construct(DB $db)
{
$this->db = $db;
}

public function getPosts()
{
$posts = [];
$errors = [];
$postAmt = 0;

try {
$stmt = $this->db->prepare("SELECT COUNT (post_id) from posts");
$res = $stmt->execute();
if ($res) {
$row = $res->fetchArray(SQLITE3_ASSOC);
$arr = array_values($row);
$postAmt = $arr[0];
}
} catch (\Throwable $th) {
$errors[0] = $this->db->lastErrorMsg();
}

$sql = "SELECT * FROM posts";
$stmt = $this->db->prepare($sql);
$res = $stmt->execute();
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
$data[] = $row;
}
return $data;

// for ($x = 1; $x < $postAmt + 1; $x++) {


// $post_queries = [
// "post_content" => [
// "label" => 'post_content',
// "qry" => "SELECT post_content FROM posts where post_id IS $x"
// ],
// "post_author" => [
// "label" => 'post_author',
// "qry" => "SELECT post_author FROM posts where post_id IS $x"
// ],

// ];

// $post_catcher = [];

// foreach ($post_queries as $key => $value) {
// try {
// $stmt = $this->db->prepare($value['qry']);
// $res = $stmt->execute();

// if ($row = $res->fetchArray(SQLITE3_ASSOC)) {
// $post_catcher[$key] = $row[$key];
// };
// } catch (\Throwable $th) {
// $errors[$value[0]] = $this->db->lastErrorMsg();
// }
// }
// array_push($posts, $post_catcher);
// };

if (empty($errors)) {
return $posts;
} else {
return "false";
}
}

public function addPost($values)
{
try {
$sql = "INSERT INTO posts('post_content', 'post_author') VALUES(:postcontent, :postauthor);";
$stmt = $this->db->prepare($sql);
$stmt->bindValue(':postcontent', $values->content, SQLITE3_TEXT);
$stmt->bindValue(':postauthor', $values->author, SQLITE3_TEXT);

if ($stmt->execute()) {
return ['status' => true];
} else {
$error = $this->db->lastErrorMsg();
return ['status' => false, 'err' => $error];
}
} catch (\Throwable $th) {
$error = ['message' => $this->db->lastErrorMsg(), 'code' => $this->db->lastErrorCode()];
return ['status' => false, 'err' => $error];
}
}
}

+ 12
- 0
backend/src/DB/DB.php 查看文件

@@ -0,0 +1,12 @@
<?php

namespace App\DB;

class DB extends \SQLite3
{
public function __construct()
{
$this->open('../db/db_blog.db');
$this->exec("PRAGMA foreign_keys = ON");
}
}

+ 1749
- 0
backend/src/Lime/App.php
文件差異過大導致無法顯示
查看文件


+ 7
- 0
backend/vendor/autoload.php 查看文件

@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitffd428e2d55c80911fd4fd161f82590f::getLoader();

+ 479
- 0
backend/vendor/composer/ClassLoader.php 查看文件

@@ -0,0 +1,479 @@
<?php

/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Composer\Autoload;

/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
private $vendorDir;

// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();

// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();

private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;

private static $registeredLoaders = array();

public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}

public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}

return array();
}

public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}

public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}

public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}

public function getClassMap()
{
return $this->classMap;
}

/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}

/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}

return;
}

$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;

return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}

/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}

/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}

/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}

/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}

/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}

/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}

/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}

/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}

/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}

/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);

if (null === $this->vendorDir) {
return;
}

if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}

/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));

if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}

/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);

return true;
}
}

/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}

$file = $this->findFileWithExtension($class, '.php');

// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}

if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}

if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}

return $file;
}

/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}

private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}

// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}

// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}

if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}

// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}

// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}

return false;
}
}

/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

+ 283
- 0
backend/vendor/composer/InstalledVersions.php 查看文件

@@ -0,0 +1,283 @@
<?php











namespace Composer;

use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;






class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
'name' => 'aheinze/lime',
),
'versions' =>
array (
'aheinze/lime' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
),
),
);
private static $canGetVendors;
private static $installedByVendor = array();







public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}


if (1 === \count($packages)) {
return $packages[0];
}

return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}









public static function isInstalled($packageName)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return true;
}
}

return false;
}














public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));

return $provided->matches($constraint);
}










public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}

$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}

return implode(' || ', $ranges);
}

throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}





public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}

if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}

return $installed['versions'][$packageName]['version'];
}

throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}





public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}

if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}

return $installed['versions'][$packageName]['pretty_version'];
}

throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}





public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}

if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}

return $installed['versions'][$packageName]['reference'];
}

throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}





public static function getRootPackage()
{
$installed = self::getInstalled();

return $installed[0]['root'];
}







public static function getRawData()
{
return self::$installed;
}



















public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}




private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}

$installed = array();

if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
}
}
}

$installed[] = self::$installed;

return $installed;
}
}

+ 21
- 0
backend/vendor/composer/LICENSE 查看文件

@@ -0,0 +1,21 @@

Copyright (c) Nils Adermann, Jordi Boggiano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


+ 10
- 0
backend/vendor/composer/autoload_classmap.php 查看文件

@@ -0,0 +1,10 @@
<?php

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);

+ 10
- 0
backend/vendor/composer/autoload_namespaces.php 查看文件

@@ -0,0 +1,10 @@
<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
'Lime' => array($baseDir . '/src'),
);

+ 10
- 0
backend/vendor/composer/autoload_psr4.php 查看文件

@@ -0,0 +1,10 @@
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
'App\\' => array($baseDir . '/src'),
);

+ 57
- 0
backend/vendor/composer/autoload_real.php 查看文件

@@ -0,0 +1,57 @@
<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitffd428e2d55c80911fd4fd161f82590f
{
private static $loader;

public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}

/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInitffd428e2d55c80911fd4fd161f82590f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitffd428e2d55c80911fd4fd161f82590f', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInitffd428e2d55c80911fd4fd161f82590f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}

$loader->register(true);

return $loader;
}
}

+ 47
- 0
backend/vendor/composer/autoload_static.php 查看文件

@@ -0,0 +1,47 @@
<?php

// autoload_static.php @generated by Composer

namespace Composer\Autoload;

class ComposerStaticInitffd428e2d55c80911fd4fd161f82590f
{
public static $prefixLengthsPsr4 = array (
'A' =>
array (
'App\\' => 4,
),
);

public static $prefixDirsPsr4 = array (
'App\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);

public static $prefixesPsr0 = array (
'L' =>
array (
'Lime' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
),
);

public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);

public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitffd428e2d55c80911fd4fd161f82590f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitffd428e2d55c80911fd4fd161f82590f::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitffd428e2d55c80911fd4fd161f82590f::$prefixesPsr0;
$loader->classMap = ComposerStaticInitffd428e2d55c80911fd4fd161f82590f::$classMap;

}, null, ClassLoader::class);
}
}

+ 5
- 0
backend/vendor/composer/installed.json 查看文件

@@ -0,0 +1,5 @@
{
"packages": [],
"dev": true,
"dev-package-names": []
}

+ 24
- 0
backend/vendor/composer/installed.php 查看文件

@@ -0,0 +1,24 @@
<?php return array (
'root' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
'name' => 'aheinze/lime',
),
'versions' =>
array (
'aheinze/lime' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
),
),
);

+ 26
- 0
backend/vendor/composer/platform_check.php 查看文件

@@ -0,0 +1,26 @@
<?php

// platform_check.php @generated by Composer

$issues = array();

if (!(PHP_VERSION_ID >= 50600)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
}

if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

+ 13
- 0
backend/views/layout.php 查看文件

@@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html lang="en-US">

<head>
<meta charset="UTF-8">
<h2><?= $name ?></h2>
</head>

<body>

</body>

</html>

Loading…
取消
儲存