From fd0679c388c137cda3b295e28ee1e7be295e3232 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Sat, 9 Feb 2013 12:58:33 +0000 Subject: [PATCH] Added a composer file, and removing class loaders. Former-commit-id: 02378c96fc3ae88ee910caf75cb2914f03f26b38 --- Core/Frameworks/Baikal/Core/ClassLoader.php | 65 -------------- .../BaikalAdmin/Core/ClassLoader.php | 65 -------------- Core/Frameworks/Flake/Core/ClassLoader.php | 85 ------------------- Core/Frameworks/Formal/Core/ClassLoader.php | 65 -------------- composer.json | 27 ++++++ 5 files changed, 27 insertions(+), 280 deletions(-) delete mode 100755 Core/Frameworks/Baikal/Core/ClassLoader.php delete mode 100755 Core/Frameworks/BaikalAdmin/Core/ClassLoader.php delete mode 100644 Core/Frameworks/Flake/Core/ClassLoader.php delete mode 100644 Core/Frameworks/Formal/Core/ClassLoader.php create mode 100644 composer.json diff --git a/Core/Frameworks/Baikal/Core/ClassLoader.php b/Core/Frameworks/Baikal/Core/ClassLoader.php deleted file mode 100755 index 8ef5c61..0000000 --- a/Core/Frameworks/Baikal/Core/ClassLoader.php +++ /dev/null @@ -1,65 +0,0 @@ - -# All rights reserved -# -# http://baikal.codr.fr -# -# This script is part of the Baïkal Server project. The Baïkal -# Server project is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This copyright notice MUST APPEAR in all copies of the script! -################################################################# - -namespace Baikal\Core; - -class ClassLoader { - - public static function register() { - return spl_autoload_register(array(__CLASS__, 'loadClass')); - } - - public static function loadClass($sFullClassName) { - - $aParts = explode("\\", $sFullClassName); - if(count($aParts) === 1) { - return; - } - - if($aParts[0] !== "Baikal") { - return; - } - - // ejecting the Radical - $sRadical = array_shift($aParts); - - if($sRadical === "Baikal") { - $sRootPath = BAIKAL_PATH_FRAMEWORKROOT; - } - - $sClassName = array_pop($aParts); - $sBasePath = $sRootPath . implode("/", $aParts) . "/"; - $sClassPath = $sBasePath . $sClassName . ".php"; - - if(file_exists($sClassPath) && is_readable($sClassPath)) { - require_once($sClassPath); - } else { - echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . '

'; - echo "
" . print_r(debug_backtrace(), TRUE) . "
"; - die(); - } - } -} diff --git a/Core/Frameworks/BaikalAdmin/Core/ClassLoader.php b/Core/Frameworks/BaikalAdmin/Core/ClassLoader.php deleted file mode 100755 index 8991618..0000000 --- a/Core/Frameworks/BaikalAdmin/Core/ClassLoader.php +++ /dev/null @@ -1,65 +0,0 @@ - -# All rights reserved -# -# http://baikal.codr.fr -# -# This script is part of the Baïkal Server project. The Baïkal -# Server project is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This copyright notice MUST APPEAR in all copies of the script! -################################################################# - -namespace BaikalAdmin\Core; - -class ClassLoader { - - public static function register() { - return spl_autoload_register(array(__CLASS__, 'loadClass')); - } - - public static function loadClass($sFullClassName) { - - $aParts = explode("\\", $sFullClassName); - if(count($aParts) === 1) { - return; - } - - if($aParts[0] !== "BaikalAdmin") { - return; - } - - // ejecting the Radical - $sRadical = array_shift($aParts); - - if($sRadical === "BaikalAdmin") { - $sRootPath = BAIKALADMIN_PATH_ROOT; - } - - $sClassName = array_pop($aParts); - $sBasePath = $sRootPath . implode("/", $aParts) . "/"; - $sClassPath = $sBasePath . $sClassName . ".php"; - - if(file_exists($sClassPath) && is_readable($sClassPath)) { - require_once($sClassPath); - } else { - echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . '

