Switch to composer

This commit is contained in:
Frédéric Guillot
2014-11-04 21:33:05 -05:00
parent 850645dd6b
commit 135b921db7
288 changed files with 26 additions and 33663 deletions

View File

@@ -2,8 +2,6 @@
namespace Auth;
require __DIR__.'/../../vendor/OAuth/bootstrap.php';
use Core\Request;
use OAuth\Common\Storage\Session;
use OAuth\Common\Consumer\Credentials;

View File

@@ -2,8 +2,6 @@
namespace Auth;
require __DIR__.'/../../vendor/OAuth/bootstrap.php';
use Core\Request;
use OAuth\Common\Storage\Session;
use OAuth\Common\Consumer\Credentials;

View File

@@ -1,62 +0,0 @@
<?php
namespace Core;
/**
* Loader class
*
* @package core
* @author Frederic Guillot
*/
class Loader
{
/**
* List of paths
*
* @access private
* @var array
*/
private $paths = array();
/**
* Load the missing class
*
* @access public
* @param string $class Class name with namespace
*/
public function load($class)
{
foreach ($this->paths as $path) {
$filename = $path.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($filename)) {
require $filename;
break;
}
}
}
/**
* Register the autoloader
*
* @access public
*/
public function execute()
{
spl_autoload_register(array($this, 'load'));
}
/**
* Register a new path
*
* @access public
* @param string $path Path
* @return Core\Loader
*/
public function setPath($path)
{
$this->paths[] = $path;
return $this;
}
}

View File

@@ -2,17 +2,7 @@
// Common file between cli and web interface
require __DIR__.'/Core/Loader.php';
require __DIR__.'/helpers.php';
require __DIR__.'/functions.php';
use Core\Loader;
use Core\Registry;
// Include password_compat for PHP < 5.5
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
require __DIR__.'/../vendor/password.php';
}
require 'vendor/autoload.php';
// Include custom config file
if (file_exists('config.php')) {
@@ -21,12 +11,7 @@ if (file_exists('config.php')) {
require __DIR__.'/constants.php';
$loader = new Loader;
$loader->setPath('app');
$loader->setPath('vendor');
$loader->execute();
$registry = new Registry;
$registry = new Core\Registry;
$registry->db = setup_db();
$registry->event = setup_events();
$registry->mailer = function() { return setup_mailer(); };

View File

@@ -35,8 +35,6 @@ function setup_events()
*/
function setup_mailer()
{
require_once __DIR__.'/../vendor/swiftmailer/swift_required.php';
switch (MAIL_TRANSPORT) {
case 'smtp':
$transport = Swift_SmtpTransport::newInstance(MAIL_SMTP_HOSTNAME, MAIL_SMTP_PORT);