mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Numerous documentation and test code fixes for HTML Purifier loading
- Improve documentation for stub files - Synchronize stub files between extras/ and library/ - Remove unnecessary include in function file - Remove special treatment of Bootstrap - Improve docs for HTMLPurifier, converted singleton to use static member variables and removed reference - Add HTMLPurifier.path.php stub file - Update sample test settings - Reorganize includes in test files git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1559 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
HTMLPurifier.auto.php and HTMLPurifier.includes.php loading test
|
||||
--FILE--
|
||||
<?php
|
||||
require_once '../library/HTMLPurifier.auto.php';
|
||||
require_once '../library/HTMLPurifier.path.php';
|
||||
require_once 'HTMLPurifier.includes.php';
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$purifier = new HTMLPurifier($config);
|
||||
|
10
tests/HTMLPurifier/PHPT/loading/standalone.phpt
Normal file
10
tests/HTMLPurifier/PHPT/loading/standalone.phpt
Normal file
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
HTMLPurifier.standalone.php loading test
|
||||
--FILE--
|
||||
<?php
|
||||
require_once '../library/HTMLPurifier.standalone.php';
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$purifier = new HTMLPurifier($config);
|
||||
echo $purifier->purify('<b>Salsa!');
|
||||
--EXPECT--
|
||||
<b>Salsa!</b>
|
@@ -134,8 +134,8 @@ alert("<This is compatible with XHTML>");
|
||||
}
|
||||
|
||||
function testGetInstance() {
|
||||
$purifier =& HTMLPurifier::getInstance();
|
||||
$purifier2 =& HTMLPurifier::getInstance();
|
||||
$purifier = HTMLPurifier::getInstance();
|
||||
$purifier2 = HTMLPurifier::getInstance();
|
||||
$this->assertReference($purifier, $purifier2);
|
||||
}
|
||||
|
||||
|
@@ -9,10 +9,10 @@ if (!defined('HTMLPurifierTest')) {
|
||||
// is not allowed
|
||||
function __autoload($class) {
|
||||
if (!function_exists('spl_autoload_register')) {
|
||||
if (HTMLPurifier_Bootstrap::autoload($class)) return true;
|
||||
if (HTMLPurifierExtras::autoload($class)) return true;
|
||||
if (class_exists('HTMLPurifier_Bootstrap', false) && HTMLPurifier_Bootstrap::autoload($class)) return true;
|
||||
if (class_exists('HTMLPurifierExtras', false) && HTMLPurifierExtras::autoload($class)) return true;
|
||||
}
|
||||
require_once str_replace('_', '/', $class) . '.php';
|
||||
require str_replace('_', '/', $class) . '.php';
|
||||
return true;
|
||||
}
|
||||
if (function_exists('spl_autoload_register')) {
|
||||
@@ -36,16 +36,15 @@ if (file_exists('../conf/test-settings.php')) include '../conf/test-settings.php
|
||||
if (file_exists('../test-settings.php')) include '../test-settings.php';
|
||||
|
||||
// load SimpleTest
|
||||
require_once $simpletest_location . 'unit_tester.php';
|
||||
require_once $simpletest_location . 'reporter.php';
|
||||
require_once $simpletest_location . 'mock_objects.php';
|
||||
require_once $simpletest_location . 'xml.php';
|
||||
require_once $simpletest_location . 'remote.php';
|
||||
require $simpletest_location . 'unit_tester.php';
|
||||
require $simpletest_location . 'reporter.php';
|
||||
require $simpletest_location . 'mock_objects.php';
|
||||
require $simpletest_location . 'xml.php';
|
||||
require $simpletest_location . 'remote.php';
|
||||
|
||||
// load CSS Tidy
|
||||
if ($csstidy_location !== false) {
|
||||
require_once $csstidy_location . 'class.csstidy.php';
|
||||
require_once $csstidy_location . 'class.csstidy_print.php';
|
||||
require $csstidy_location . 'class.csstidy.php';
|
||||
}
|
||||
|
||||
// load PEAR to include path
|
||||
@@ -58,16 +57,13 @@ if ( is_string($GLOBALS['HTMLPurifierTest']['PEAR']) ) {
|
||||
// after external libraries are loaded, turn on compile time errors
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// initialize HTML Purifier
|
||||
require_once '../library/HTMLPurifier.auto.php';
|
||||
|
||||
// initialize alternative classes
|
||||
require_once '../extras/HTMLPurifierExtras.auto.php';
|
||||
// initialize extra HTML Purifier libraries
|
||||
require '../extras/HTMLPurifierExtras.auto.php';
|
||||
|
||||
// load SimpleTest addon functions
|
||||
require_once 'generate_mock_once.func.php';
|
||||
require_once 'path2class.func.php';
|
||||
require_once 'tally_errors.func.php'; // compat
|
||||
require 'generate_mock_once.func.php';
|
||||
require 'path2class.func.php';
|
||||
require 'tally_errors.func.php'; // compat
|
||||
|
||||
/**
|
||||
* Arguments parser, is cli and web agnostic.
|
||||
|
@@ -17,7 +17,7 @@ define('HTMLPurifierTest', 1);
|
||||
define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas
|
||||
chdir(dirname(__FILE__));
|
||||
|
||||
require_once 'common.php';
|
||||
require 'common.php';
|
||||
|
||||
$AC = array(); // parameters
|
||||
$AC['flush'] = false;
|
||||
@@ -60,11 +60,13 @@ if ($AC['flush']) shell_exec($AC['php'] . ' ../maintenance/flush-definition-cach
|
||||
if ($AC['standalone']) {
|
||||
// :TODO: This line is pretty important; please document!
|
||||
set_include_path(realpath('../library/standalone') . PATH_SEPARATOR . realpath('blanks') . PATH_SEPARATOR . get_include_path());
|
||||
require_once '../library/HTMLPurifier.standalone.php';
|
||||
require '../library/HTMLPurifier.standalone.php';
|
||||
} else {
|
||||
require_once 'HTMLPurifier.includes.php';
|
||||
require '../library/HTMLPurifier.path.php';
|
||||
require 'HTMLPurifier.includes.php';
|
||||
require '../library/HTMLPurifier.autoload.php';
|
||||
}
|
||||
require_once 'HTMLPurifier/Harness.php';
|
||||
require 'HTMLPurifier/Harness.php';
|
||||
|
||||
// setup special DefinitionCacheFactory decorator
|
||||
$factory =& HTMLPurifier_DefinitionCacheFactory::instance();
|
||||
|
Reference in New Issue
Block a user