From: Tim Düsterhus Date: Mon, 12 Mar 2012 21:50:09 +0000 (+0100) Subject: Prevent constructing of Util classes. X-Git-Tag: 2.0.0_Beta_1~1243^2^2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1828478932594ab7abf42c9873bc52f98e49b56a;p=GitHub%2FWoltLab%2FWCF.git Prevent constructing of Util classes. --- diff --git a/wcfsetup/install/files/lib/util/ArrayUtil.class.php b/wcfsetup/install/files/lib/util/ArrayUtil.class.php index 96ea49c5e9..b20e419090 100644 --- a/wcfsetup/install/files/lib/util/ArrayUtil.class.php +++ b/wcfsetup/install/files/lib/util/ArrayUtil.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class ArrayUtil { +final class ArrayUtil { /** * Applies StringUtil::trim() to all elements of an array. * @@ -154,4 +154,6 @@ class ArrayUtil { return $array; } } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/ClassUtil.class.php b/wcfsetup/install/files/lib/util/ClassUtil.class.php index 9232ad46f5..ffc9d2010c 100644 --- a/wcfsetup/install/files/lib/util/ClassUtil.class.php +++ b/wcfsetup/install/files/lib/util/ClassUtil.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class ClassUtil { +final class ClassUtil { /** * Checks whether the given objects are equal. * Objects are considered equal, when they are instances of the same class and all attributes are equal. @@ -47,4 +47,6 @@ class ClassUtil { return false; } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/CronjobUtil.class.php b/wcfsetup/install/files/lib/util/CronjobUtil.class.php index 52835ce3c7..ef3b04910e 100644 --- a/wcfsetup/install/files/lib/util/CronjobUtil.class.php +++ b/wcfsetup/install/files/lib/util/CronjobUtil.class.php @@ -14,7 +14,7 @@ use wcf\system\exception\SystemException; * @subpackage util * @category Community Framework */ -abstract class CronjobUtil { +final class CronjobUtil { /** * indicates if day of month is restricted (not '*') * @var boolean @@ -573,4 +573,6 @@ abstract class CronjobUtil { } } } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/DateUtil.class.php b/wcfsetup/install/files/lib/util/DateUtil.class.php index 7cfb2fd378..081c5b2c7b 100644 --- a/wcfsetup/install/files/lib/util/DateUtil.class.php +++ b/wcfsetup/install/files/lib/util/DateUtil.class.php @@ -14,7 +14,7 @@ use wcf\system\WCF; * @subpackage util * @category Community Framework */ -class DateUtil { +final class DateUtil { /** * name of the default date format language variable * @var string @@ -275,4 +275,6 @@ class DateUtil { return 0; } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php index cfcef66fbd..0a8f66242a 100644 --- a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php +++ b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php @@ -14,7 +14,7 @@ use wcf\system\Regex; * @subpackage util * @category Community Framework */ -class DirectoryUtil { +final class DirectoryUtil { /** * @var \DirectoryIterator */ diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index b3ec1b0357..052874817f 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -16,7 +16,7 @@ use wcf\system\WCF; * @subpackage util * @category Community Framework */ -class FileUtil { +final class FileUtil { /** * finfo instance * @var \finfo @@ -618,4 +618,6 @@ class FileUtil { return self::$finfo->file($filename); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index 1278681120..b3b2bc0795 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -12,7 +12,7 @@ use wcf\system\WCF; * @subpackage util * @category Community Framework */ -class HeaderUtil { +final class HeaderUtil { /** * alias to php setcookie() function */ @@ -124,4 +124,6 @@ class HeaderUtil { )); WCF::getTPL()->display('redirect'); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/ImageUtil.class.php b/wcfsetup/install/files/lib/util/ImageUtil.class.php index 045291e1a8..f86bcb3ea6 100644 --- a/wcfsetup/install/files/lib/util/ImageUtil.class.php +++ b/wcfsetup/install/files/lib/util/ImageUtil.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class ImageUtil { +final class ImageUtil { /** * Checks the content of an image for bad sections. * e.g. the use of javascript. @@ -53,4 +53,6 @@ class ImageUtil { default: return ''; } } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/JSON.class.php b/wcfsetup/install/files/lib/util/JSON.class.php index 4b7f5db5a3..22d58becc4 100644 --- a/wcfsetup/install/files/lib/util/JSON.class.php +++ b/wcfsetup/install/files/lib/util/JSON.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class JSON { +final class JSON { /** * Returns the JSON representation of a value. * @@ -44,4 +44,6 @@ class JSON { public static function getLastError() { return json_last_error(); } + + private function __construct() { } } \ No newline at end of file diff --git a/wcfsetup/install/files/lib/util/MathUtil.class.php b/wcfsetup/install/files/lib/util/MathUtil.class.php index 67f85f097f..c5472980b4 100644 --- a/wcfsetup/install/files/lib/util/MathUtil.class.php +++ b/wcfsetup/install/files/lib/util/MathUtil.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class MathUtil { +final class MathUtil { /** * Generates a random value. * @@ -23,4 +23,6 @@ class MathUtil { // generate random value return (($min !== null && $max !== null) ? mt_rand($min, $max) : mt_rand()); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/OptionUtil.class.php b/wcfsetup/install/files/lib/util/OptionUtil.class.php index 0c312555c0..5eef00a52d 100644 --- a/wcfsetup/install/files/lib/util/OptionUtil.class.php +++ b/wcfsetup/install/files/lib/util/OptionUtil.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class OptionUtil { +final class OptionUtil { /** * Returns a list of the available options. * @@ -63,4 +63,6 @@ class OptionUtil { return $result; } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/StringStack.class.php b/wcfsetup/install/files/lib/util/StringStack.class.php index dee985cd61..84ee7397b9 100644 --- a/wcfsetup/install/files/lib/util/StringStack.class.php +++ b/wcfsetup/install/files/lib/util/StringStack.class.php @@ -11,7 +11,7 @@ namespace wcf\util; * @subpackage util * @category Community Framework */ -class StringStack { +final class StringStack { protected static $stringStack = array(); /** @@ -66,4 +66,6 @@ class StringStack { return array(); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 0cd095b4b5..95d9cb507f 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -12,7 +12,7 @@ use wcf\system\WCF; * @subpackage util * @category Community Framework */ -class StringUtil { +final class StringUtil { const HTML_PATTERN = '~] @@ -553,4 +553,6 @@ class StringUtil { return str_shuffle($password); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/StyleUtil.class.php b/wcfsetup/install/files/lib/util/StyleUtil.class.php index 978ccd4b64..3db941a916 100644 --- a/wcfsetup/install/files/lib/util/StyleUtil.class.php +++ b/wcfsetup/install/files/lib/util/StyleUtil.class.php @@ -12,7 +12,7 @@ use wcf\system\io\File; * @subpackage util * @category Community Framework */ -class StyleUtil { +final class StyleUtil { /** * Converts css code from LTR to RTL. * @@ -159,4 +159,6 @@ class StyleUtil { $file->close(); @chmod(WCF_DIR . 'acp/style/style-rtl.css', 0777); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/UserUtil.class.php b/wcfsetup/install/files/lib/util/UserUtil.class.php index bb562d50f9..55e8114f56 100644 --- a/wcfsetup/install/files/lib/util/UserUtil.class.php +++ b/wcfsetup/install/files/lib/util/UserUtil.class.php @@ -12,7 +12,7 @@ use wcf\system\WCF; * @subpackage util * @category Community Framework */ -class UserUtil { +final class UserUtil { protected static $privateIpList = array("/^0\./", "/^127\.0\.0\.1/", "/^192\.168\..*/", "/^172\.16\..*/", "/^10..*/", "/^224..*/", "/^240..*/"); /** @@ -182,4 +182,6 @@ class UserUtil { return StringUtil::substring(FileUtil::unifyDirSeperator($REQUEST_URI), 0, 255); } + + private function __construct() { } } diff --git a/wcfsetup/install/files/lib/util/XML.class.php b/wcfsetup/install/files/lib/util/XML.class.php index fb295b5b4c..9bf019dae3 100644 --- a/wcfsetup/install/files/lib/util/XML.class.php +++ b/wcfsetup/install/files/lib/util/XML.class.php @@ -12,7 +12,7 @@ use wcf\system\exception\SystemException; * @subpackage util * @category Community Framework */ -class XML { +final class XML { /** * DOMDocument object * @var \DOMDocument @@ -39,7 +39,7 @@ class XML { /** * Prepares a new instance of DOMDocument and enables own error handler for libxml. - */ + */ public function __construct() { libxml_use_internal_errors(true); $this->document = new \DOMDocument('1.0', 'UTF-8');