'file', ); htmlpurifier_parse_args($AC, $aliases); // clean out cache if necessary if ($AC['flush']) shell_exec('php ../maintenance/flush-definition-cache.php'); // setup our own autoload for earlier PHP versions if (!function_exists('spl_autoload_register')) { function __autoload($class) { return // we're using the fact that once one OR is true, the rest is skipped HTMLPurifier_Bootstrap::autoload($class) || HTMLPurifierExtras::autoload($class); } } // initialize and load alternative classes require_once '../extras/HTMLPurifierExtras.auto.php'; // initialize and load HTML Purifier // use ?standalone to load the alterative standalone stub if ($AC['standalone']) { set_include_path(realpath('../library/standalone') . PATH_SEPARATOR . realpath('blanks') . PATH_SEPARATOR . get_include_path()); require_once '../library/HTMLPurifier.standalone.php'; } else { set_include_path(realpath('../library') . PATH_SEPARATOR . get_include_path() ); require_once 'HTMLPurifier.auto.php'; require_once 'HTMLPurifier.includes.php'; } require_once 'HTMLPurifier/Harness.php'; // setup special DefinitionCacheFactory decorator $factory =& HTMLPurifier_DefinitionCacheFactory::instance(); $factory->addDecorator('Memory'); // since we deal with a lot of config objects // load tests $test_files = array(); require 'test_files.php'; // populates $test_files array sort($test_files); // for the SELECT $GLOBALS['HTMLPurifierTest']['Files'] = $test_files; // for the reporter $test_file_lookup = array_flip($test_files); // determine test file if ($AC['file']) { if (!isset($test_file_lookup[$AC['file']])) { echo "Invalid file passed\n"; exit; } } // we can't use addTestFile because SimpleTest chokes on E_STRICT warnings if ($AC['file']) { $test = new TestSuite($AC['file']); require_once $AC['file']; $test->addTestClass(path2class($AC['file'])); } else { $standalone = ''; if ($AC['standalone']) $standalone = ' (standalone)'; $test = new TestSuite('All HTML Purifier tests on PHP ' . PHP_VERSION . $standalone); foreach ($test_files as $test_file) { require_once $test_file; $test->addTestClass(path2class($test_file)); } } if ($AC['xml']) { if (!SimpleReporter::inCli()) header('Content-Type: text/xml;charset=UTF-8'); $reporter = new XmlReporter(); } elseif (SimpleReporter::inCli()) { $reporter = new TextReporter(); } else { $reporter = new HTMLPurifier_SimpleTest_Reporter('UTF-8', $AC); } if ($AC['dry']) $reporter->makeDry(); $test->run($reporter);