commit 64531a001ae2115d22bf782711e491074244527f
parent 342724fffe38c5f2af006aac2dc182af3cdc935d
Author: finwo <finwo@pm.me>
Date: Fri, 18 Nov 2016 12:30:21 +0100
First skeleton
Diffstat:
7 files changed, 92 insertions(+), 27 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,6 +1 @@
-composer.phar
-/vendor/
-
-# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
-# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
-# composer.lock
+.idea
diff --git a/.gitmodules b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "vendor/Finwo/Framework"]
+ path = vendor/Finwo/Framework
+ url = git://github.com/finwo/php-framework.git
diff --git a/LICENSE b/LICENSE
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016 Robin Bron
-
-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.
diff --git a/config/autoload/.gitignore b/config/autoload/.gitignore
@@ -0,0 +1 @@
+*.local.php
diff --git a/vendor/Finwo/Framework b/vendor/Finwo/Framework
@@ -0,0 +1 @@
+Subproject commit 86ffdbd6015bfaea61ad6a1c9e5c9bd3306f1f4d
diff --git a/vendor/autoload.php b/vendor/autoload.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Class Autoloader
+ *
+ * Simple PSR-0 autoloader
+ */
+class Autoloader
+{
+ /**
+ * Holds the registered PSR-0 directories
+ *
+ * @var array
+ */
+ protected static $directories = array();
+
+ /**
+ * @param string $sourceFile
+ */
+ public static function init( $sourceFile = null )
+ {
+ // Make sure we have a source file
+ if (is_null($sourceFile)) {
+ $sourceFile = __DIR__ . DIRECTORY_SEPARATOR . 'psr0-directories.json';
+ }
+
+ // Fetch the registered paths
+ if (file_exists($sourceFile)) {
+ $directories = json_decode(file_get_contents($sourceFile));
+ foreach ($directories as $directory) {
+ self::register($directory);
+ }
+ unset($directory);
+ }
+ }
+
+ /**
+ * Register a (relative) path as PSR-0 directory
+ *
+ * @param $path
+ */
+ public static function register( $path )
+ {
+ // Handle relative paths
+ if (substr($path, 0, 1) !== DIRECTORY_SEPARATOR) {
+ $bt = debug_backtrace();
+ $bt = array_shift($bt);
+ $path = rtrim(realpath(dirname($bt['file']) . DIRECTORY_SEPARATOR . $path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
+ }
+
+ // Register the directory
+ self::$directories[]=$path;
+ }
+
+ /**
+ * @param string $className
+ */
+ public static function run($className)
+ {
+ // Build filename for class
+ $fileNames = array(
+ str_replace("\\", DIRECTORY_SEPARATOR, $className) . '.php',
+ str_replace("\\", DIRECTORY_SEPARATOR, strtolower($className)) . '.class.inc'
+ );
+
+ // Loop through directories & name types
+ foreach (self::$directories as $directory) {
+ foreach ($fileNames as $name) {
+ // Include & bail if the file exists
+ $filename = $directory . DIRECTORY_SEPARATOR . $name;
+ if (file_exists($filename)) {
+ include $filename;
+ return;
+ }
+ }
+ }
+ }
+}
+
+// Initialize the loader
+Autoloader::init();
+spl_autoload_register(array("\\Autoloader","run"));
diff --git a/vendor/psr0-directories.json b/vendor/psr0-directories.json
@@ -0,0 +1,4 @@
+[
+ "",
+ "../docs/modules/classes"
+]