Ignore php.ini
[xhtml-compiler.git] / common.php
blob069ab3b0d7c9576169eb86ff3a40f793a6a161ef
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);
9 define('XHTMLCOMPILER', dirname(__FILE__));
11 require_once 'functions.php';
13 require_once 'XHTMLCompiler.php';
15 require_once 'XHTMLCompiler/PHP.php';
16 require_once 'XHTMLCompiler/Exception.php';
18 require_once 'XHTMLCompiler/Page.php';
19 require_once 'XHTMLCompiler/File.php';
20 require_once 'XHTMLCompiler/Directory.php';
22 require_once 'XHTMLCompiler/RSSFeed.php';
24 require_once 'XHTMLCompiler/Filter.php';
25 require_once 'XHTMLCompiler/FilterManager.php';
26 require_once 'XHTMLCompiler/TextFilter.php';
27 require_once 'XHTMLCompiler/DOMFilter.php';
28 require_once 'XHTMLCompiler/DOMFilter/NewsBase.php';
30 // needed for error reporting
31 require_once 'external/swiftmailer/lib/swift_required.php';
33 set_exception_handler('xhtmlcompiler_exception_handler');
34 $xc = XHTMLCompiler::getInstance(); // invoke the super-object
36 check_errors();
37 register_shutdown_function('check_errors');
39 ini_set('display_errors', false);
40 ini_set('log_errors', true);
41 ini_set('error_log', dirname(__FILE__) . '/errors.log');
43 if($xc->getConf('debug')) {
44 restore_error_handler();
45 ini_set('display_errors', true);
48 // set working directory to parent directory (slightly hacky)
49 // if we want this to be able to be included in other apps,
50 // this must be removed
51 chdir( dirname(__FILE__) . '/..' );
53 require_once 'external/phpgit/library/Git.php';
54 require_once 'external/htmlpurifier/library/HTMLPurifier.auto.php';
55 require_once 'external/htmlpurifier/extras/HTMLPurifierExtras.auto.php';
57 // load Doctrine
58 require_once 'external/doctrine/lib/Doctrine.php';
59 spl_autoload_register(array('Doctrine', 'autoload'));
61 Doctrine::loadModels(dirname(__FILE__) . '/models/generated');
62 Doctrine::loadModels(dirname(__FILE__) . '/models');
64 Doctrine_Manager::connection($xc->getConf('dsn'));