c3612316e1c1dd1b7bee24be7803eb6a252b40fe
[xhtml-compiler.git] / common.php
blobc3612316e1c1dd1b7bee24be7803eb6a252b40fe
1 <?php
3 if (!version_compare(PHP_VERSION, "5", ">=")) exit('Requires PHP 5.');
5 // setup our error reporting, ideally this would be in php.ini but shared
6 // hosting environment requires a little more flexibility.
7 error_reporting(E_STRICT | E_ALL);
8 ini_set('display_errors', false);
9 ini_set('log_errors', true);
10 ini_set('error_log', dirname(__FILE__) . '/errors.log');
12 // set working directory to parent directory (slightly hacky)
13 // if we want this to be able to be included in other apps,
14 // this must be removed
15 chdir( dirname(__FILE__) . '/../');
17 require_once 'functions.php';
19 require_once 'XHTMLCompiler.php';
21 require_once 'XHTMLCompiler/PHP.php';
22 require_once 'XHTMLCompiler/Exception.php';
24 require_once 'XHTMLCompiler/Page.php';
25 require_once 'XHTMLCompiler/File.php';
26 require_once 'XHTMLCompiler/Directory.php';
28 require_once 'XHTMLCompiler/RSSFeed.php';
30 require_once 'XHTMLCompiler/Filter.php';
31 require_once 'XHTMLCompiler/FilterManager.php';
32 require_once 'XHTMLCompiler/TextFilter.php';
33 require_once 'XHTMLCompiler/DOMFilter.php';
34 require_once 'XHTMLCompiler/DOMFilter/NewsBase.php';
36 // needed for error reporting
37 require_once 'external/swiftmailer/lib/swift_required.php';
39 set_exception_handler('xhtmlcompiler_exception_handler');
40 $xc = XHTMLCompiler::getInstance(); // invoke the super-object
41 check_errors();
42 register_shutdown_function('check_errors');
43 if($xc->getConf('debug')) {
44 restore_error_handler();
45 ini_set('display_errors', true);
48 require_once 'external/phpgit/library/Git.php';
49 require_once 'external/htmlpurifier/library/HTMLPurifier.auto.php';
50 require_once 'external/htmlpurifier/extras/HTMLPurifierExtras.auto.php';
52 // load Doctrine
53 require_once 'external/doctrine/lib/Doctrine.php';
54 spl_autoload_register(array('Doctrine', 'autoload'));
56 Doctrine::loadModels('xhtml-compiler/models/generated');
57 Doctrine::loadModels('xhtml-compiler/models');
59 Doctrine_Manager::connection($xc->getConf('dsn'));