'; - echo "
" . print_r(debug_backtrace(), TRUE) . "
"; - die(); - } - } -} diff --git a/Core/Frameworks/Flake/Core/ClassLoader.php b/Core/Frameworks/Flake/Core/ClassLoader.php deleted file mode 100644 index a2a1105..0000000 --- a/Core/Frameworks/Flake/Core/ClassLoader.php +++ /dev/null @@ -1,85 +0,0 @@ - -# All rights reserved -# -# http://flake.codr.fr -# -# This script is part of the Flake project. The Flake -# project is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This copyright notice MUST APPEAR in all copies of the script! -################################################################# - -namespace Flake\Core; - -class ClassLoader { - - public static function register() { - return spl_autoload_register(array(__CLASS__, 'loadClass')); - } - - public static function loadClass($sFullClassName) { - - $sClassPath = FALSE; - - $aParts = explode("\\", $sFullClassName); - if(count($aParts) === 1) { - return; - } - - # Extracting the Radical - $sRadical = $aParts[0]; - - if(in_array($sRadical, array("Flake", "Specific", "Frameworks"))) { - - if($sRadical === "Flake") { - $sRootPath = FLAKE_PATH_ROOT; - } elseif($sRadical === "Specific") { - $sRootPath = FLAKE_PATH_SPECIFIC; - } else { - $sRootPath = PROJECT_PATH_FRAMEWORKS; - } - - # Stripping radical - array_shift($aParts); - - # Classname is the last part - $sClassName = array_pop($aParts); - - # Path to class - $sClassPath = $sRootPath . implode("/", $aParts) . "/" . $sClassName . ".php"; - - } elseif(count($aParts) > 1) { - if($aParts[1] === "Framework") { - # It must be a Flake Framework - $sClassPath = PROJECT_PATH_FRAMEWORKS . $sRadical . "/Framework.php"; - } - } - - if($sClassPath === FALSE) { - return; - } - - if(file_exists($sClassPath) && is_readable($sClassPath)) { - require_once($sClassPath); - } else { - echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . ' in ' . $sClassPath . '

'; - echo "
" . print_r(debug_backtrace(), TRUE) . "
"; - die(); - } - } -} diff --git a/Core/Frameworks/Formal/Core/ClassLoader.php b/Core/Frameworks/Formal/Core/ClassLoader.php deleted file mode 100644 index 55bb79b..0000000 --- a/Core/Frameworks/Formal/Core/ClassLoader.php +++ /dev/null @@ -1,65 +0,0 @@ - -# All rights reserved -# -# http://formal.codr.fr -# -# This script is part of the Formal project. The Formal -# project is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This copyright notice MUST APPEAR in all copies of the script! -################################################################# - -namespace Formal\Core; - -class ClassLoader { - - public static function register() { - return spl_autoload_register(array(__CLASS__, 'loadClass')); - } - - public static function loadClass($sFullClassName) { - - $aParts = explode("\\", $sFullClassName); - if(count($aParts) === 1) { - return; - } - - if($aParts[0] !== "Formal") { - return; - } - - // ejecting the Radical - $sRadical = array_shift($aParts); - - if($sRadical === "Formal") { - $sRootPath = FORMAL_PATH_ROOT; - } - - $sClassName = array_pop($aParts); - $sBasePath = $sRootPath . implode("/", $aParts) . "/"; - $sClassPath = $sBasePath . $sClassName . ".php"; - - if(file_exists($sClassPath) && is_readable($sClassPath)) { - require_once($sClassPath); - } else { - echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . '

'; - echo "
" . print_r(debug_backtrace(), TRUE) . "
"; - die(); - } - } -} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b8485d8 --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "jeromeschneider/baikal", + "description": "Baïkal is a lightweight CalDAV + CardDAV server based on PHP, SQLite and SabreDAV", + "keywords": ["Framework", "WebDAV", "CalDAV", "CardDAV", "iCalendar"], + "homepage": "http://code.google.com/p/sabredav/", + "license" : "GPL-3.0", + "authors": [ + { + "name": "Jérôme Schneider", + "email": "mail@jeromeschneider.fr", + "homepage" : "http://jerome.io", + "role" : "Developer" + } + ], + "require": { + "php" : ">=5.3.1", + "sabre/dav" : "1.8.*" + }, + "autoload": { + "psr-0" : { + "Baikal" : "Core/Frameworks/" + } + }, + "support" : { + "source" : "https://github.com/jeromeschneider/Baikal" + } +}