PSR4 autoload (fixes #32)

This commit is contained in:
Pierre Rudloff 2015-10-29 20:43:43 +01:00
parent a0cec7bfcf
commit f85f07a77b
7 changed files with 16 additions and 12 deletions

View file

@ -10,9 +10,9 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
use Alltube\VideoDownload;
require_once 'common.php';
$smarty->assign('class', 'video');
require_once 'download.php';
if (isset($_GET["url"])) {
if (isset($_GET['audio'])) {
try {

View file

@ -11,7 +11,7 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
namespace Alltube;
/**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* Main class
@ -95,7 +95,7 @@ Class VideoDownload
$cmd, $result, $code
);
if ($code>0) {
throw new Exception(implode(PHP_EOL, $result));
throw new \Exception(implode(PHP_EOL, $result));
} else {
return json_decode($result[0]);
}
@ -120,7 +120,7 @@ Class VideoDownload
$cmd, $result, $code
);
if ($code>0) {
throw new Exception(implode(PHP_EOL, $result));
throw new \Exception(implode(PHP_EOL, $result));
} else {
return array('success'=>true, 'url'=>end($result));
}

View file

@ -39,5 +39,10 @@
"homepage": "https://rudloff.pro/",
"role": "Developer"
}
]
],
"autoload": {
"psr-4": {
"Alltube\\": "classes/"
}
}
}

2
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "3dbe1326b363d56d544801b87ad0ee5e",
"hash": "b211e248137ada7cd1babc6c880fc4c5",
"content-hash": "30052efb27250d4c6eb0a5bb39518987",
"packages": [
{

View file

@ -2,9 +2,9 @@
/**
* PHP web interface for youtube-dl (http://rg3.github.com/youtube-dl/)
* List of all supported websites
*
*
* PHP Version 5.3.10
*
*
* @category Youtube-dl
* @package Youtubedl
* @author Pierre Rudloff <contact@rudloff.pro>
@ -12,9 +12,9 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
use Alltube\VideoDownload;
require_once 'common.php';
$smarty->assign('class', 'extractors');
require_once 'download.php';
$smarty->display('head.tpl');
$smarty->display('header.tpl');
$smarty->display('logo.tpl');

View file

@ -11,8 +11,8 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
use Alltube\VideoDownload;
require_once 'common.php';
require_once 'download.php';
if (isset($_GET["url"])) {
header('Content-Type: application/json');
try {

View file

@ -10,9 +10,8 @@
* @license GNU General Public License http://www.gnu.org/licenses/gpl.html
* @link http://rudloff.pro
* */
use Alltube\VideoDownload;
require_once __DIR__.'/../common.php';
require_once __DIR__.'/../download.php';
/**
* Unit tests for the VideoDownload class