Permalink
Browse files

Autoload vendor classes.

  • Loading branch information...
1 parent 95fd133 commit 0a72c4b6e7ac79216a9c9ee38a9c58d55f1997f0 @davidpersson committed Feb 9, 2013
Showing with 11 additions and 5 deletions.
  1. +11 −1 bootstrap.php
  2. +0 −4 src/Markdown.php
View
@@ -13,8 +13,18 @@
*/
spl_autoload_register(function($class) {
+ $irregular = array(
+ 'MarkdownExtra_Parser' => 'lib/markdown_extra',
+ 'SmartyPants_Parser' => 'lib/smartypants.php',
+ 'MarkdownExtraExtended_Parser' => 'lib/markdown_extra_extended.php'
+ );
+ if (isset($irregular[$class])) {
+ require __DIR__ . '/' . $irregular[$class];
+ return;
+ }
+
if (strpos($class, 'markup') === false) {
- return false;
+ return;
}
$name = str_replace('markup\\', '', $class);
$name = str_replace('\\', '/', $name);
View
@@ -14,10 +14,6 @@
namespace markup;
-require_once dirname(__DIR__) . '/lib/markdown_extra.php';
-require_once dirname(__DIR__) . '/lib/smartypants.php';
-require_once dirname(__DIR__) . '/lib/markdown_extra_extended.php';
-
use MarkdownExtra_Parser;
use SmartyPants_Parser;
use MarkdownExtraExtended_Parser;

0 comments on commit 0a72c4b

Please sign in to comment.