Added a composer file, and removing class loaders.

This commit is contained in:
Evert Pot 2013-02-09 12:58:33 +00:00
parent 451f9a79a7
commit 02378c96fc
5 changed files with 27 additions and 280 deletions

View file

@ -1,65 +0,0 @@
<?php
#################################################################
# Copyright notice
#
# (c) 2012 Jérôme Schneider <mail@jeromeschneider.fr>
# 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 '<h1>PHP Autoload Error. Cannot find ' . $sFullClassName . '</h1>';
echo "<pre>" . print_r(debug_backtrace(), TRUE) . "</pre>";
die();
}
}
}

View file

@ -1,65 +0,0 @@
<?php
#################################################################
# Copyright notice
#
# (c) 2012 Jérôme Schneider <mail@jeromeschneider.fr>
# 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 '<h1>PHP Autoload Error. Cannot find ' . $sFullClassName . '</h1>';
echo "<pre>" . print_r(debug_backtrace(), TRUE) . "</pre>";
die();
}
}
}

View file

@ -1,85 +0,0 @@
<?php
#################################################################
# Copyright notice
#
# (c) 2012 Jérôme Schneider <mail@jeromeschneider.fr>
# 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 '<h1>PHP Autoload Error. Cannot find ' . $sFullClassName . ' in ' . $sClassPath . '</h1>';
echo "<pre>" . print_r(debug_backtrace(), TRUE) . "</pre>";
die();
}
}
}

View file

@ -1,65 +0,0 @@
<?php
#################################################################
# Copyright notice
#
# (c) 2012 Jérôme Schneider <mail@jeromeschneider.fr>
# 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 '<h1>PHP Autoload Error. Cannot find ' . $sFullClassName . '</h1>';
echo "<pre>" . print_r(debug_backtrace(), TRUE) . "</pre>";
die();
}
}
}

27
composer.json Normal file
View file

@ -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"
}
}