diff --git a/library/HTMLPurifier/AttrDef/URI/Host.php b/library/HTMLPurifier/AttrDef/URI/Host.php index 17a97c1ec..8057a2022 100644 --- a/library/HTMLPurifier/AttrDef/URI/Host.php +++ b/library/HTMLPurifier/AttrDef/URI/Host.php @@ -90,17 +90,13 @@ public function validate($string, $config, $context) } // PHP 5.3 and later support this functionality natively - if (function_exists('idn_to_ascii')) { - if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) { - $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); - } else { - $string = idn_to_ascii($string); - } + if (\function_exists('idn_to_ascii')) { + $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); // If we have Net_IDNA2 support, we can support IRIs by // punycoding them. (This is the most portable thing to do, // since otherwise we have to assume browsers support - } elseif ($config->get('Core.EnableIDNA') && class_exists('Net_IDNA2')) { + } elseif (class_exists('Net_IDNA2') && $config->get('Core.EnableIDNA') ) { $idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true)); // we need to encode each period separately $parts = explode('.', $string); diff --git a/library/HTMLPurifier/Bootstrap.php b/library/HTMLPurifier/Bootstrap.php index 8805eccff..ba68076cf 100644 --- a/library/HTMLPurifier/Bootstrap.php +++ b/library/HTMLPurifier/Bootstrap.php @@ -5,21 +5,6 @@ define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..')); } -// accommodations for versions earlier than 5.0.2 -// borrowed from PHP_Compat, LGPL licensed, by Aidan Lister -if (!defined('PHP_EOL')) { - switch (strtoupper(substr(PHP_OS, 0, 3))) { - case 'WIN': - define('PHP_EOL', "\r\n"); - break; - case 'DAR': - define('PHP_EOL', "\r"); - break; - default: - define('PHP_EOL', "\n"); - } -} - /** * Bootstrap class that contains meta-functionality for HTML Purifier such as * the autoload function. diff --git a/library/HTMLPurifier/Printer.php b/library/HTMLPurifier/Printer.php index 549e4cea1..e7b5c7256 100644 --- a/library/HTMLPurifier/Printer.php +++ b/library/HTMLPurifier/Printer.php @@ -169,14 +169,7 @@ protected function listify($array, $polite = false) */ protected function getClass($obj, $sec_prefix = '') { - static $five = null; - if ($five === null) { - $five = version_compare(PHP_VERSION, '5', '>='); - } $prefix = 'HTMLPurifier_' . $sec_prefix; - if (!$five) { - $prefix = strtolower($prefix); - } $class = str_replace($prefix, '', get_class($obj)); $lclass = strtolower($class); $class .= '('; diff --git a/tests/HTMLPurifier/PHPT/ze1_compatibility_mode.phpt b/tests/HTMLPurifier/PHPT/ze1_compatibility_mode.phpt deleted file mode 100644 index 606d7592e..000000000 --- a/tests/HTMLPurifier/PHPT/ze1_compatibility_mode.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Error with zend.ze1_compatibility_mode test ---PRESKIPIF-- -= 0) { - echo 'skip - ze1_compatibility_mode not present in PHP 5.3 or later'; -} ---INI-- -zend.ze1_compatibility_mode = 1 ---FILE-- -