diff --git a/composer.json b/composer.json index 6bde779989852..905e1614efdea 100644 --- a/composer.json +++ b/composer.json @@ -10,12 +10,14 @@ }, "require": { "php": ">=5.3.10", - "joomla/application": "~1.2", + "joomla/application": "~1.4", "joomla/di": "~1.2", - "joomla/registry": "~1.2", - "joomla/string": "~1.2", + "joomla/event": "~1.1", + "joomla/registry": "~1.4 >=1.4.5", + "joomla/session": "~1.2", + "joomla/string": "~1.3", "joomla/uri": "~1.1", - "joomla/utilities": "~1.3", + "joomla/utilities": "~1.3 >=1.3.3", "ircmaxell/password-compat": "1.*", "leafo/lessphp": "0.3.9", "phpmailer/phpmailer": "5.2.9", diff --git a/composer.lock b/composer.lock index 851ef2c8e375c..9de6606e5d5e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "385d58b11d816b21d0484b902310db7e", + "hash": "a305fbfdb073d809dbff32a3210e110f", "packages": [ { "name": "ircmaxell/password-compat", @@ -50,32 +50,35 @@ }, { "name": "joomla/application", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/application.git", - "reference": "b7745273664294387bdd7fb694d75e65b7491f28" + "reference": "185b68fe55537281385b637a90e11856ea01c8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/application/zipball/b7745273664294387bdd7fb694d75e65b7491f28", - "reference": "b7745273664294387bdd7fb694d75e65b7491f28", + "url": "https://api.github.com/repos/joomla-framework/application/zipball/185b68fe55537281385b637a90e11856ea01c8da", + "reference": "185b68fe55537281385b637a90e11856ea01c8da", "shasum": "" }, "require": { "joomla/input": "~1.2", "joomla/registry": "~1.1", - "joomla/session": "~1.1", - "joomla/string": "~1.1", - "joomla/uri": "~1.1", "php": ">=5.3.10", "psr/log": "~1.0" }, "require-dev": { + "joomla/session": "~1.1", "joomla/test": "~1.1", + "joomla/uri": "~1.1", "phpunit/phpunit": "4.*", "squizlabs/php_codesniffer": "1.*" }, + "suggest": { + "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", + "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + }, "type": "joomla-package", "extra": { "branch-alias": { @@ -99,7 +102,7 @@ "framework", "joomla" ], - "time": "2014-10-13 12:43:54" + "time": "2015-03-06 17:37:01" }, { "name": "joomla/compat", @@ -325,21 +328,21 @@ }, { "name": "joomla/registry", - "version": "1.4.4", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "730467978ad52677903e973bb33be2306eb161eb" + "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/730467978ad52677903e973bb33be2306eb161eb", - "reference": "730467978ad52677903e973bb33be2306eb161eb", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/4f926ba961ca45eb95076a1598c3ae689cb02fc5", + "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5", "shasum": "" }, "require": { "joomla/compat": "~1.0", - "joomla/string": "~1.2", + "joomla/string": "~1.3", "joomla/utilities": "~1.0", "php": ">=5.3.10" }, @@ -375,7 +378,7 @@ "joomla", "registry" ], - "time": "2015-03-16 18:49:29" + "time": "2015-03-28 17:54:38" }, { "name": "joomla/session", @@ -424,16 +427,16 @@ }, { "name": "joomla/string", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/string.git", - "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692" + "reference": "0df8ead8c726a1f648e624d3bcbef8cf05c1d0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/string/zipball/9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", - "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", + "url": "https://api.github.com/repos/joomla-framework/string/zipball/0df8ead8c726a1f648e624d3bcbef8cf05c1d0da", + "reference": "0df8ead8c726a1f648e624d3bcbef8cf05c1d0da", "shasum": "" }, "require": { @@ -467,7 +470,7 @@ "joomla", "string" ], - "time": "2015-03-13 12:29:00" + "time": "2015-03-26 01:02:20" }, { "name": "joomla/uri", @@ -508,20 +511,20 @@ }, { "name": "joomla/utilities", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/joomla-framework/utilities.git", - "reference": "2e7f37a69162fea02059c764a318a920121f8b4a" + "reference": "3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/2e7f37a69162fea02059c764a318a920121f8b4a", - "reference": "2e7f37a69162fea02059c764a318a920121f8b4a", + "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4", + "reference": "3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4", "shasum": "" }, "require": { - "joomla/string": "~1.0", + "joomla/string": "~1.3", "php": ">=5.3.10" }, "require-dev": { @@ -551,7 +554,7 @@ "joomla", "utilities" ], - "time": "2015-03-16 18:50:58" + "time": "2015-03-28 17:52:43" }, { "name": "leafo/lessphp", diff --git a/libraries/joomla/string/string.php b/libraries/joomla/string/string.php index 2d06d771097ff..526c2e4102888 100644 --- a/libraries/joomla/string/string.php +++ b/libraries/joomla/string/string.php @@ -9,7 +9,7 @@ defined('JPATH_PLATFORM') or die; -use Joomla\String\String; +use Joomla\String\StringHelper; /** * String handling class for utf-8 data @@ -17,9 +17,9 @@ * All functions assume the validity of utf-8 strings. * * @since 11.1 - * @deprecated 4.0 Use {@link \Joomla\String\String} instead unless otherwise noted. + * @deprecated 4.0 Use {@link \Joomla\String\StringHelper} instead unless otherwise noted. */ -abstract class JString extends String +abstract class JString extends StringHelper { /** * Split a string in camel case format diff --git a/libraries/vendor/autoload.php b/libraries/vendor/autoload.php index baecd9740292a..4cc388d9f7229 100644 --- a/libraries/vendor/autoload.php +++ b/libraries/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7::getLoader(); +return ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa::getLoader(); diff --git a/libraries/vendor/composer/autoload_real.php b/libraries/vendor/composer/autoload_real.php index 60bdad1198a32..024522060c11a 100644 --- a/libraries/vendor/composer/autoload_real.php +++ b/libraries/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7 +class ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitf9aed076f12471aff0049364a504b3f7', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ public static function getLoader() $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequiref9aed076f12471aff0049364a504b3f7($file); + composerRequire0efb534ee20646bcb987f4359c38b3aa($file); } return $loader; } } -function composerRequiref9aed076f12471aff0049364a504b3f7($file) +function composerRequire0efb534ee20646bcb987f4359c38b3aa($file) { require $file; } diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 1f834aefe431c..dbd823136ee3d 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -116,92 +116,6 @@ "uri" ] }, - { - "name": "joomla/event", - "version": "1.1.1", - "version_normalized": "1.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/event.git", - "reference": "bb957bc45aba897e465384bbe21cd0eb79aca901" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/event/zipball/bb957bc45aba897e465384bbe21cd0eb79aca901", - "reference": "bb957bc45aba897e465384bbe21cd0eb79aca901", - "shasum": "" - }, - "require": { - "php": ">=5.3.10" - }, - "time": "2014-02-09 01:30:54", - "type": "joomla-package", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Joomla\\Event\\": "src/", - "Joomla\\Event\\Tests\\": "Tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla Event Package", - "homepage": "https://github.com/joomla-framework/event", - "keywords": [ - "event", - "framework", - "joomla" - ] - }, - { - "name": "joomla/session", - "version": "1.2.3", - "version_normalized": "1.2.3.0", - "target-dir": "Joomla/Session", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/session.git", - "reference": "ef955cf9642793c4ad5874f334069051c33ba604" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/session/zipball/ef955cf9642793c4ad5874f334069051c33ba604", - "reference": "ef955cf9642793c4ad5874f334069051c33ba604", - "shasum": "" - }, - "require": { - "joomla/event": "~1.1", - "joomla/filter": "~1.0", - "php": ">=5.3.10" - }, - "require-dev": { - "joomla/test": "~1.0" - }, - "suggest": { - "joomla/database": "Install joomla/database if you want to use Database session storage." - }, - "time": "2014-08-18 17:41:06", - "type": "joomla-package", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Joomla\\Session": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla Session Package", - "homepage": "https://github.com/joomla-framework/session", - "keywords": [ - "framework", - "joomla", - "session" - ] - }, { "name": "leafo/lessphp", "version": "v0.3.9", @@ -295,61 +209,6 @@ "joomla" ] }, - { - "name": "joomla/application", - "version": "1.3.0", - "version_normalized": "1.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/application.git", - "reference": "b7745273664294387bdd7fb694d75e65b7491f28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/application/zipball/b7745273664294387bdd7fb694d75e65b7491f28", - "reference": "b7745273664294387bdd7fb694d75e65b7491f28", - "shasum": "" - }, - "require": { - "joomla/input": "~1.2", - "joomla/registry": "~1.1", - "joomla/session": "~1.1", - "joomla/string": "~1.1", - "joomla/uri": "~1.1", - "php": ">=5.3.10", - "psr/log": "~1.0" - }, - "require-dev": { - "joomla/test": "~1.1", - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "1.*" - }, - "time": "2014-10-13 12:43:54", - "type": "joomla-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Joomla\\Application\\": "src/", - "Joomla\\Application\\Tests\\": "Tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla Application Package", - "homepage": "https://github.com/joomla-framework/application", - "keywords": [ - "application", - "framework", - "joomla" - ] - }, { "name": "ircmaxell/password-compat", "version": "v1.0.4", @@ -605,17 +464,17 @@ }, { "name": "joomla/string", - "version": "1.2.2", - "version_normalized": "1.2.2.0", + "version": "1.3.0", + "version_normalized": "1.3.0.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/string.git", - "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692" + "reference": "0df8ead8c726a1f648e624d3bcbef8cf05c1d0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/string/zipball/9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", - "reference": "9f7b27d6b2d48d65b2fe81b5c6d72225629ad692", + "url": "https://api.github.com/repos/joomla-framework/string/zipball/0df8ead8c726a1f648e624d3bcbef8cf05c1d0da", + "reference": "0df8ead8c726a1f648e624d3bcbef8cf05c1d0da", "shasum": "" }, "require": { @@ -626,7 +485,7 @@ "phpunit/phpunit": "4.*", "squizlabs/php_codesniffer": "1.*" }, - "time": "2015-03-13 12:29:00", + "time": "2015-03-26 01:02:20", "type": "joomla-package", "extra": { "branch-alias": { @@ -652,24 +511,73 @@ "string" ] }, + { + "name": "joomla/utilities", + "version": "1.3.3", + "version_normalized": "1.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/utilities.git", + "reference": "3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4", + "reference": "3e43b0806c194a92b58a176b73d6cc2dc6c9c3a4", + "shasum": "" + }, + "require": { + "joomla/string": "~1.3", + "php": ">=5.3.10" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "1.*" + }, + "time": "2015-03-28 17:52:43", + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\Utilities\\": "src/", + "Joomla\\Utilities\\Tests\\": "Tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Utilities Package", + "homepage": "https://github.com/joomla-framework/utilities", + "keywords": [ + "framework", + "joomla", + "utilities" + ] + }, { "name": "joomla/registry", - "version": "1.4.4", - "version_normalized": "1.4.4.0", + "version": "1.4.5", + "version_normalized": "1.4.5.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "730467978ad52677903e973bb33be2306eb161eb" + "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/730467978ad52677903e973bb33be2306eb161eb", - "reference": "730467978ad52677903e973bb33be2306eb161eb", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/4f926ba961ca45eb95076a1598c3ae689cb02fc5", + "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5", "shasum": "" }, "require": { "joomla/compat": "~1.0", - "joomla/string": "~1.2", + "joomla/string": "~1.3", "joomla/utilities": "~1.0", "php": ">=5.3.10" }, @@ -682,7 +590,7 @@ "suggest": { "symfony/yaml": "Install 2.* if you require YAML support." }, - "time": "2015-03-16 18:49:29", + "time": "2015-03-28 17:54:38", "type": "joomla-package", "extra": { "branch-alias": { @@ -709,29 +617,38 @@ ] }, { - "name": "joomla/utilities", - "version": "1.3.2", - "version_normalized": "1.3.2.0", + "name": "joomla/application", + "version": "1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", - "url": "https://github.com/joomla-framework/utilities.git", - "reference": "2e7f37a69162fea02059c764a318a920121f8b4a" + "url": "https://github.com/joomla-framework/application.git", + "reference": "185b68fe55537281385b637a90e11856ea01c8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/utilities/zipball/2e7f37a69162fea02059c764a318a920121f8b4a", - "reference": "2e7f37a69162fea02059c764a318a920121f8b4a", + "url": "https://api.github.com/repos/joomla-framework/application/zipball/185b68fe55537281385b637a90e11856ea01c8da", + "reference": "185b68fe55537281385b637a90e11856ea01c8da", "shasum": "" }, "require": { - "joomla/string": "~1.0", - "php": ">=5.3.10" + "joomla/input": "~1.2", + "joomla/registry": "~1.1", + "php": ">=5.3.10", + "psr/log": "~1.0" }, "require-dev": { + "joomla/session": "~1.1", + "joomla/test": "~1.1", + "joomla/uri": "~1.1", "phpunit/phpunit": "4.*", "squizlabs/php_codesniffer": "1.*" }, - "time": "2015-03-16 18:50:58", + "suggest": { + "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", + "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + }, + "time": "2015-03-06 17:37:01", "type": "joomla-package", "extra": { "branch-alias": { @@ -741,20 +658,106 @@ "installation-source": "dist", "autoload": { "psr-4": { - "Joomla\\Utilities\\": "src/", - "Joomla\\Utilities\\Tests\\": "Tests/" + "Joomla\\Application\\": "src/", + "Joomla\\Application\\Tests\\": "Tests/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "GPL-2.0+" ], - "description": "Joomla Utilities Package", - "homepage": "https://github.com/joomla-framework/utilities", + "description": "Joomla Application Package", + "homepage": "https://github.com/joomla-framework/application", + "keywords": [ + "application", + "framework", + "joomla" + ] + }, + { + "name": "joomla/event", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/event.git", + "reference": "bb957bc45aba897e465384bbe21cd0eb79aca901" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/event/zipball/bb957bc45aba897e465384bbe21cd0eb79aca901", + "reference": "bb957bc45aba897e465384bbe21cd0eb79aca901", + "shasum": "" + }, + "require": { + "php": ">=5.3.10" + }, + "time": "2014-02-09 01:30:54", + "type": "joomla-package", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\Event\\": "src/", + "Joomla\\Event\\Tests\\": "Tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Event Package", + "homepage": "https://github.com/joomla-framework/event", + "keywords": [ + "event", + "framework", + "joomla" + ] + }, + { + "name": "joomla/session", + "version": "1.2.3", + "version_normalized": "1.2.3.0", + "target-dir": "Joomla/Session", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/session.git", + "reference": "ef955cf9642793c4ad5874f334069051c33ba604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/session/zipball/ef955cf9642793c4ad5874f334069051c33ba604", + "reference": "ef955cf9642793c4ad5874f334069051c33ba604", + "shasum": "" + }, + "require": { + "joomla/event": "~1.1", + "joomla/filter": "~1.0", + "php": ">=5.3.10" + }, + "require-dev": { + "joomla/test": "~1.0" + }, + "suggest": { + "joomla/database": "Install joomla/database if you want to use Database session storage." + }, + "time": "2014-08-18 17:41:06", + "type": "joomla-package", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Joomla\\Session": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Session Package", + "homepage": "https://github.com/joomla-framework/session", "keywords": [ "framework", "joomla", - "utilities" + "session" ] } ] diff --git a/libraries/vendor/joomla/application/src/AbstractApplication.php b/libraries/vendor/joomla/application/src/AbstractApplication.php index a921e1fa07a88..9842c80ecfb23 100644 --- a/libraries/vendor/joomla/application/src/AbstractApplication.php +++ b/libraries/vendor/joomla/application/src/AbstractApplication.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/AbstractCliApplication.php b/libraries/vendor/joomla/application/src/AbstractCliApplication.php index 9c1c601bfcb69..6ba345c5511af 100644 --- a/libraries/vendor/joomla/application/src/AbstractCliApplication.php +++ b/libraries/vendor/joomla/application/src/AbstractCliApplication.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/AbstractDaemonApplication.php b/libraries/vendor/joomla/application/src/AbstractDaemonApplication.php index 0fb8ebf8d2c5e..4fadb812483cd 100644 --- a/libraries/vendor/joomla/application/src/AbstractDaemonApplication.php +++ b/libraries/vendor/joomla/application/src/AbstractDaemonApplication.php @@ -2,13 +2,12 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Application; -use Joomla\Filesystem\Folder; use Joomla\Registry\Registry; use Joomla\Input\Cli; use Psr\Log\LoggerAwareInterface; diff --git a/libraries/vendor/joomla/application/src/AbstractWebApplication.php b/libraries/vendor/joomla/application/src/AbstractWebApplication.php index 961bc69f47290..fcdcd0786febc 100644 --- a/libraries/vendor/joomla/application/src/AbstractWebApplication.php +++ b/libraries/vendor/joomla/application/src/AbstractWebApplication.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ @@ -10,7 +10,6 @@ use Joomla\Uri\Uri; use Joomla\Input\Input; -use Joomla\String\String; use Joomla\Session\Session; use Joomla\Registry\Registry; @@ -285,7 +284,7 @@ public function redirect($url, $moved = false) */ if (!preg_match('#^[a-z]+\://#i', $url)) { - // Get a JURI instance for the requested URI. + // Get a Uri instance for the requested URI. $uri = new Uri($this->get('uri.request')); // Get a base URL to prepend from the requested URI. @@ -314,7 +313,7 @@ public function redirect($url, $moved = false) else { // We have to use a JavaScript redirect here because MSIE doesn't play nice with utf-8 URLs. - if (($this->client->engine == Web\WebClient::TRIDENT) && !String::is_ascii($url)) + if (($this->client->engine == Web\WebClient::TRIDENT) && !$this->isAscii($url)) { $html = ''; $html .= ''; @@ -526,6 +525,11 @@ public function getBody($asArray = false) */ public function getSession() { + if ($this->session === null) + { + throw new \RuntimeException('A \Joomla\Session\Session object has not been set.'); + } + return $this->session; } @@ -776,7 +780,7 @@ public function checkToken($method = 'post') if (!$this->input->$method->get($token, '', 'alnum')) { - if ($this->session->isNew()) + if ($this->getSession()->isNew()) { // Redirect to login screen. $this->redirect('index.php'); @@ -808,6 +812,25 @@ public function getFormToken($forceNew = false) // @todo we need the user id somehow here $userId = 0; - return md5($this->get('secret') . $userId . $this->session->getToken($forceNew)); + return md5($this->get('secret') . $userId . $this->getSession()->getToken($forceNew)); + } + + /** + * Tests whether a string contains only 7bit ASCII bytes. + * + * You might use this to conditionally check whether a string + * needs handling as UTF-8 or not, potentially offering performance + * benefits by using the native PHP equivalent if it's just ASCII e.g.; + * + * @param string $str The string to test. + * + * @return boolean True if the string is all ASCII + * + * @since 1.4.0 + */ + public static function isAscii($str) + { + // Search for any bytes which are outside the ASCII range... + return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1); } } diff --git a/libraries/vendor/joomla/application/src/Cli/CliOutput.php b/libraries/vendor/joomla/application/src/Cli/CliOutput.php index bd6a808d9085a..ecec4912906e4 100644 --- a/libraries/vendor/joomla/application/src/Cli/CliOutput.php +++ b/libraries/vendor/joomla/application/src/Cli/CliOutput.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/ColorProcessor.php b/libraries/vendor/joomla/application/src/Cli/ColorProcessor.php index 4349d034e75e2..1a19932eec53e 100644 --- a/libraries/vendor/joomla/application/src/Cli/ColorProcessor.php +++ b/libraries/vendor/joomla/application/src/Cli/ColorProcessor.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/ColorStyle.php b/libraries/vendor/joomla/application/src/Cli/ColorStyle.php index 7f4726b3cab3a..a0d7ee9752316 100644 --- a/libraries/vendor/joomla/application/src/Cli/ColorStyle.php +++ b/libraries/vendor/joomla/application/src/Cli/ColorStyle.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/Output/Processor/ColorProcessor.php b/libraries/vendor/joomla/application/src/Cli/Output/Processor/ColorProcessor.php index 74e83b74c8917..3084a49bb0f2a 100644 --- a/libraries/vendor/joomla/application/src/Cli/Output/Processor/ColorProcessor.php +++ b/libraries/vendor/joomla/application/src/Cli/Output/Processor/ColorProcessor.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/Output/Processor/ProcessorInterface.php b/libraries/vendor/joomla/application/src/Cli/Output/Processor/ProcessorInterface.php index 6531db36e3c85..a9665d4f94c05 100644 --- a/libraries/vendor/joomla/application/src/Cli/Output/Processor/ProcessorInterface.php +++ b/libraries/vendor/joomla/application/src/Cli/Output/Processor/ProcessorInterface.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/Output/Stdout.php b/libraries/vendor/joomla/application/src/Cli/Output/Stdout.php index ed789d52d9616..3291240845757 100644 --- a/libraries/vendor/joomla/application/src/Cli/Output/Stdout.php +++ b/libraries/vendor/joomla/application/src/Cli/Output/Stdout.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Cli/Output/Xml.php b/libraries/vendor/joomla/application/src/Cli/Output/Xml.php index 056e40c71b086..adb945f88c926 100644 --- a/libraries/vendor/joomla/application/src/Cli/Output/Xml.php +++ b/libraries/vendor/joomla/application/src/Cli/Output/Xml.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/application/src/Web/WebClient.php b/libraries/vendor/joomla/application/src/Web/WebClient.php index ade33c3252b48..83109f8ea19c5 100644 --- a/libraries/vendor/joomla/application/src/Web/WebClient.php +++ b/libraries/vendor/joomla/application/src/Web/WebClient.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework Application Package * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/registry/src/Format/Json.php b/libraries/vendor/joomla/registry/src/Format/Json.php index 16f3b597bf466..a2e9729eca659 100644 --- a/libraries/vendor/joomla/registry/src/Format/Json.php +++ b/libraries/vendor/joomla/registry/src/Format/Json.php @@ -9,7 +9,7 @@ namespace Joomla\Registry\Format; use Joomla\Registry\AbstractRegistryFormat; -use Joomla\String\String; +use Joomla\String\StringHelper; /** * JSON format handler for Registry. @@ -30,7 +30,7 @@ class Json extends AbstractRegistryFormat */ public function objectToString($object, $options = array()) { - return String::unicode_to_utf8(json_encode($object)); + return StringHelper::unicode_to_utf8(json_encode($object)); } /** diff --git a/libraries/vendor/joomla/string/src/Inflector.php b/libraries/vendor/joomla/string/src/Inflector.php index 4100b1c514de2..89b35aec5e892 100644 --- a/libraries/vendor/joomla/string/src/Inflector.php +++ b/libraries/vendor/joomla/string/src/Inflector.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/string/src/Normalise.php b/libraries/vendor/joomla/string/src/Normalise.php index e11437666a058..ca73c8bdccd27 100644 --- a/libraries/vendor/joomla/string/src/Normalise.php +++ b/libraries/vendor/joomla/string/src/Normalise.php @@ -2,7 +2,7 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ diff --git a/libraries/vendor/joomla/string/src/String.php b/libraries/vendor/joomla/string/src/String.php index 4eb3a2d1a113c..f535e0874efb9 100644 --- a/libraries/vendor/joomla/string/src/String.php +++ b/libraries/vendor/joomla/string/src/String.php @@ -2,840 +2,20 @@ /** * Part of the Joomla Framework String Package * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\String; -// PHP mbstring and iconv local configuration -if (version_compare(PHP_VERSION, '5.6', '>=')) -{ - @ini_set('default_charset', 'UTF-8'); -} -else -{ - // Check if mbstring extension is loaded and attempt to load it if not present except for windows - if (extension_loaded('mbstring')) - { - @ini_set('mbstring.internal_encoding', 'UTF-8'); - @ini_set('mbstring.http_input', 'UTF-8'); - @ini_set('mbstring.http_output', 'UTF-8'); - } - - // Same for iconv - if (function_exists('iconv')) - { - iconv_set_encoding('internal_encoding', 'UTF-8'); - iconv_set_encoding('input_encoding', 'UTF-8'); - iconv_set_encoding('output_encoding', 'UTF-8'); - } -} - -/** - * Include the utf8 package - */ -if (!defined('UTF8')) -{ - require_once __DIR__ . '/phputf8/utf8.php'; -} - -if (!function_exists('utf8_strcasecmp')) -{ - require_once __DIR__ . '/phputf8/strcasecmp.php'; -} - /** * String handling class for utf-8 data * Wraps the phputf8 library * All functions assume the validity of utf-8 strings. * - * @since 1.0 + * @since 1.0 + * @deprecated 2.0 Use StringHelper instead */ -abstract class String +abstract class String extends StringHelper { - /** - * Increment styles. - * - * @var array - * @since 1.0 - */ - protected static $incrementStyles = array( - 'dash' => array( - '#-(\d+)$#', - '-%d' - ), - 'default' => array( - array('#\((\d+)\)$#', '#\(\d+\)$#'), - array(' (%d)', '(%d)'), - ), - ); - - /** - * Increments a trailing number in a string. - * - * Used to easily create distinct labels when copying objects. The method has the following styles: - * - * default: "Label" becomes "Label (2)" - * dash: "Label" becomes "Label-2" - * - * @param string $string The source string. - * @param string $style The the style (default|dash). - * @param integer $n If supplied, this number is used for the copy, otherwise it is the 'next' number. - * - * @return string The incremented string. - * - * @since 1.0 - */ - public static function increment($string, $style = 'default', $n = 0) - { - $styleSpec = isset(self::$incrementStyles[$style]) ? self::$incrementStyles[$style] : self::$incrementStyles['default']; - - // Regular expression search and replace patterns. - if (is_array($styleSpec[0])) - { - $rxSearch = $styleSpec[0][0]; - $rxReplace = $styleSpec[0][1]; - } - else - { - $rxSearch = $rxReplace = $styleSpec[0]; - } - - // New and old (existing) sprintf formats. - if (is_array($styleSpec[1])) - { - $newFormat = $styleSpec[1][0]; - $oldFormat = $styleSpec[1][1]; - } - else - { - $newFormat = $oldFormat = $styleSpec[1]; - } - - // Check if we are incrementing an existing pattern, or appending a new one. - if (preg_match($rxSearch, $string, $matches)) - { - $n = empty($n) ? ($matches[1] + 1) : $n; - $string = preg_replace($rxReplace, sprintf($oldFormat, $n), $string); - } - else - { - $n = empty($n) ? 2 : $n; - $string .= sprintf($newFormat, $n); - } - - return $string; - } - - /** - * Tests whether a string contains only 7bit ASCII bytes. - * You might use this to conditionally check whether a string - * needs handling as UTF-8 or not, potentially offering performance - * benefits by using the native PHP equivalent if it's just ASCII e.g.; - * - * - * if (String::is_ascii($someString)) - * { - * // It's just ASCII - use the native PHP version - * $someString = strtolower($someString); - * } - * else - * { - * $someString = String::strtolower($someString); - * } - * - * - * @param string $str The string to test. - * - * @return boolean True if the string is all ASCII - * - * @since 1.0 - */ - public static function is_ascii($str) - { - require_once __DIR__ . '/phputf8/utils/ascii.php'; - - return utf8_is_ascii($str); - } - - /** - * UTF-8 aware alternative to strpos. - * - * Find position of first occurrence of a string. - * - * @param string $str String being examined - * @param string $search String being searched for - * @param integer $offset Optional, specifies the position from which the search should be performed - * - * @return mixed Number of characters before the first match or FALSE on failure - * - * @see http://www.php.net/strpos - * @since 1.0 - */ - public static function strpos($str, $search, $offset = false) - { - if ($offset === false) - { - return utf8_strpos($str, $search); - } - - return utf8_strpos($str, $search, $offset); - } - - /** - * UTF-8 aware alternative to strrpos - * Finds position of last occurrence of a string - * - * @param string $str String being examined. - * @param string $search String being searched for. - * @param integer $offset Offset from the left of the string. - * - * @return mixed Number of characters before the last match or false on failure - * - * @see http://www.php.net/strrpos - * @since 1.0 - */ - public static function strrpos($str, $search, $offset = 0) - { - return utf8_strrpos($str, $search, $offset); - } - - /** - * UTF-8 aware alternative to substr - * Return part of a string given character offset (and optionally length) - * - * @param string $str String being processed - * @param integer $offset Number of UTF-8 characters offset (from left) - * @param integer $length Optional length in UTF-8 characters from offset - * - * @return mixed string or FALSE if failure - * - * @see http://www.php.net/substr - * @since 1.0 - */ - public static function substr($str, $offset, $length = false) - { - if ($length === false) - { - return utf8_substr($str, $offset); - } - - return utf8_substr($str, $offset, $length); - } - - /** - * UTF-8 aware alternative to strtlower - * - * Make a string lowercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @param string $str String being processed - * - * @return mixed Either string in lowercase or FALSE is UTF-8 invalid - * - * @see http://www.php.net/strtolower - * @since 1.0 - */ - public static function strtolower($str) - { - return utf8_strtolower($str); - } - - /** - * UTF-8 aware alternative to strtoupper - * Make a string uppercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @param string $str String being processed - * - * @return mixed Either string in uppercase or FALSE is UTF-8 invalid - * - * @see http://www.php.net/strtoupper - * @since 1.0 - */ - public static function strtoupper($str) - { - return utf8_strtoupper($str); - } - - /** - * UTF-8 aware alternative to strlen. - * - * Returns the number of characters in the string (NOT THE NUMBER OF BYTES), - * - * @param string $str UTF-8 string. - * - * @return integer Number of UTF-8 characters in string. - * - * @see http://www.php.net/strlen - * @since 1.0 - */ - public static function strlen($str) - { - return utf8_strlen($str); - } - - /** - * UTF-8 aware alternative to str_ireplace - * Case-insensitive version of str_replace - * - * @param string $search String to search - * @param string $replace Existing string to replace - * @param string $str New string to replace with - * @param integer $count Optional count value to be passed by referene - * - * @return string UTF-8 String - * - * @see http://www.php.net/str_ireplace - * @since 1.0 - */ - public static function str_ireplace($search, $replace, $str, $count = null) - { - require_once __DIR__ . '/phputf8/str_ireplace.php'; - - if ($count === false) - { - return utf8_ireplace($search, $replace, $str); - } - - return utf8_ireplace($search, $replace, $str, $count); - } - - /** - * UTF-8 aware alternative to str_split - * Convert a string to an array - * - * @param string $str UTF-8 encoded string to process - * @param integer $split_len Number to characters to split string by - * - * @return array - * - * @see http://www.php.net/str_split - * @since 1.0 - */ - public static function str_split($str, $split_len = 1) - { - require_once __DIR__ . '/phputf8/str_split.php'; - - return utf8_str_split($str, $split_len); - } - - /** - * UTF-8/LOCALE aware alternative to strcasecmp - * A case insensitive string comparison - * - * @param string $str1 string 1 to compare - * @param string $str2 string 2 to compare - * @param mixed $locale The locale used by strcoll or false to use classical comparison - * - * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. - * - * @see http://www.php.net/strcasecmp - * @see http://www.php.net/strcoll - * @see http://www.php.net/setlocale - * @since 1.0 - */ - public static function strcasecmp($str1, $str2, $locale = false) - { - if ($locale) - { - // Get current locale - $locale0 = setlocale(LC_COLLATE, 0); - - if (!$locale = setlocale(LC_COLLATE, $locale)) - { - $locale = $locale0; - } - - // See if we have successfully set locale to UTF-8 - if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) - { - $encoding = 'CP' . $m[1]; - } - elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) - { - $encoding = 'UTF-8'; - } - else - { - $encoding = 'nonrecodable'; - } - - // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode - if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') - { - return strcoll(utf8_strtolower($str1), utf8_strtolower($str2)); - } - - return strcoll( - self::transcode(utf8_strtolower($str1), 'UTF-8', $encoding), - self::transcode(utf8_strtolower($str2), 'UTF-8', $encoding) - ); - } - - return utf8_strcasecmp($str1, $str2); - } - - /** - * UTF-8/LOCALE aware alternative to strcmp - * A case sensitive string comparison - * - * @param string $str1 string 1 to compare - * @param string $str2 string 2 to compare - * @param mixed $locale The locale used by strcoll or false to use classical comparison - * - * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. - * - * @see http://www.php.net/strcmp - * @see http://www.php.net/strcoll - * @see http://www.php.net/setlocale - * @since 1.0 - */ - public static function strcmp($str1, $str2, $locale = false) - { - if ($locale) - { - // Get current locale - $locale0 = setlocale(LC_COLLATE, 0); - - if (!$locale = setlocale(LC_COLLATE, $locale)) - { - $locale = $locale0; - } - - // See if we have successfully set locale to UTF-8 - if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) - { - $encoding = 'CP' . $m[1]; - } - elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) - { - $encoding = 'UTF-8'; - } - else - { - $encoding = 'nonrecodable'; - } - - // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode - if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') - { - return strcoll($str1, $str2); - } - - return strcoll(self::transcode($str1, 'UTF-8', $encoding), self::transcode($str2, 'UTF-8', $encoding)); - } - - return strcmp($str1, $str2); - } - - /** - * UTF-8 aware alternative to strcspn - * Find length of initial segment not matching mask - * - * @param string $str The string to process - * @param string $mask The mask - * @param integer $start Optional starting character position (in characters) - * @param integer $length Optional length - * - * @return integer The length of the initial segment of str1 which does not contain any of the characters in str2 - * - * @see http://www.php.net/strcspn - * @since 1.0 - */ - public static function strcspn($str, $mask, $start = null, $length = null) - { - require_once __DIR__ . '/phputf8/strcspn.php'; - - if ($start === false && $length === false) - { - return utf8_strcspn($str, $mask); - } - - if ($length === false) - { - return utf8_strcspn($str, $mask, $start); - } - - return utf8_strcspn($str, $mask, $start, $length); - } - - /** - * UTF-8 aware alternative to stristr - * Returns all of haystack from the first occurrence of needle to the end. - * needle and haystack are examined in a case-insensitive manner - * Find first occurrence of a string using case insensitive comparison - * - * @param string $str The haystack - * @param string $search The needle - * - * @return string the sub string - * - * @see http://www.php.net/stristr - * @since 1.0 - */ - public static function stristr($str, $search) - { - require_once __DIR__ . '/phputf8/stristr.php'; - - return utf8_stristr($str, $search); - } - - /** - * UTF-8 aware alternative to strrev - * Reverse a string - * - * @param string $str String to be reversed - * - * @return string The string in reverse character order - * - * @see http://www.php.net/strrev - * @since 1.0 - */ - public static function strrev($str) - { - require_once __DIR__ . '/phputf8/strrev.php'; - - return utf8_strrev($str); - } - - /** - * UTF-8 aware alternative to strspn - * Find length of initial segment matching mask - * - * @param string $str The haystack - * @param string $mask The mask - * @param integer $start Start optional - * @param integer $length Length optional - * - * @return integer - * - * @see http://www.php.net/strspn - * @since 1.0 - */ - public static function strspn($str, $mask, $start = null, $length = null) - { - require_once __DIR__ . '/phputf8/strspn.php'; - - if ($start === null && $length === null) - { - return utf8_strspn($str, $mask); - } - - if ($length === null) - { - return utf8_strspn($str, $mask, $start); - } - - return utf8_strspn($str, $mask, $start, $length); - } - - /** - * UTF-8 aware substr_replace - * Replace text within a portion of a string - * - * @param string $str The haystack - * @param string $repl The replacement string - * @param integer $start Start - * @param integer $length Length (optional) - * - * @return string - * - * @see http://www.php.net/substr_replace - * @since 1.0 - */ - public static function substr_replace($str, $repl, $start, $length = null) - { - // Loaded by library loader - if ($length === false) - { - return utf8_substr_replace($str, $repl, $start); - } - - return utf8_substr_replace($str, $repl, $start, $length); - } - - /** - * UTF-8 aware replacement for ltrim() - * - * Strip whitespace (or other characters) from the beginning of a string - * You only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise ltrim will - * work normally on a UTF-8 string - * - * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim - * - * @return string The trimmed string - * - * @see http://www.php.net/ltrim - * @since 1.0 - */ - public static function ltrim($str, $charlist = false) - { - if (empty($charlist) && $charlist !== false) - { - return $str; - } - - require_once __DIR__ . '/phputf8/trim.php'; - - if ($charlist === false) - { - return utf8_ltrim($str); - } - - return utf8_ltrim($str, $charlist); - } - - /** - * UTF-8 aware replacement for rtrim() - * Strip whitespace (or other characters) from the end of a string - * You only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise rtrim will - * work normally on a UTF-8 string - * - * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim - * - * @return string The trimmed string - * - * @see http://www.php.net/rtrim - * @since 1.0 - */ - public static function rtrim($str, $charlist = false) - { - if (empty($charlist) && $charlist !== false) - { - return $str; - } - - require_once __DIR__ . '/phputf8/trim.php'; - - if ($charlist === false) - { - return utf8_rtrim($str); - } - - return utf8_rtrim($str, $charlist); - } - - /** - * UTF-8 aware replacement for trim() - * Strip whitespace (or other characters) from the beginning and end of a string - * Note: you only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise trim will - * work normally on a UTF-8 string - * - * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim - * - * @return string The trimmed string - * - * @see http://www.php.net/trim - * @since 1.0 - */ - public static function trim($str, $charlist = false) - { - if (empty($charlist) && $charlist !== false) - { - return $str; - } - - require_once __DIR__ . '/phputf8/trim.php'; - - if ($charlist === false) - { - return utf8_trim($str); - } - - return utf8_trim($str, $charlist); - } - - /** - * UTF-8 aware alternative to ucfirst - * Make a string's first character uppercase or all words' first character uppercase - * - * @param string $str String to be processed - * @param string $delimiter The words delimiter (null means do not split the string) - * @param string $newDelimiter The new words delimiter (null means equal to $delimiter) - * - * @return string If $delimiter is null, return the string with first character as upper case (if applicable) - * else consider the string of words separated by the delimiter, apply the ucfirst to each words - * and return the string with the new delimiter - * - * @see http://www.php.net/ucfirst - * @since 1.0 - */ - public static function ucfirst($str, $delimiter = null, $newDelimiter = null) - { - require_once __DIR__ . '/phputf8/ucfirst.php'; - - if ($delimiter === null) - { - return utf8_ucfirst($str); - } - - if ($newDelimiter === null) - { - $newDelimiter = $delimiter; - } - - return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); - } - - /** - * UTF-8 aware alternative to ucwords - * Uppercase the first character of each word in a string - * - * @param string $str String to be processed - * - * @return string String with first char of each word uppercase - * - * @see http://www.php.net/ucwords - * @since 1.0 - */ - public static function ucwords($str) - { - require_once __DIR__ . '/phputf8/ucwords.php'; - - return utf8_ucwords($str); - } - - /** - * Transcode a string. - * - * @param string $source The string to transcode. - * @param string $from_encoding The source encoding. - * @param string $to_encoding The target encoding. - * - * @return mixed The transcoded string, or null if the source was not a string. - * - * @link https://bugs.php.net/bug.php?id=48147 - * - * @since 1.0 - */ - public static function transcode($source, $from_encoding, $to_encoding) - { - if (is_string($source)) - { - switch (ICONV_IMPL) - { - case 'glibc': - return @iconv($from_encoding, $to_encoding . '//TRANSLIT,IGNORE', $source); - - case 'libiconv': - default: - return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source); - } - } - - return null; - } - - /** - * Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard. - * - * Note: this function has been modified to simple return true or false. - * - * @param string $str UTF-8 encoded string. - * - * @return boolean true if valid - * - * @author - * @see http://hsivonen.iki.fi/php-utf8/ - * @see compliant - * @since 1.0 - */ - public static function valid($str) - { - require_once __DIR__ . '/phputf8/utils/validation.php'; - - return utf8_is_valid($str); - } - - /** - * Tests whether a string complies as UTF-8. This will be much - * faster than utf8_is_valid but will pass five and six octet - * UTF-8 sequences, which are not supported by Unicode and - * so cannot be displayed correctly in a browser. In other words - * it is not as strict as utf8_is_valid but it's faster. If you use - * it to validate user input, you place yourself at the risk that - * attackers will be able to inject 5 and 6 byte sequences (which - * may or may not be a significant risk, depending on what you are - * are doing) - * - * @param string $str UTF-8 string to check - * - * @return boolean TRUE if string is valid UTF-8 - * - * @see valid - * @see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 - * @since 1.0 - */ - public static function compliant($str) - { - require_once __DIR__ . '/phputf8/utils/validation.php'; - - return utf8_compliant($str); - } - - /** - * Converts Unicode sequences to UTF-8 string - * - * @param string $str Unicode string to convert - * - * @return string UTF-8 string - * - * @since 1.2.0 - */ - public static function unicode_to_utf8($str) - { - if (extension_loaded('mbstring')) - { - return preg_replace_callback( - '/\\\\u([0-9a-fA-F]{4})/', - function ($match) - { - return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); - }, - $str - ); - } - - return $str; - } - - /** - * Converts Unicode sequences to UTF-16 string - * - * @param string $str Unicode string to convert - * - * @return string UTF-16 string - * - * @since 1.2.0 - */ - public static function unicode_to_utf16($str) - { - if (extension_loaded('mbstring')) - { - return preg_replace_callback( - '/\\\\u([0-9a-fA-F]{4})/', - function ($match) - { - return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE'); - }, - $str - ); - } - - return $str; - } } diff --git a/libraries/vendor/joomla/string/src/StringHelper.php b/libraries/vendor/joomla/string/src/StringHelper.php new file mode 100644 index 0000000000000..47cddd5b9c9ee --- /dev/null +++ b/libraries/vendor/joomla/string/src/StringHelper.php @@ -0,0 +1,841 @@ +=')) +{ + @ini_set('default_charset', 'UTF-8'); +} +else +{ + // Check if mbstring extension is loaded and attempt to load it if not present except for windows + if (extension_loaded('mbstring')) + { + @ini_set('mbstring.internal_encoding', 'UTF-8'); + @ini_set('mbstring.http_input', 'UTF-8'); + @ini_set('mbstring.http_output', 'UTF-8'); + } + + // Same for iconv + if (function_exists('iconv')) + { + iconv_set_encoding('internal_encoding', 'UTF-8'); + iconv_set_encoding('input_encoding', 'UTF-8'); + iconv_set_encoding('output_encoding', 'UTF-8'); + } +} + +/** + * Include the utf8 package + */ +if (!defined('UTF8')) +{ + require_once __DIR__ . '/phputf8/utf8.php'; +} + +if (!function_exists('utf8_strcasecmp')) +{ + require_once __DIR__ . '/phputf8/strcasecmp.php'; +} + +/** + * String handling class for utf-8 data + * Wraps the phputf8 library + * All functions assume the validity of utf-8 strings. + * + * @since 1.3.0 + */ +abstract class StringHelper +{ + /** + * Increment styles. + * + * @var array + * @since 1.3.0 + */ + protected static $incrementStyles = array( + 'dash' => array( + '#-(\d+)$#', + '-%d' + ), + 'default' => array( + array('#\((\d+)\)$#', '#\(\d+\)$#'), + array(' (%d)', '(%d)'), + ), + ); + + /** + * Increments a trailing number in a string. + * + * Used to easily create distinct labels when copying objects. The method has the following styles: + * + * default: "Label" becomes "Label (2)" + * dash: "Label" becomes "Label-2" + * + * @param string $string The source string. + * @param string $style The the style (default|dash). + * @param integer $n If supplied, this number is used for the copy, otherwise it is the 'next' number. + * + * @return string The incremented string. + * + * @since 1.3.0 + */ + public static function increment($string, $style = 'default', $n = 0) + { + $styleSpec = isset(self::$incrementStyles[$style]) ? self::$incrementStyles[$style] : self::$incrementStyles['default']; + + // Regular expression search and replace patterns. + if (is_array($styleSpec[0])) + { + $rxSearch = $styleSpec[0][0]; + $rxReplace = $styleSpec[0][1]; + } + else + { + $rxSearch = $rxReplace = $styleSpec[0]; + } + + // New and old (existing) sprintf formats. + if (is_array($styleSpec[1])) + { + $newFormat = $styleSpec[1][0]; + $oldFormat = $styleSpec[1][1]; + } + else + { + $newFormat = $oldFormat = $styleSpec[1]; + } + + // Check if we are incrementing an existing pattern, or appending a new one. + if (preg_match($rxSearch, $string, $matches)) + { + $n = empty($n) ? ($matches[1] + 1) : $n; + $string = preg_replace($rxReplace, sprintf($oldFormat, $n), $string); + } + else + { + $n = empty($n) ? 2 : $n; + $string .= sprintf($newFormat, $n); + } + + return $string; + } + + /** + * Tests whether a string contains only 7bit ASCII bytes. + * You might use this to conditionally check whether a string + * needs handling as UTF-8 or not, potentially offering performance + * benefits by using the native PHP equivalent if it's just ASCII e.g.; + * + * + * if (String::is_ascii($someString)) + * { + * // It's just ASCII - use the native PHP version + * $someString = strtolower($someString); + * } + * else + * { + * $someString = String::strtolower($someString); + * } + * + * + * @param string $str The string to test. + * + * @return boolean True if the string is all ASCII + * + * @since 1.3.0 + */ + public static function is_ascii($str) + { + require_once __DIR__ . '/phputf8/utils/ascii.php'; + + return utf8_is_ascii($str); + } + + /** + * UTF-8 aware alternative to strpos. + * + * Find position of first occurrence of a string. + * + * @param string $str String being examined + * @param string $search String being searched for + * @param integer $offset Optional, specifies the position from which the search should be performed + * + * @return mixed Number of characters before the first match or FALSE on failure + * + * @see http://www.php.net/strpos + * @since 1.3.0 + */ + public static function strpos($str, $search, $offset = false) + { + if ($offset === false) + { + return utf8_strpos($str, $search); + } + + return utf8_strpos($str, $search, $offset); + } + + /** + * UTF-8 aware alternative to strrpos + * Finds position of last occurrence of a string + * + * @param string $str String being examined. + * @param string $search String being searched for. + * @param integer $offset Offset from the left of the string. + * + * @return mixed Number of characters before the last match or false on failure + * + * @see http://www.php.net/strrpos + * @since 1.3.0 + */ + public static function strrpos($str, $search, $offset = 0) + { + return utf8_strrpos($str, $search, $offset); + } + + /** + * UTF-8 aware alternative to substr + * Return part of a string given character offset (and optionally length) + * + * @param string $str String being processed + * @param integer $offset Number of UTF-8 characters offset (from left) + * @param integer $length Optional length in UTF-8 characters from offset + * + * @return mixed string or FALSE if failure + * + * @see http://www.php.net/substr + * @since 1.3.0 + */ + public static function substr($str, $offset, $length = false) + { + if ($length === false) + { + return utf8_substr($str, $offset); + } + + return utf8_substr($str, $offset, $length); + } + + /** + * UTF-8 aware alternative to strtlower + * + * Make a string lowercase + * Note: The concept of a characters "case" only exists is some alphabets + * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does + * not exist in the Chinese alphabet, for example. See Unicode Standard + * Annex #21: Case Mappings + * + * @param string $str String being processed + * + * @return mixed Either string in lowercase or FALSE is UTF-8 invalid + * + * @see http://www.php.net/strtolower + * @since 1.3.0 + */ + public static function strtolower($str) + { + return utf8_strtolower($str); + } + + /** + * UTF-8 aware alternative to strtoupper + * Make a string uppercase + * Note: The concept of a characters "case" only exists is some alphabets + * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does + * not exist in the Chinese alphabet, for example. See Unicode Standard + * Annex #21: Case Mappings + * + * @param string $str String being processed + * + * @return mixed Either string in uppercase or FALSE is UTF-8 invalid + * + * @see http://www.php.net/strtoupper + * @since 1.3.0 + */ + public static function strtoupper($str) + { + return utf8_strtoupper($str); + } + + /** + * UTF-8 aware alternative to strlen. + * + * Returns the number of characters in the string (NOT THE NUMBER OF BYTES), + * + * @param string $str UTF-8 string. + * + * @return integer Number of UTF-8 characters in string. + * + * @see http://www.php.net/strlen + * @since 1.3.0 + */ + public static function strlen($str) + { + return utf8_strlen($str); + } + + /** + * UTF-8 aware alternative to str_ireplace + * Case-insensitive version of str_replace + * + * @param string $search String to search + * @param string $replace Existing string to replace + * @param string $str New string to replace with + * @param integer $count Optional count value to be passed by referene + * + * @return string UTF-8 String + * + * @see http://www.php.net/str_ireplace + * @since 1.3.0 + */ + public static function str_ireplace($search, $replace, $str, $count = null) + { + require_once __DIR__ . '/phputf8/str_ireplace.php'; + + if ($count === false) + { + return utf8_ireplace($search, $replace, $str); + } + + return utf8_ireplace($search, $replace, $str, $count); + } + + /** + * UTF-8 aware alternative to str_split + * Convert a string to an array + * + * @param string $str UTF-8 encoded string to process + * @param integer $split_len Number to characters to split string by + * + * @return array + * + * @see http://www.php.net/str_split + * @since 1.3.0 + */ + public static function str_split($str, $split_len = 1) + { + require_once __DIR__ . '/phputf8/str_split.php'; + + return utf8_str_split($str, $split_len); + } + + /** + * UTF-8/LOCALE aware alternative to strcasecmp + * A case insensitive string comparison + * + * @param string $str1 string 1 to compare + * @param string $str2 string 2 to compare + * @param mixed $locale The locale used by strcoll or false to use classical comparison + * + * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. + * + * @see http://www.php.net/strcasecmp + * @see http://www.php.net/strcoll + * @see http://www.php.net/setlocale + * @since 1.3.0 + */ + public static function strcasecmp($str1, $str2, $locale = false) + { + if ($locale) + { + // Get current locale + $locale0 = setlocale(LC_COLLATE, 0); + + if (!$locale = setlocale(LC_COLLATE, $locale)) + { + $locale = $locale0; + } + + // See if we have successfully set locale to UTF-8 + if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) + { + $encoding = 'CP' . $m[1]; + } + elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) + { + $encoding = 'UTF-8'; + } + else + { + $encoding = 'nonrecodable'; + } + + // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode + if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') + { + return strcoll(utf8_strtolower($str1), utf8_strtolower($str2)); + } + + return strcoll( + self::transcode(utf8_strtolower($str1), 'UTF-8', $encoding), + self::transcode(utf8_strtolower($str2), 'UTF-8', $encoding) + ); + } + + return utf8_strcasecmp($str1, $str2); + } + + /** + * UTF-8/LOCALE aware alternative to strcmp + * A case sensitive string comparison + * + * @param string $str1 string 1 to compare + * @param string $str2 string 2 to compare + * @param mixed $locale The locale used by strcoll or false to use classical comparison + * + * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. + * + * @see http://www.php.net/strcmp + * @see http://www.php.net/strcoll + * @see http://www.php.net/setlocale + * @since 1.3.0 + */ + public static function strcmp($str1, $str2, $locale = false) + { + if ($locale) + { + // Get current locale + $locale0 = setlocale(LC_COLLATE, 0); + + if (!$locale = setlocale(LC_COLLATE, $locale)) + { + $locale = $locale0; + } + + // See if we have successfully set locale to UTF-8 + if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) + { + $encoding = 'CP' . $m[1]; + } + elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8')) + { + $encoding = 'UTF-8'; + } + else + { + $encoding = 'nonrecodable'; + } + + // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode + if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') + { + return strcoll($str1, $str2); + } + + return strcoll(self::transcode($str1, 'UTF-8', $encoding), self::transcode($str2, 'UTF-8', $encoding)); + } + + return strcmp($str1, $str2); + } + + /** + * UTF-8 aware alternative to strcspn + * Find length of initial segment not matching mask + * + * @param string $str The string to process + * @param string $mask The mask + * @param integer $start Optional starting character position (in characters) + * @param integer $length Optional length + * + * @return integer The length of the initial segment of str1 which does not contain any of the characters in str2 + * + * @see http://www.php.net/strcspn + * @since 1.3.0 + */ + public static function strcspn($str, $mask, $start = null, $length = null) + { + require_once __DIR__ . '/phputf8/strcspn.php'; + + if ($start === false && $length === false) + { + return utf8_strcspn($str, $mask); + } + + if ($length === false) + { + return utf8_strcspn($str, $mask, $start); + } + + return utf8_strcspn($str, $mask, $start, $length); + } + + /** + * UTF-8 aware alternative to stristr + * Returns all of haystack from the first occurrence of needle to the end. + * needle and haystack are examined in a case-insensitive manner + * Find first occurrence of a string using case insensitive comparison + * + * @param string $str The haystack + * @param string $search The needle + * + * @return string the sub string + * + * @see http://www.php.net/stristr + * @since 1.3.0 + */ + public static function stristr($str, $search) + { + require_once __DIR__ . '/phputf8/stristr.php'; + + return utf8_stristr($str, $search); + } + + /** + * UTF-8 aware alternative to strrev + * Reverse a string + * + * @param string $str String to be reversed + * + * @return string The string in reverse character order + * + * @see http://www.php.net/strrev + * @since 1.3.0 + */ + public static function strrev($str) + { + require_once __DIR__ . '/phputf8/strrev.php'; + + return utf8_strrev($str); + } + + /** + * UTF-8 aware alternative to strspn + * Find length of initial segment matching mask + * + * @param string $str The haystack + * @param string $mask The mask + * @param integer $start Start optional + * @param integer $length Length optional + * + * @return integer + * + * @see http://www.php.net/strspn + * @since 1.3.0 + */ + public static function strspn($str, $mask, $start = null, $length = null) + { + require_once __DIR__ . '/phputf8/strspn.php'; + + if ($start === null && $length === null) + { + return utf8_strspn($str, $mask); + } + + if ($length === null) + { + return utf8_strspn($str, $mask, $start); + } + + return utf8_strspn($str, $mask, $start, $length); + } + + /** + * UTF-8 aware substr_replace + * Replace text within a portion of a string + * + * @param string $str The haystack + * @param string $repl The replacement string + * @param integer $start Start + * @param integer $length Length (optional) + * + * @return string + * + * @see http://www.php.net/substr_replace + * @since 1.3.0 + */ + public static function substr_replace($str, $repl, $start, $length = null) + { + // Loaded by library loader + if ($length === false) + { + return utf8_substr_replace($str, $repl, $start); + } + + return utf8_substr_replace($str, $repl, $start, $length); + } + + /** + * UTF-8 aware replacement for ltrim() + * + * Strip whitespace (or other characters) from the beginning of a string + * You only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise ltrim will + * work normally on a UTF-8 string + * + * @param string $str The string to be trimmed + * @param string $charlist The optional charlist of additional characters to trim + * + * @return string The trimmed string + * + * @see http://www.php.net/ltrim + * @since 1.3.0 + */ + public static function ltrim($str, $charlist = false) + { + if (empty($charlist) && $charlist !== false) + { + return $str; + } + + require_once __DIR__ . '/phputf8/trim.php'; + + if ($charlist === false) + { + return utf8_ltrim($str); + } + + return utf8_ltrim($str, $charlist); + } + + /** + * UTF-8 aware replacement for rtrim() + * Strip whitespace (or other characters) from the end of a string + * You only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise rtrim will + * work normally on a UTF-8 string + * + * @param string $str The string to be trimmed + * @param string $charlist The optional charlist of additional characters to trim + * + * @return string The trimmed string + * + * @see http://www.php.net/rtrim + * @since 1.3.0 + */ + public static function rtrim($str, $charlist = false) + { + if (empty($charlist) && $charlist !== false) + { + return $str; + } + + require_once __DIR__ . '/phputf8/trim.php'; + + if ($charlist === false) + { + return utf8_rtrim($str); + } + + return utf8_rtrim($str, $charlist); + } + + /** + * UTF-8 aware replacement for trim() + * Strip whitespace (or other characters) from the beginning and end of a string + * Note: you only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise trim will + * work normally on a UTF-8 string + * + * @param string $str The string to be trimmed + * @param string $charlist The optional charlist of additional characters to trim + * + * @return string The trimmed string + * + * @see http://www.php.net/trim + * @since 1.3.0 + */ + public static function trim($str, $charlist = false) + { + if (empty($charlist) && $charlist !== false) + { + return $str; + } + + require_once __DIR__ . '/phputf8/trim.php'; + + if ($charlist === false) + { + return utf8_trim($str); + } + + return utf8_trim($str, $charlist); + } + + /** + * UTF-8 aware alternative to ucfirst + * Make a string's first character uppercase or all words' first character uppercase + * + * @param string $str String to be processed + * @param string $delimiter The words delimiter (null means do not split the string) + * @param string $newDelimiter The new words delimiter (null means equal to $delimiter) + * + * @return string If $delimiter is null, return the string with first character as upper case (if applicable) + * else consider the string of words separated by the delimiter, apply the ucfirst to each words + * and return the string with the new delimiter + * + * @see http://www.php.net/ucfirst + * @since 1.3.0 + */ + public static function ucfirst($str, $delimiter = null, $newDelimiter = null) + { + require_once __DIR__ . '/phputf8/ucfirst.php'; + + if ($delimiter === null) + { + return utf8_ucfirst($str); + } + + if ($newDelimiter === null) + { + $newDelimiter = $delimiter; + } + + return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); + } + + /** + * UTF-8 aware alternative to ucwords + * Uppercase the first character of each word in a string + * + * @param string $str String to be processed + * + * @return string String with first char of each word uppercase + * + * @see http://www.php.net/ucwords + * @since 1.3.0 + */ + public static function ucwords($str) + { + require_once __DIR__ . '/phputf8/ucwords.php'; + + return utf8_ucwords($str); + } + + /** + * Transcode a string. + * + * @param string $source The string to transcode. + * @param string $from_encoding The source encoding. + * @param string $to_encoding The target encoding. + * + * @return mixed The transcoded string, or null if the source was not a string. + * + * @link https://bugs.php.net/bug.php?id=48147 + * + * @since 1.3.0 + */ + public static function transcode($source, $from_encoding, $to_encoding) + { + if (is_string($source)) + { + switch (ICONV_IMPL) + { + case 'glibc': + return @iconv($from_encoding, $to_encoding . '//TRANSLIT,IGNORE', $source); + + case 'libiconv': + default: + return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source); + } + } + + return null; + } + + /** + * Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard. + * + * Note: this function has been modified to simple return true or false. + * + * @param string $str UTF-8 encoded string. + * + * @return boolean true if valid + * + * @author + * @see http://hsivonen.iki.fi/php-utf8/ + * @see compliant + * @since 1.3.0 + */ + public static function valid($str) + { + require_once __DIR__ . '/phputf8/utils/validation.php'; + + return utf8_is_valid($str); + } + + /** + * Tests whether a string complies as UTF-8. This will be much + * faster than utf8_is_valid but will pass five and six octet + * UTF-8 sequences, which are not supported by Unicode and + * so cannot be displayed correctly in a browser. In other words + * it is not as strict as utf8_is_valid but it's faster. If you use + * it to validate user input, you place yourself at the risk that + * attackers will be able to inject 5 and 6 byte sequences (which + * may or may not be a significant risk, depending on what you are + * are doing) + * + * @param string $str UTF-8 string to check + * + * @return boolean TRUE if string is valid UTF-8 + * + * @see valid + * @see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 + * @since 1.3.0 + */ + public static function compliant($str) + { + require_once __DIR__ . '/phputf8/utils/validation.php'; + + return utf8_compliant($str); + } + + /** + * Converts Unicode sequences to UTF-8 string + * + * @param string $str Unicode string to convert + * + * @return string UTF-8 string + * + * @since 1.3.0 + */ + public static function unicode_to_utf8($str) + { + if (extension_loaded('mbstring')) + { + return preg_replace_callback( + '/\\\\u([0-9a-fA-F]{4})/', + function ($match) + { + return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); + }, + $str + ); + } + + return $str; + } + + /** + * Converts Unicode sequences to UTF-16 string + * + * @param string $str Unicode string to convert + * + * @return string UTF-16 string + * + * @since 1.3.0 + */ + public static function unicode_to_utf16($str) + { + if (extension_loaded('mbstring')) + { + return preg_replace_callback( + '/\\\\u([0-9a-fA-F]{4})/', + function ($match) + { + return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE'); + }, + $str + ); + } + + return $str; + } +} diff --git a/libraries/vendor/joomla/utilities/src/ArrayHelper.php b/libraries/vendor/joomla/utilities/src/ArrayHelper.php index ea4e764a63911..dde3f4250b121 100644 --- a/libraries/vendor/joomla/utilities/src/ArrayHelper.php +++ b/libraries/vendor/joomla/utilities/src/ArrayHelper.php @@ -2,13 +2,13 @@ /** * Part of the Joomla Framework Utilities Package * - * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\Utilities; -use Joomla\String\String; +use Joomla\String\StringHelper; /** * ArrayHelper is an array utility class for doing all sorts of odds and ends with arrays. @@ -512,11 +512,11 @@ public static function sortObjects(array $a, $k, $direction = 1, $caseSensitive } elseif ($caseSensitive) { - $cmp = String::strcmp($va, $vb, $locale); + $cmp = StringHelper::strcmp($va, $vb, $locale); } else { - $cmp = String::strcasecmp($va, $vb, $locale); + $cmp = StringHelper::strcasecmp($va, $vb, $locale); } if ($cmp > 0) diff --git a/tests/unit/suites/libraries/joomla/registry/JRegistryFormatTest.php b/tests/unit/suites/libraries/joomla/registry/JRegistryFormatTest.php deleted file mode 100644 index 39520edd7c4f7..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/JRegistryFormatTest.php +++ /dev/null @@ -1,66 +0,0 @@ -assertInstanceOf( - 'JRegistryFormatINI', - $object - ); - - // Test JSON format. - $object = JRegistryFormat::getInstance('JSON'); - $this->assertInstanceOf( - 'JRegistryFormatJSON', - $object - ); - - // Test PHP format. - $object = JRegistryFormat::getInstance('PHP'); - $this->assertInstanceOf( - 'JRegistryFormatPHP', - $object - ); - - // Test XML format. - $object = JRegistryFormat::getInstance('XML'); - $this->assertInstanceOf( - 'JRegistryFormatXML', - $object - ); - - // Test non-existing format. - try - { - $object = JRegistryFormat::getInstance('SQL'); - } - catch (Exception $e) - { - return; - } - $this->fail('JRegistryFormat should throw an exception in case of non-existing formats'); - } -} diff --git a/tests/unit/suites/libraries/joomla/registry/JRegistryTest.php b/tests/unit/suites/libraries/joomla/registry/JRegistryTest.php deleted file mode 100644 index 01e52c2d095c9..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/JRegistryTest.php +++ /dev/null @@ -1,612 +0,0 @@ - '123', 'b' => '456')); - $a->set('foo', 'bar'); - $b = clone $a; - - $this->assertThat( - serialize($a), - $this->equalTo(serialize($b)) - ); - - $this->assertThat( - $a, - $this->logicalNot($this->identicalTo($b)), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::__toString method. - * - * @covers JRegistry::__toString - * - * @return void - */ - public function test__toString() - { - $object = new stdClass; - $a = new JRegistry($object); - $a->set('foo', 'bar'); - - // __toString only allows for a JSON value. - $this->assertThat( - (string) $a, - $this->equalTo('{"foo":"bar"}'), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::jsonSerialize method. - * - * @covers JRegistry::jsonSerialize - * - * @return void - */ - public function testJsonSerialize() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) - { - $this->markTestSkipped('This test requires PHP 5.4 or newer.'); - } - - $object = new stdClass; - $a = new JRegistry($object); - $a->set('foo', 'bar'); - - // __toString only allows for a JSON value. - $this->assertThat( - json_encode($a), - $this->equalTo('{"foo":"bar"}'), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Tests serializing JRegistry objects. - * - * @return void - */ - public function testSerialize() - { - $a = new JRegistry; - $a->set('foo', 'bar'); - - $serialized = serialize($a); - $b = unserialize($serialized); - - // __toString only allows for a JSON value. - $this->assertThat( - $b, - $this->equalTo($a), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::def method. - * - * @covers JRegistry::def - * - * @return void - */ - public function testDef() - { - $a = new JRegistry; - - $this->assertThat( - $a->def('foo', 'bar'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '. def should return default value' - ); - - $this->assertThat( - $a->get('foo'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '. default should now be the current value' - ); - } - - /** - * Tet the JRegistry::bindData method. - * - * @covers JRegistry::bindData - * - * @return void - */ - public function testBindData() - { - $a = new JRegistryInspector; - $parent = new stdClass; - - $a->bindData($parent, 'foo'); - $this->assertThat( - $parent->{0}, - $this->equalTo('foo'), - 'Line: ' . __LINE__ . ' The input value should exist in the parent object.' - ); - - $a->bindData($parent, array('foo' => 'bar')); - $this->assertThat( - $parent->{'foo'}, - $this->equalTo('bar'), - 'Line: ' . __LINE__ . ' The input value should exist in the parent object.' - ); - - $a->bindData($parent, array('level1' => array('level2' => 'value2'))); - $this->assertThat( - $parent->{'level1'}->{'level2'}, - $this->equalTo('value2'), - 'Line: ' . __LINE__ . ' The input value should exist in the parent object.' - ); - - $a->bindData($parent, array('intarray' => array(0, 1, 2))); - $this->assertThat( - $parent->{'intarray'}, - $this->equalTo(array(0, 1, 2)), - 'Line: ' . __LINE__ . ' The un-associative array should bind natively.' - ); - } - - /** - * Test the JRegistry::exists method. - * - * @covers JRegistry::exists - * - * @return void - */ - public function testExists() - { - $a = new JRegistry; - $a->set('foo', 'bar1'); - $a->set('config.foo', 'bar2'); - $a->set('deep.level.foo', 'bar3'); - - $this->assertThat( - $a->exists('foo'), - $this->isTrue(), - 'Line: ' . __LINE__ . ' The path should exist, returning true.' - ); - - $this->assertThat( - $a->exists('config.foo'), - $this->isTrue(), - 'Line: ' . __LINE__ . ' The path should exist, returning true.' - ); - - $this->assertThat( - $a->exists('deep.level.foo'), - $this->isTrue(), - 'Line: ' . __LINE__ . ' The path should exist, returning true.' - ); - - $this->assertThat( - $a->exists('deep.level.bar'), - $this->isFalse(), - 'Line: ' . __LINE__ . ' The path should not exist, returning false.' - ); - - $this->assertThat( - $a->exists('bar.foo'), - $this->isFalse(), - 'Line: ' . __LINE__ . ' The path should not exist, returning false.' - ); - } - - /** - * Test the JRegistry::get method - * - * @covers JRegistry::get - * - * @return void - */ - public function testGet() - { - $a = new JRegistry; - $a->set('foo', 'bar'); - $this->assertEquals('bar', $a->get('foo'), 'Line: ' . __LINE__ . ' get method should work.'); - $this->assertNull($a->get('xxx.yyy'), 'Line: ' . __LINE__ . ' get should return null when not found.'); - } - - /** - * Test the JRegistry::getInstance method. - * - * @covers JRegistry::getInstance - * - * @return void - */ - public function testGetInstance() - { - // Test INI format. - $a = JRegistry::getInstance('a'); - $b = JRegistry::getInstance('a'); - $c = JRegistry::getInstance('c'); - - // Check the object type. - $this->assertThat( - $a instanceof JRegistry, - $this->isTrue(), - 'Line: ' . __LINE__ . '.' - ); - - // Check cache handling for same registry id. - $this->assertThat( - $a, - $this->identicalTo($b), - 'Line: ' . __LINE__ . '.' - ); - - // Check cache handling for different registry id. - $this->assertThat( - $a, - $this->logicalNot($this->identicalTo($c)), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::loadArray method. - * - * @covers JRegistry::loadArray - * - * @return void - */ - public function testLoadArray() - { - $array = array( - 'foo' => 'bar' - ); - $registry = new JRegistry; - $result = $registry->loadArray($array); - - // Result is always true, no error checking in method. - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::loadFile method. - * - * @covers JRegistry::loadFile - * - * @return void - */ - public function testLoadFile() - { - $registry = new JRegistry; - - // Result is always true, no error checking in method. - - // JSON. - $result = $registry->loadFile(__DIR__ . '/stubs/jregistry.json'); - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '.' - ); - - // INI. - $result = $registry->loadFile(__DIR__ . '/stubs/jregistry.ini', 'ini'); - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '.' - ); - - // INI + section. - $result = $registry->loadFile(__DIR__ . '/stubs/jregistry.ini', 'ini', array('processSections' => true)); - - // Test getting a known value. - $this->assertThat( - $registry->get('section.foo'), - $this->equalTo('bar'), - 'Line: ' . __LINE__ . '.' - ); - - // XML and PHP versions do not support stringToObject. - } - - /** - * Test the JRegistry::loadString() method. - * - * @covers JRegistry::loadString - * - * @return void - */ - public function testLoadString() - { - $registry = new JRegistry; - $result = $registry->loadString('foo="testloadini1"', 'INI'); - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('testloadini1'), - 'Line: ' . __LINE__ . '.' - ); - - $result = $registry->loadString("[section]\nfoo=\"testloadini2\"", 'INI'); - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('testloadini2'), - 'Line: ' . __LINE__ . '.' - ); - - $result = $registry->loadString("[section]\nfoo=\"testloadini3\"", 'INI', array('processSections' => true)); - - // Test getting a known value after processing sections. - $this->assertThat( - $registry->get('section.foo'), - $this->equalTo('testloadini3'), - 'Line: ' . __LINE__ . '.' - ); - - $string = '{"foo":"testloadjson"}'; - - $registry = new JRegistry; - $result = $registry->loadString($string); - - // Result is always true, no error checking in method. - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('testloadjson'), - 'Line: ' . __LINE__ . '.' - ); - - } - - /** - * Test the JRegistry::loadObject method. - * - * @covers JRegistry::loadObject - * - * @return void - */ - public function testLoadObject() - { - $object = new stdClass; - $object->foo = 'testloadobject'; - - $registry = new JRegistry; - $result = $registry->loadObject($object); - - // Result is always true, no error checking in method. - - // Test getting a known value. - $this->assertThat( - $registry->get('foo'), - $this->equalTo('testloadobject'), - 'Line: ' . __LINE__ . '.' - ); - - // Test case from Tracker Issue 22444 - $registry = new JRegistry; - $object = new JObject; - $object2 = new JObject; - $object2->set('test', 'testcase'); - $object->set('test', $object2); - $this->assertInstanceOf( - 'JRegistry', - $registry->loadObject($object), - 'Line: ' . __LINE__ . '. Should load object successfully' - ); - } - - /** - * Test the JRegistry::merge method. - * - * @covers JRegistry::merge - * - * @return void - */ - public function testMerge() - { - $array1 = array( - 'foo' => 'bar', - 'hoo' => 'hum', - 'dum' => array( - 'dee' => 'dum' - ) - ); - - $array2 = array( - 'foo' => 'soap', - 'dum' => 'huh' - ); - $registry1 = new JRegistry; - $registry1->loadArray($array1); - - $registry2 = new JRegistry; - $registry2->loadArray($array2); - - $registry1->merge($registry2); - - // Test getting a known value. - $this->assertThat( - $registry1->get('foo'), - $this->equalTo('soap'), - 'Line: ' . __LINE__ . '.' - ); - - $this->assertThat( - $registry1->get('dum'), - $this->equalTo('huh'), - 'Line: ' . __LINE__ . '.' - ); - - // Test merge with zero and blank value - $json1 = '{"param1":1, "param2":"value2"}'; - $json2 = '{"param1":2, "param2":"", "param3":0, "param4":-1, "param5":1}'; - $a = new JRegistry($json1); - $b = new JRegistry; - $b->loadString($json2, 'JSON'); - $a->merge($b); - - // New param with zero value should show in merged registry - $this->assertEquals(2, $a->get('param1'), '$b value should override $a value'); - $this->assertEquals('value2', $a->get('param2'), '$a value should override blank $b value'); - $this->assertEquals(0, $a->get('param3'), '$b value of 0 should override $a value'); - $this->assertEquals(-1, $a->get('param4'), '$b value of -1 should override $a value'); - $this->assertEquals(1, $a->get('param5'), '$b value of 1 should override $a value'); - - $a = new JRegistry; - $b = new stdClass; - $this->assertFalse($a->merge($b), 'Line: ' . __LINE__ . '. Attempt to merge non JRegistry should return false'); - } - - /** - * Test the JRegistry::set method. - * - * @covers JRegistry::set - * - * @return void - */ - public function testSet() - { - $a = new JRegistry; - $a->set('foo', 'testsetvalue1'); - - $this->assertThat( - $a->set('foo', 'testsetvalue2'), - $this->equalTo('testsetvalue2'), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::toArray method. - * - * @covers JRegistry::toArray - * - * @return void - */ - public function testToArray() - { - $a = new JRegistry; - $a->set('foo1', 'testtoarray1'); - $a->set('foo2', 'testtoarray2'); - $a->set('config.foo3', 'testtoarray3'); - - $expected = array( - 'foo1' => 'testtoarray1', - 'foo2' => 'testtoarray2', - 'config' => array('foo3' => 'testtoarray3') - ); - - $this->assertThat( - $a->toArray(), - $this->equalTo($expected), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::toObject method. - * - * @covers JRegistry::toObject - * - * @return void - */ - public function testToObject() - { - $a = new JRegistry; - $a->set('foo1', 'testtoobject1'); - $a->set('foo2', 'testtoobject2'); - $a->set('config.foo3', 'testtoobject3'); - - $expected = new stdClass; - $expected->foo1 = 'testtoobject1'; - $expected->foo2 = 'testtoobject2'; - $expected->config = new StdClass; - $expected->config->foo3 = 'testtoobject3'; - - $this->assertThat( - $a->toObject(), - $this->equalTo($expected), - 'Line: ' . __LINE__ . '.' - ); - } - - /** - * Test the JRegistry::toString method. - * - * @covers JRegistry::toString - * - * @return void - */ - public function testToString() - { - $a = new JRegistry; - $a->set('foo1', 'testtostring1'); - $a->set('foo2', 'testtostring2'); - $a->set('config.foo3', 'testtostring3'); - - $this->assertThat( - trim($a->toString('JSON')), - $this->equalTo( - '{"foo1":"testtostring1","foo2":"testtostring2","config":{"foo3":"testtostring3"}}' - ), - 'Line: ' . __LINE__ . '.' - ); - - $this->assertThat( - trim($a->toString('INI')), - $this->equalTo( - "foo1=\"testtostring1\"\nfoo2=\"testtostring2\"\n\n[config]\nfoo3=\"testtostring3\"" - ), - 'Line: ' . __LINE__ . '.' - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php deleted file mode 100644 index 8590dada8ab56..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php +++ /dev/null @@ -1,109 +0,0 @@ -foo = 'bar'; - $object->booleantrue = true; - $object->booleanfalse = false; - $object->numericint = 42; - $object->numericfloat = 3.1415; - $object->section = new stdClass; - $object->section->key = 'value'; - - // Test basic object to string. - $string = $class->objectToString($object); - $this->assertThat( - trim($string), - $this->equalTo("foo=\"bar\"\nbooleantrue=true\nbooleanfalse=false\nnumericint=42\nnumericfloat=3.1415\n\n[section]\nkey=\"value\"") - ); - } - - /** - * Test the JRegistryFormatINI::stringToObject method. - * - * @return void - */ - public function testStringToObject() - { - $class = JRegistryFormat::getInstance('INI'); - - $string2 = "[section]\nfoo=bar"; - - $object1 = new stdClass; - $object1->foo = 'bar'; - - $object2 = new stdClass; - $object2->section = $object1; - - // Test INI format string without sections. - $object = $class->stringToObject($string2, array('processSections' => false)); - $this->assertThat( - $object, - $this->equalTo($object1) - ); - - // Test INI format string with sections. - $object = $class->stringToObject($string2, array('processSections' => true)); - $this->assertThat( - $object, - $this->equalTo($object2) - ); - - // Test empty string - $this->assertThat( - $class->stringToObject(null), - $this->equalTo(new stdClass) - ); - - $string3 = "[section]\nfoo=bar\n;Testcomment\nkey=value\n\n/brokenkey=)brokenvalue"; - $object2->section->key = 'value'; - - $this->assertThat( - $class->stringToObject($string3, array('processSections' => true)), - $this->equalTo($object2) - ); - - $string4 = "boolfalse=false\nbooltrue=true\nkeywithoutvalue\nnumericfloat=3.1415\nnumericint=42\nkey=\"value\""; - $object3 = new stdClass; - $object3->boolfalse = false; - $object3->booltrue = true; - $object3->numericfloat = 3.1415; - $object3->numericint = 42; - $object3->key = 'value'; - - $this->assertThat( - $class->stringToObject($string4), - $this->equalTo($object3) - ); - - // Trigger the cache - Doing this only to achieve 100% code coverage. ;-) - $this->assertThat( - $class->stringToObject($string4), - $this->equalTo($object3) - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatJsonTest.php b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatJsonTest.php deleted file mode 100644 index e2266c99aa80a..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatJsonTest.php +++ /dev/null @@ -1,118 +0,0 @@ -foo = 'bar'; - $object->quoted = '"stringwithquotes"'; - $object->booleantrue = true; - $object->booleanfalse = false; - $object->numericint = 42; - $object->numericfloat = 3.1415; - - // The PHP registry format does not support nested objects - $object->section = new stdClass; - $object->section->key = 'value'; - $object->array = array('nestedarray' => array('test1' => 'value1')); - - $string = '{"foo":"bar","quoted":"\"stringwithquotes\"",' . - '"booleantrue":true,"booleanfalse":false,' . - '"numericint":42,"numericfloat":3.1415,' . - '"section":{"key":"value"},' . - '"array":{"nestedarray":{"test1":"value1"}}' . - '}'; - - // Test basic object to string. - $this->assertThat( - $class->objectToString($object, $options), - $this->equalTo($string) - ); - } - - /** - * Test the JRegistryFormatJSON::stringToObject method. - * - * @return void - */ - public function testStringToObject() - { - $class = new JRegistryFormatJSON; - - $string1 = '{"title":"Joomla Framework","author":"Me","params":{"show_title":1,"show_abstract":0,"show_author":1,"categories":[1,2]}}'; - $string2 = "[section]\nfoo=bar"; - - $object1 = new stdClass; - $object1->title = 'Joomla Framework'; - $object1->author = 'Me'; - $object1->params = new stdClass; - $object1->params->show_title = 1; - $object1->params->show_abstract = 0; - $object1->params->show_author = 1; - $object1->params->categories = array(1, 2); - - $object2 = new stdClass; - $object2->section = new stdClass; - $object2->section->foo = 'bar'; - - $object3 = new stdClass; - $object3->foo = 'bar'; - - // Test basic JSON string to object. - $object = $class->stringToObject($string1, array('processSections' => false)); - $this->assertThat( - $object, - $this->equalTo($object1), - 'Line:' . __LINE__ . ' The complex JSON string should convert into the appropriate object.' - ); - - // Test INI format string without sections. - $object = $class->stringToObject($string2, array('processSections' => false)); - $this->assertThat( - $object, - $this->equalTo($object3), - 'Line:' . __LINE__ . ' The INI string should convert into an object without sections.' - ); - - // Test INI format string with sections. - $object = $class->stringToObject($string2, array('processSections' => true)); - $this->assertThat( - $object, - $this->equalTo($object2), - 'Line:' . __LINE__ . ' The INI string should covert into an object with sections.' - ); - - /** - * Test for bad input - * Everything that is not starting with { is handled by - * JRegistryFormatIni, which we test seperately - */ - $this->assertThat( - $class->stringToObject('{key:\'value\''), - $this->equalTo(false) - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatPhpTest.php b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatPhpTest.php deleted file mode 100644 index 77689e0b27392..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatPhpTest.php +++ /dev/null @@ -1,71 +0,0 @@ - 'myClass'); - $object = new stdClass; - $object->foo = 'bar'; - $object->quoted = '"stringwithquotes"'; - $object->booleantrue = true; - $object->booleanfalse = false; - $object->numericint = 42; - $object->numericfloat = 3.1415; - - // The PHP registry format does not support nested objects - $object->section = new stdClass; - $object->section->key = 'value'; - $object->array = array('nestedarray' => array('test1' => 'value1')); - - $string = " \"value\");\n" . - "\tpublic \$array = array(\"nestedarray\" => array(\"test1\" => \"value1\"));\n" . - "}\n?>"; - $this->assertThat( - $class->objectToString($object, $options), - $this->equalTo($string) - ); - } - - /** - * Test the JRegistryFormatPHP::stringToObject method. - * - * @return void - */ - public function testStringToObject() - { - $class = JRegistryFormat::getInstance('PHP'); - - // This method is not implemented in the class. The test is to achieve 100% code coverage - $this->assertTrue($class->stringToObject('')); - } -} diff --git a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatXmlTest.php b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatXmlTest.php deleted file mode 100644 index 6ded6bdee54bb..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatXmlTest.php +++ /dev/null @@ -1,103 +0,0 @@ -foo = 'bar'; - $object->quoted = '"stringwithquotes"'; - $object->booleantrue = true; - $object->booleanfalse = false; - $object->numericint = 42; - $object->numericfloat = 3.1415; - $object->section = new stdClass; - $object->section->key = 'value'; - $object->array = array('nestedarray' => array('test1' => 'value1')); - - $string = "\n" . - "bar" . - "\"stringwithquotes\"" . - "1" . - "" . - "42" . - "3.1415" . - "" . - "value" . - "" . - "" . - "" . - "value1" . - "" . - "" . - "\n"; - - // Test basic object to string. - $this->assertXmlStringEqualsXmlString( - $class->objectToString($object, $options), - $string - ); - } - - /** - * Test the JRegistryFormatXML::stringToObject method. - * - * @return void - */ - public function testStringToObject() - { - $class = JRegistryFormat::getInstance('XML'); - $object = new stdClass; - $object->foo = 'bar'; - $object->booleantrue = true; - $object->booleanfalse = false; - $object->numericint = 42; - $object->numericfloat = 3.1415; - $object->section = new stdClass; - $object->section->key = 'value'; - $object->array = array('test1' => 'value1'); - - $string = "\n" . - "bar" . - "1" . - "" . - "42" . - "3.1415" . - "" . - "value" . - "" . - "" . - "value1" . - "" . - "\n"; - - // Test basic object to string. - $this->assertThat( - $class->stringToObject($string), - $this->equalTo($object) - ); - } - -} diff --git a/tests/unit/suites/libraries/joomla/registry/stubs/JRegistryInspector.php b/tests/unit/suites/libraries/joomla/registry/stubs/JRegistryInspector.php deleted file mode 100644 index 7af12476e0ccb..0000000000000 --- a/tests/unit/suites/libraries/joomla/registry/stubs/JRegistryInspector.php +++ /dev/null @@ -1,31 +0,0 @@ -inflector = JStringInflector::getInstance(true); - } - - /** - * Method to test JStringInflector::addRule(). - * - * @return void - * - * @since 12.1 - */ - public function testAddRule() - { - // Case 1 - TestReflection::invoke($this->inflector, 'addRule', '/foo/', 'singular'); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('/foo/', $rules['singular']), - $this->isTrue(), - 'Checks if the singular rule was added correctly.' - ); - - // Case 2 - TestReflection::invoke($this->inflector, 'addRule', '/bar/', 'plural'); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('/bar/', $rules['plural']), - $this->isTrue(), - 'Checks if the plural rule was added correctly.' - ); - - // Case 3 - TestReflection::invoke($this->inflector, 'addRule', array('/goo/', '/car/'), 'singular'); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('/goo/', $rules['singular']), - $this->isTrue(), - 'Checks if an array of rules was added correctly (1).' - ); - - $this->assertThat( - in_array('/car/', $rules['singular']), - $this->isTrue(), - 'Checks if an array of rules was added correctly (2).' - ); - } - - /** - * Method to test JStringInflector::addRule(). - * - * @return void - * - * @since 12.1 - * @expectedException InvalidArgumentException - */ - public function testaddRuleException() - { - TestReflection::invoke($this->inflector, 'addRule', new stdClass, 'singular'); - } - - /** - * Method to test JStringInflector::getCachedPlural(). - * - * @return void - * - * @since 12.1 - */ - public function testGetCachedPlural() - { - // Reset the cache. - TestReflection::setValue($this->inflector, 'cache', array('foo' => 'bar')); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'getCachedPlural', 'bar'), - $this->isFalse(), - 'Checks for an uncached plural.' - ); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'getCachedPlural', 'foo'), - $this->equalTo('bar'), - 'Checks for a cached plural word.' - ); - } - - /** - * Method to test JStringInflector::getCachedSingular(). - * - * @return void - * - * @since 12.1 - */ - public function testGetCachedSingular() - { - // Reset the cache. - TestReflection::setValue($this->inflector, 'cache', array('foo' => 'bar')); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'getCachedSingular', 'foo'), - $this->isFalse(), - 'Checks for an uncached singular.' - ); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'getCachedSingular', 'bar'), - $this->equalTo('foo'), - 'Checks for a cached singular word.' - ); - } - - /** - * Method to test JStringInflector::matchRegexRule(). - * - * @return void - * - * @since 12.1 - */ - public function testMatchRegexRule() - { - $this->assertThat( - TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyz', 'plural'), - $this->equalTo('xyzs'), - 'Checks pluralising against the basic regex.' - ); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyzs', 'singular'), - $this->equalTo('xyz'), - 'Checks singularising against the basic regex.' - ); - - $this->assertThat( - TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyz', 'singular'), - $this->isFalse(), - 'Checks singularising against an unmatched regex.' - ); - } - - /** - * Method to test JStringInflector::setCache(). - * - * @return void - * - * @since 12.1 - */ - public function testSetCache() - { - TestReflection::invoke($this->inflector, 'setCache', 'foo', 'bar'); - - $cache = TestReflection::getValue($this->inflector, 'cache'); - - $this->assertThat( - $cache['foo'], - $this->equalTo('bar'), - 'Checks the cache was set.' - ); - - TestReflection::invoke($this->inflector, 'setCache', 'foo', 'car'); - - $cache = TestReflection::getValue($this->inflector, 'cache'); - - $this->assertThat( - $cache['foo'], - $this->equalTo('car'), - 'Checks an existing value in the cache was reset.' - ); - } - - /** - * Method to test JStringInflector::addCountableRule(). - * - * @return void - * - * @since 12.1 - */ - public function testAddCountableRule() - { - // Add string. - $this->inflector->addCountableRule('foo'); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('foo', $rules['countable']), - $this->isTrue(), - 'Checks a countable rule was added.' - ); - - // Add array. - $this->inflector->addCountableRule(array('goo', 'car')); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('car', $rules['countable']), - $this->isTrue(), - 'Checks a countable rule was added by array.' - ); - } - - /** - * Method to test JStringInflector::addPluraliseRule(). - * - * @return void - * - * @since 12.1 - */ - public function testAddPluraliseRule() - { - $chain = $this->inflector->addPluraliseRule(array('/foo/', '/bar/')); - - $this->assertThat( - $chain, - $this->identicalTo($this->inflector), - 'Checks chaining.' - ); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('/bar/', $rules['plural']), - $this->isTrue(), - 'Checks a pluralisation rule was added.' - ); - } - - /** - * Method to test JStringInflector::addSingulariseRule(). - * - * @return void - * - * @since 12.1 - */ - public function testAddSingulariseRule() - { - $chain = $this->inflector->addSingulariseRule(array('/foo/', '/bar/')); - - $this->assertThat( - $chain, - $this->identicalTo($this->inflector), - 'Checks chaining.' - ); - - $rules = TestReflection::getValue($this->inflector, 'rules'); - - $this->assertThat( - in_array('/bar/', $rules['singular']), - $this->isTrue(), - 'Checks a singularisation rule was added.' - ); - } - - /** - * Method to test JStringInflector::getInstance(). - * - * @return void - * - * @since 12.1 - */ - public function testGetInstance() - { - $this->assertInstanceOf( - 'JStringInflector', - JStringInflector::getInstance(), - 'Check getInstance returns the right class.' - ); - - // Inject an instance an test. - TestReflection::setValue($this->inflector, 'instance', new stdClass); - - $this->assertThat( - JStringInflector::getInstance(), - $this->equalTo(new stdClass), - 'Checks singleton instance is returned.' - ); - - $this->assertInstanceOf( - 'JStringInflector', - JStringInflector::getInstance(true), - 'Check getInstance a fresh object with true argument even though the instance is set to something else.' - ); - } - - /** - * Method to test JStringInflector::isCountable(). - * - * @param string $input A string. - * @param boolean $expected The expected result of the function call. - * - * @return void - * - * @dataProvider seedIsCountable - * @since 12.1 - */ - public function testIsCountable($input, $expected) - { - $this->assertThat( - $this->inflector->isCountable($input), - $this->equalTo($expected) - ); - } - - /** - * Method to test JStringInflector::isPlural(). - * - * @param string $singular The singular form of a word. - * @param string $plural The plural form of a word. - * - * @return void - * - * @dataProvider seedSinglePlural - * @since 12.1 - */ - public function testIsPlural($singular, $plural) - { - $this->assertThat( - $this->inflector->isPlural($plural), - $this->isTrue(), - 'Checks the plural is a plural.' - ); - - if ($singular != $plural) - { - $this->assertThat( - $this->inflector->isPlural($singular), - $this->isFalse(), - 'Checks the singular is not plural.' - ); - } - } - - /** - * Method to test JStringInflector::isSingular(). - * - * @param string $singular The singular form of a word. - * @param string $plural The plural form of a word. - * - * @return void - * - * @dataProvider seedSinglePlural - * @since 12.1 - */ - public function testIsSingular($singular, $plural) - { - $this->assertThat( - $this->inflector->isSingular($singular), - $this->isTrue(), - 'Checks the singular is a singular.' - ); - - if ($singular != $plural) - { - $this->assertThat( - $this->inflector->isSingular($plural), - $this->isFalse(), - 'Checks the plural is not singular.' - ); - } - } - - /** - * Method to test JStringInflector::toPlural(). - * - * @param string $singular The singular form of a word. - * @param string $plural The plural form of a word. - * - * @return void - * - * @dataProvider seedSinglePlural - * @since 12.1 - */ - public function testToPlural($singular, $plural) - { - $this->assertThat( - $this->inflector->toPlural($singular), - $this->equalTo($plural) - ); - } - - /** - * Method to test JStringInflector::toPlural(). - * - * @param string $singular The singular form of a word. - * @param string $plural The plural form of a word. - * - * @return void - * - * @dataProvider seedSinglePlural - * @since 12.1 - */ - public function testToSingular($singular, $plural) - { - $this->assertThat( - $this->inflector->toSingular($plural), - $this->equalTo($singular) - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/string/JStringNormaliseTest.php b/tests/unit/suites/libraries/joomla/string/JStringNormaliseTest.php deleted file mode 100644 index 01c593af9f89f..0000000000000 --- a/tests/unit/suites/libraries/joomla/string/JStringNormaliseTest.php +++ /dev/null @@ -1,315 +0,0 @@ -assertEquals($expected, JStringNormalise::fromCamelcase($input)); - } - - /** - * Method to test JStringNormalise::fromCamelCase(string, true). - * - * @param string $input The input value for the method. - * @param string $expected The expected value from the method. - * - * @return void - * - * @dataProvider getFromCamelCaseData - * @since 11.3 - * @covers JStringNormalise::fromCamelcase - */ - public function testFromCamelCase_grouped($input, $expected) - { - $this->assertEquals($expected, JStringNormalise::fromCamelcase($input, true)); - } - - /** - * Method to test JStringNormalise::toCamelCase(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToCamelCase - * @since 11.3 - * @covers JStringNormalise::toCamelcase - */ - public function testToCamelCase($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toCamelcase($input)); - } - - /** - * Method to test JStringNormalise::toDashSeparated(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToDashSeparated - * @since 11.3 - * @covers JStringNormalise::toDashSeparated - */ - public function testToDashSeparated($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toDashSeparated($input)); - } - - /** - * Method to test JStringNormalise::toSpaceSeparated(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToSpaceSeparated - * @since 11.3 - * @covers JStringNormalise::toSpaceSeparated - */ - public function testToSpaceSeparated($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toSpaceSeparated($input)); - } - - /** - * Method to test JStringNormalise::toUnderscoreSeparated(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToUnderscoreSeparated - * @since 11.3 - * @covers JStringNormalise::toUnderscoreSeparated - */ - public function testToUnderscoreSeparated($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toUnderscoreSeparated($input)); - } - - /** - * Method to test JStringNormalise::toVariable(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToVariable - * @since 11.3 - * @covers JStringNormalise::toVariable - */ - public function testToVariable($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toVariable($input)); - } - - /** - * Method to test JStringNormalise::toKey(). - * - * @param string $expected The expected value from the method. - * @param string $input The input value for the method. - * - * @return void - * - * @dataProvider seedToKey - * @since 11.3 - * @covers JStringNormalise::toKey - */ - public function testToKey($expected, $input) - { - $this->assertEquals($expected, JStringNormalise::toKey($input)); - } - - /** - * Method to seed data to testFromCamelCase. - * - * @return array - * - * @since 11.3 - */ - public function seedFromCamelCase() - { - return array( - array('Foo Bar', 'FooBar'), - array('foo Bar', 'fooBar'), - array('Foobar', 'Foobar'), - array('foobar', 'foobar') - ); - } - - /** - * Method to seed data to testToCamelCase. - * - * @return array - * - * @since 11.3 - */ - public function seedToCamelCase() - { - return array( - array('FooBar', 'Foo Bar'), - array('FooBar', 'Foo-Bar'), - array('FooBar', 'Foo_Bar'), - array('FooBar', 'foo bar'), - array('FooBar', 'foo-bar'), - array('FooBar', 'foo_bar'), - ); - } - - /** - * Method to seed data to testToDashSeparated. - * - * @return array - * - * @since 11.3 - */ - public function seedToDashSeparated() - { - return array( - array('Foo-Bar', 'Foo Bar'), - array('Foo-Bar', 'Foo-Bar'), - array('Foo-Bar', 'Foo_Bar'), - array('foo-bar', 'foo bar'), - array('foo-bar', 'foo-bar'), - array('foo-bar', 'foo_bar'), - array('foo-bar', 'foo bar'), - array('foo-bar', 'foo---bar'), - array('foo-bar', 'foo___bar'), - ); - } - - /** - * Method to seed data to testToSpaceSeparated. - * - * @return array - * - * @since 11.3 - */ - public function seedToSpaceSeparated() - { - return array( - array('Foo Bar', 'Foo Bar'), - array('Foo Bar', 'Foo-Bar'), - array('Foo Bar', 'Foo_Bar'), - array('foo bar', 'foo bar'), - array('foo bar', 'foo-bar'), - array('foo bar', 'foo_bar'), - array('foo bar', 'foo bar'), - array('foo bar', 'foo---bar'), - array('foo bar', 'foo___bar'), - ); - } - - /** - * Method to seed data to testToUnderscoreSeparated. - * - * @return array - * - * @since 11.3 - */ - public function seedToUnderscoreSeparated() - { - return array( - array('Foo_Bar', 'Foo Bar'), - array('Foo_Bar', 'Foo-Bar'), - array('Foo_Bar', 'Foo_Bar'), - array('foo_bar', 'foo bar'), - array('foo_bar', 'foo-bar'), - array('foo_bar', 'foo_bar'), - array('foo_bar', 'foo bar'), - array('foo_bar', 'foo---bar'), - array('foo_bar', 'foo___bar'), - ); - } - - /** - * Method to seed data to testToVariable. - * - * @return array - * - * @since 11.3 - */ - public function seedToVariable() - { - return array( - array('myFooBar', 'My Foo Bar'), - array('myFooBar', 'My Foo-Bar'), - array('myFooBar', 'My Foo_Bar'), - array('myFooBar', 'my foo bar'), - array('myFooBar', 'my foo-bar'), - array('myFooBar', 'my foo_bar'), - ); - } - - /** - * Method to seed data to testToKey. - * - * @return array - * - * @since 11.3 - */ - public function seedToKey() - { - return array( - array('foo_bar', 'Foo Bar'), - array('foo_bar', 'Foo-Bar'), - array('foo_bar', 'Foo_Bar'), - array('foo_bar', 'foo bar'), - array('foo_bar', 'foo-bar'), - array('foo_bar', 'foo_bar'), - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/string/JStringPunycodeTest.php b/tests/unit/suites/libraries/joomla/string/JStringPunycodeTest.php deleted file mode 100644 index 70e805027fe22..0000000000000 --- a/tests/unit/suites/libraries/joomla/string/JStringPunycodeTest.php +++ /dev/null @@ -1,163 +0,0 @@ -assertEquals( - JStringPunycode::toPunycode('http://www.джумла-тест.рф'), - 'http://www.xn----7sblgc4ag8bhcd.xn--p1ai', - 'Tests idna_convert encoding a UTF8 url in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::toPunycode('http://au-gré-de-nos-plumes.fr'), - 'http://xn--au-gr-de-nos-plumes-fzb.fr', - 'Tests idna_convert encoding a UTF8 url in French' - ); - } - - /** - * Tests JStringPunycode::fromPunycode - * - * @return void - * - * @since 3.2 - */ - public function testFromPunycode() - { - $this->assertEquals( - JStringPunycode::fromPunycode('http://www.xn----7sblgc4ag8bhcd.xn--p1ai'), - 'http://www.джумла-тест.рф', - 'Tests idna_convert decoding a UTF8 url in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::fromPunycode('http://xn--au-gr-de-nos-plumes-fzb.fr'), - 'http://au-gré-de-nos-plumes.fr', - 'Tests idna_convert decoding a UTF8 url in French' - ); - } - - /** - * Tests JStringPunycode::urlToPunycode - * - * @return void - * - * @since 3.2 - */ - public function testUrlToPunycode() - { - $this->assertEquals( - JStringPunycode::urlToPunycode('http://www.джумла-тест.рф'), - 'http://www.xn----7sblgc4ag8bhcd.xn--p1ai', - 'Tests punycode encoding a UTF8 url in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::urlToPunycode('http://au-gré-de-nos-plumes.fr'), - 'http://xn--au-gr-de-nos-plumes-fzb.fr', - 'Tests punycode encoding a UTF8 url in French' - ); - - $this->assertEquals( - JStringPunycode::urlToPunycode('http://www.джумла-тест.рф#test'), - 'http://www.xn----7sblgc4ag8bhcd.xn--p1ai#test', - 'Tests punycode encoding a UTF8 url in Cyrillic with an anchor (See GitHub #4362)' - ); - } - - /** - * Tests JStringPunycode::urlToUTF8 - * - * @return void - * - * @since 3.2 - */ - public function testUrlToUTF8() - { - $this->assertEquals( - JStringPunycode::urlToUTF8('http://www.xn----7sblgc4ag8bhcd.xn--p1ai'), - 'http://www.джумла-тест.рф', - 'Tests punycode decoding a UTF8 url in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::urlToUTF8('http://xn--au-gr-de-nos-plumes-fzb.fr'), - 'http://au-gré-de-nos-plumes.fr', - 'Tests punycode decoding a UTF8 url in French' - ); - - $this->assertEquals( - JStringPunycode::urlToUTF8('http://www.xn----7sblgc4ag8bhcd.xn--p1ai#test'), - 'http://www.джумла-тест.рф#test', - 'Tests punycode decoding a UTF8 url in Cyrillic with an anchor (See GitHub #4362)' - ); - } - - /** - * Tests JStringPunycode::emailToPunycode - * - * @return void - * - * @since 3.2 - */ - public function testEmailToPunycode() - { - $this->assertEquals( - JStringPunycode::emailToPunycode('example@джумла-тест.рф'), - 'example@xn----7sblgc4ag8bhcd.xn--p1ai', - 'Tests punycode encoding a UTF8 email in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::emailToPunycode('example@au-gré-de-nos-plumes.fr'), - 'example@xn--au-gr-de-nos-plumes-fzb.fr', - 'Tests punycode encoding a UTF8 email in French' - ); - } - - /** - * Tests JStringPunycode::emailToUTF8 - * - * @return void - * - * @since 3.2 - */ - public function testEmailToUTF8() - { - $this->assertEquals( - JStringPunycode::emailToUTF8('example@xn----7sblgc4ag8bhcd.xn--p1ai'), - 'example@джумла-тест.рф', - 'Tests punycode decoding a UTF8 email in Cyrillic' - ); - - $this->assertEquals( - JStringPunycode::emailToUTF8('example@xn--au-gr-de-nos-plumes-fzb.fr'), - 'example@au-gré-de-nos-plumes.fr', - 'Tests punycode decoding a UTF8 email in French' - ); - } -} diff --git a/tests/unit/suites/libraries/joomla/string/JStringTest.php b/tests/unit/suites/libraries/joomla/string/JStringTest.php deleted file mode 100644 index 94ca308ac66b6..0000000000000 --- a/tests/unit/suites/libraries/joomla/string/JStringTest.php +++ /dev/null @@ -1,911 +0,0 @@ -assertThat( - JString::increment($string, $style, $number), - $this->equalTo($expected) - ); - } - - // @codingStandardsIgnoreStart - // @todo Arguments with default values must be at the end of the argument list - - /** - * Test... - * - * @param string $haystack @todo - * @param string $needle @todo - * @param integer $offset @todo - * @param string $expect @todo - * - * @return void - * - * @dataProvider getStrposData - * @since 11.2 - * @covers JString::strpos - */ - public function testStrpos($haystack, $needle, $offset = 0, $expect) - { - $actual = JString::strpos($haystack, $needle, $offset); - $this->assertEquals($expect, $actual); - } - - // @codingStandardsIgnoreEnd - - // @codingStandardsIgnoreStart - // @todo Arguments with default values must be at the end of the argument list - - /** - * Test... - * - * @param string $haystack @todo - * @param string $needle @todo - * @param integer $offset @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrrposData - * @since 11.2 - * @covers JString::strrpos - */ - public function testStrrpos($haystack, $needle, $offset = 0, $expect) - { - $actual = JString::strrpos($haystack, $needle, $offset); - $this->assertEquals($expect, $actual); - } - - // @codingStandardsIgnoreEnd - - // @codingStandardsIgnoreStart - // @todo Arguments with default values must be at the end of the argument list - - /** - * Test... - * - * @param string $string @todo - * @param string $start @todo - * @param bool|int $length @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getSubstrData - * @since 11.2 - * @covers JString::substr - */ - public function testSubstr($string, $start, $length = false, $expect) - { - $actual = JString::substr($string, $start, $length); - $this->assertEquals($expect, $actual); - } - - // @codingStandardsIgnoreEnd - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrtolowerData - * @since 11.2 - * @covers JString::strtolower - */ - public function testStrtolower($string, $expect) - { - $actual = JString::strtolower($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrtoupperData - * @since 11.2 - * @covers JString::strtoupper - */ - public function testStrtoupper($string, $expect) - { - $actual = JString::strtoupper($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrlenData - * @since 11.2 - * @covers JString::strlen - */ - public function testStrlen($string, $expect) - { - $actual = JString::strlen($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $search @todo - * @param string $replace @todo - * @param string $subject @todo - * @param integer $count @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStr_ireplaceData - * @since 11.2 - * @covers JString::str_ireplace - */ - public function testStr_ireplace($search, $replace, $subject, $count, $expect) - { - $actual = JString::str_ireplace($search, $replace, $subject, $count); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $split_length @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStr_splitData - * @since 11.2 - * @covers JString::str_split - */ - public function testStr_split($string, $split_length, $expect) - { - $actual = JString::str_split($string, $split_length); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string1 @todo - * @param string $string2 @todo - * @param string $locale @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrcasecmpData - * @since 11.2 - * @covers JString::strcasecmp - */ - public function testStrcasecmp($string1, $string2, $locale, $expect) - { - // Convert the $locale param to a string if it is an array - if (is_array($locale)) - { - $locale = "'" . implode("', '", $locale) . "'"; - } - - if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) - { - $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly'); - } - elseif ($locale != false && !setlocale(LC_COLLATE, $locale)) - { - $this->markTestSkipped("Locale {$locale} is not available."); - } - else - { - $actual = JString::strcasecmp($string1, $string2, $locale); - - if ($actual != 0) - { - $actual = $actual / abs($actual); - } - - $this->assertEquals($expect, $actual); - } - } - - /** - * Test... - * - * @param string $string1 @todo - * @param string $string2 @todo - * @param string $locale @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrcmpData - * @since 11.2 - * @covers JString::strcmp - */ - public function testStrcmp($string1, $string2, $locale, $expect) - { - // Convert the $locale param to a string if it is an array - if (is_array($locale)) - { - $locale = "'" . implode("', '", $locale) . "'"; - } - - if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) - { - $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly'); - } - elseif ($locale != false && !setlocale(LC_COLLATE, $locale)) - { - // If the locale is not available, we can't have to transcode the string and can't reliably compare it. - $this->markTestSkipped("Locale {$locale} is not available."); - } - else - { - $actual = JString::strcmp($string1, $string2, $locale); - - if ($actual != 0) - { - $actual = $actual / abs($actual); - } - - $this->assertEquals($expect, $actual); - } - } - - /** - * Test... - * - * @param string $haystack @todo - * @param string $needles @todo - * @param integer $start @todo - * @param integer $len @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrcspnData - * @since 11.2 - * @covers JString::strcspn - */ - public function testStrcspn($haystack, $needles, $start, $len, $expect) - { - $actual = JString::strcspn($haystack, $needles, $start, $len); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $haystack @todo - * @param string $needle @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStristrData - * @since 11.2 - * @covers JString::stristr - */ - public function testStristr($haystack, $needle, $expect) - { - $actual = JString::stristr($haystack, $needle); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrrevData - * @since 11.2 - * @covers JString::strrev - */ - public function testStrrev($string, $expect) - { - $actual = JString::strrev($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $subject @todo - * @param string $mask @todo - * @param integer $start @todo - * @param integer $length @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getStrspnData - * @since 11.2 - * @covers JString::strspn - */ - public function testStrspn($subject, $mask, $start, $length, $expect) - { - $actual = JString::strspn($subject, $mask, $start, $length); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $replacement @todo - * @param integer $start @todo - * @param integer $length @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getSubstr_replaceData - * @since 11.2 - * @covers JString::substr_replace - */ - public function testSubstr_replace($string, $replacement, $start, $length, $expect) - { - $actual = JString::substr_replace($string, $replacement, $start, $length); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $charlist @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getLtrimData - * @since 11.2 - * @covers JString::ltrim - */ - public function testLtrim($string, $charlist, $expect) - { - if ($charlist === null) - { - $actual = JString::ltrim($string); - } - else - { - $actual = JString::ltrim($string, $charlist); - } - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $charlist @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getRtrimData - * @since 11.2 - * @covers JString::rtrim - */ - public function testRtrim($string, $charlist, $expect) - { - if ($charlist === null) - { - $actual = JString::rtrim($string); - } - else - { - $actual = JString::rtrim($string, $charlist); - } - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $charlist @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getTrimData - * @since 11.2 - * @covers JString::trim - */ - public function testTrim($string, $charlist, $expect) - { - if ($charlist === null) - { - $actual = JString::trim($string); - } - else - { - $actual = JString::trim($string, $charlist); - } - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $delimiter @todo - * @param string $newDelimiter @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getUcfirstData - * @since 11.2 - * @covers JString::ucfirst - */ - public function testUcfirst($string, $delimiter, $newDelimiter, $expect) - { - $actual = JString::ucfirst($string, $delimiter, $newDelimiter); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getUcwordsData - * @since 11.2 - * @covers JString::ucwords - */ - public function testUcwords($string, $expect) - { - $actual = JString::ucwords($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $source @todo - * @param string $from_encoding @todo - * @param string $to_encoding @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getTranscodeData - * @since 11.2 - * @covers JString::transcode - */ - public function testTranscode($source, $from_encoding, $to_encoding, $expect) - { - $actual = JString::transcode($source, $from_encoding, $to_encoding); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getValidData - * @since 11.2 - * @covers JString::valid - */ - public function testValid($string, $expect) - { - $actual = JString::valid($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @param string $string @todo - * @param string $expect @todo - * - * @return array - * - * @dataProvider getValidData - * @since 11.2 - * @covers JString::compliant - */ - public function testCompliant($string, $expect) - { - $actual = JString::compliant($string); - $this->assertEquals($expect, $actual); - } - - /** - * Test... - * - * @return array - * - * @since 11.2 - * @covers JString::parse_url - */ - public function testParse_Url() - { - $url = 'http://localhost/joomla_development/j16_trunk/administrator/index.php?option=com_contact&view=contact&layout=edit&id=5'; - $expected = parse_url($url); - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test all parts of query - $url = 'https://john:doe@www.google.com:80/folder/page.html#id?var=kay&var2=key&true'; - $expected = parse_url($url); - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test special characters in URL - $url = 'http://joomla.org/mytestpath/È'; - $expected = parse_url($url); - - // Fix up path for UTF-8 characters - $expected['path'] = '/mytestpath/È'; - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test special characters in URL - $url = 'http://mydomain.com/!*\'();:@&=+$,/?%#[]" \\'; - $expected = parse_url($url); - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test url encoding in URL - $url = 'http://mydomain.com/%21%2A%27%28%29%3B%3A%40%26%3D%24%2C%2F%3F%25%23%5B%22%20%5C'; - $expected = parse_url($url); - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test a mix of the above - $url = 'http://john:doe@mydomain.com:80/%È21%25È3*%('; - $expected = parse_url($url); - - // Fix up path for UTF-8 characters - $expected['path'] = '/%È21%25È3*%('; - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - - // Test invalild URL - $url = 'http:///mydomain.com'; - $expected = parse_url($url); - $actual = JString::parse_url($url); - $this->assertEquals($expected, $actual, 'Line: ' . __LINE__ . ' Results should be equal'); - } -} diff --git a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php b/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php deleted file mode 100644 index bf12f3d0e4698..0000000000000 --- a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php +++ /dev/null @@ -1,314 +0,0 @@ - array('title', null, 0, 'title (2)'), - 'Second default increment' => array('title(2)', null, 0, 'title(3)'), - 'First dash increment' => array('title', 'dash', 0, 'title-2'), - 'Second dash increment' => array('title-2', 'dash', 0, 'title-3'), - 'Set default increment' => array('title', null, 4, 'title (4)'), - 'Unknown style fallback to default' => array('title', 'foo', 0, 'title (2)'), - ); - - /** - * Tests for JString::strpos. - * - * Each element contains $haystack, $needle, $offset, $expect, - * - * @var array - * @since 11.2 - */ - public static $strposTests = array( - array('missing', 'sing', 0, 3), - array('missing', 'sting', 0, false), - array('missing', 'ing', 0, 4), - array(' объектов на карте с', 'на карте', 0, 10), - array('на карте с', 'на карте', 0, 0), - array('на карте с', 'на каррте', 0, false), - array('на карте с', 'на карте', 2, false), - array('missing', 'sing', false, 3) - ); - - /** - * @var array - * @since 11.2 - */ - public static $strrposTests = array( - array('missing', 'sing', 0, 3), - array('missing', 'sting', 0, false), - array('missing', 'ing', 0, 4), - array(' объектов на карте с', 'на карте', 0, 10), - array('на карте с', 'на карте', 0, 0), - array('на карте с', 'на каррте', 0, false), - array('на карте с', 'карт', 2, 3) - ); - - /** - * @var array - * @since 11.2 - */ - public static $substrTests = array( - array('Mississauga', 4, false, 'issauga'), - array(' объектов на карте с', 10, false, 'на карте с'), - array(' объектов на карте с', 10, 5, 'на ка'), - array(' объектов на карте с', -4, false, 'те с'), - array(' объектов на карте с', 99, false, false) - ); - - /** - * @var array - * @since 11.2 - */ - public static $strtolowerTests = array( - array('Joomla! Rocks', 'joomla! rocks') - ); - - /** - * @var array - * @since 11.2 - */ - public static $strtoupperTests = array( - array('Joomla! Rocks', 'JOOMLA! ROCKS') - ); - - /** - * @var array - * @since 11.2 - */ - public static $strlenTests = array( - array('Joomla! Rocks', 13) - ); - - /** - * @var array - * @since 11.2 - */ - public static $str_ireplaceTests = array( - array('Pig', 'cow', 'the pig jumped', false, 'the cow jumped'), - array('Pig', 'cow', 'the pig jumped', true, 'the cow jumped'), - array('Pig', 'cow', 'the pig jumped over the cow', true, 'the cow jumped over the cow'), - array(array('PIG', 'JUMPED'), array('cow', 'hopped'), 'the pig jumped over the pig', true, 'the cow hopped over the cow'), - array('шил', 'биш', 'Би шил идэй чадна', true, 'Би биш идэй чадна'), - array('/', ':', '/test/slashes/', true, ':test:slashes:'), - ); - - /** - * @var array - * @since 11.2 - */ - public static $str_splitTests = array( - array('string', 1, array('s', 't', 'r', 'i', 'n', 'g')), - array('string', 2, array('st', 'ri', 'ng')), - array('волн', 3, array('вол', 'н')), - array('волн', 1, array('в', 'о', 'л', 'н')) - ); - - /** - * @var array - * @since 11.2 - */ - public static $strcasecmpTests = array( - array('THIS IS STRING1', 'this is string1', false, 0), - array('this is string1', 'this is string2', false, -1), - array('this is string2', 'this is string1', false, 1), - array('бгдпт', 'бгдпт', false, 0), - array('àbc', 'abc', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 1), - array('àbc', 'bcd', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('é', 'è', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('É', 'é', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 0), - array('œ', 'p', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('œ', 'n', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 1), - ); - - /** - * @var array - * @since 11.2 - */ - public static $strcmpTests = array( - array('THIS IS STRING1', 'this is string1', false, -1), - array('this is string1', 'this is string2', false, -1), - array('this is string2', 'this is string1', false, 1), - array('a', 'B', false, 1), - array('A', 'b', false, -1), - array('Àbc', 'abc', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 1), - array('Àbc', 'bcd', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('É', 'è', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('é', 'È', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('Œ', 'p', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - array('Œ', 'n', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 1), - array('œ', 'N', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), 1), - array('œ', 'P', array('fr_FR.utf8', 'fr_FR.UTF-8', 'fr_FR.UTF-8@euro', 'French_Standard', 'french', 'fr_FR', 'fre_FR'), -1), - ); - - /** - * @var array - * @since 11.2 - */ - public static $strcspnTests = array( - array('subject string ', '<>', false, false, 8), - array('Би шил {123} идэй {456} чадна', '}{', null, false, 7), - array('Би шил {123} идэй {456} чадна', '}{', 13, 10, 5) - ); - - /** - * @var array - * @since 11.2 - */ - public static $stristrTests = array( - array('haystack', 'needle', false), - array('before match, after match', 'match', 'match, after match'), - array('Би шил идэй чадна', 'шил', 'шил идэй чадна') - ); - - /** - * @var array - * @since 11.2 - */ - public static $strrevTests = array( - array('abc def', 'fed cba'), - array('Би шил', 'лиш иБ') - ); - - /** - * @var array - * @since 11.2 - */ - public static $strspnTests = array( - array('A321 Main Street', '0123456789', 1, 2, 2), - array('321 Main Street', '0123456789', null, 2, 2), - array('A321 Main Street', '0123456789', null, 10, 0), - array('321 Main Street', '0123456789', null, null, 3), - array('Main Street 321', '0123456789', null, -3, 0), - array('321 Main Street', '0123456789', null, -13, 2), - array('321 Main Street', '0123456789', null, -12, 3), - array('A321 Main Street', '0123456789', 0, null, 0), - array('A321 Main Street', '0123456789', 1, 10, 3), - array('A321 Main Street', '0123456789', 1, null, 3), - array('Би шил идэй чадна', 'Би', null, null, 2), - array('чадна Би шил идэй чадна', 'Би', null, null, 0) - ); - - /** - * @var array - * @since 11.2 - */ - public static $substr_replaceTests = array( - array('321 Main Street', 'Broadway Avenue', 4, null, '321 Broadway Avenue'), - array('321 Main Street', 'Broadway', 4, 4, '321 Broadway Street'), - array('чадна Би шил идэй чадна', '我能吞', 6, null, 'чадна 我能吞'), - array('чадна Би шил идэй чадна', '我能吞', 6, 2, 'чадна 我能吞 шил идэй чадна') - ); - - /** - * Test data for JString::ltrim. - * - * @var array Elements of array($string, $charlist, $expect) - * @since 11.2 - */ - public static $ltrimTests = array( - array(' abc def', null, 'abc def'), - array(' abc def', '', ' abc def'), - array(' Би шил', null, 'Би шил'), - array("\t\n\r\x0BБи шил", null, 'Би шил'), - array("\x0B\t\n\rБи шил", "\t\n\x0B", "\rБи шил"), - array("\x09Би шил\x0A", "\x09\x0A", "Би шил\x0A"), - array('1234abc', '0123456789', 'abc') - ); - - /** - * @var array - * @since 11.2 - */ - public static $rtrimTests = array( - array('abc def ', null, 'abc def'), - array('abc def ', '', 'abc def '), - array('Би шил ', null, 'Би шил'), - array("Би шил\t\n\r\x0B", null, 'Би шил'), - array("Би шил\r\x0B\t\n", "\t\n\x0B", "Би шил\r"), - array("\x09Би шил\x0A", "\x09\x0A", "\x09Би шил"), - array('1234abc', 'abc', '01234') - ); - - /** - * @var array - * @since 11.2 - */ - public static $trimTests = array( - array(' abc def ', null, 'abc def'), - array(' abc def ', '', ' abc def '), - array(' Би шил ', null, 'Би шил'), - array("\t\n\r\x0BБи шил\t\n\r\x0B", null, 'Би шил'), - array("\x0B\t\n\rБи шил\r\x0B\t\n", "\t\n\x0B", "\rБи шил\r"), - array("\x09Би шил\x0A", "\x09\x0A", "Би шил"), - array('1234abc56789', '0123456789', 'abc') - ); - - /** - * @var array - * @since 11.2 - */ - public static $ucfirstTests = array( - array('george', null, null, 'George'), - array('мога', null, null, 'Мога'), - array('ψυχοφθόρα', null, null, 'Ψυχοφθόρα'), - array('dr jekill and mister hyde', ' ', null, 'Dr Jekill And Mister Hyde'), - array('dr jekill and mister hyde', ' ', '_', 'Dr_Jekill_And_Mister_Hyde'), - array('dr jekill and mister hyde', ' ', '', 'DrJekillAndMisterHyde'), - ); - - /** - * @var array - * @since 11.2 - */ - public static $ucwordsTests = array( - array('george washington', 'George Washington'), - array("george\r\nwashington", "George\r\nWashington"), - array('мога', 'Мога'), - array('αβγ δεζ', 'Αβγ Δεζ'), - array('åbc öde', 'Åbc Öde') - ); - - /** - * @var array - * @since 11.2 - */ - public static $transcodeTests = array( - array('Åbc Öde €100', 'UTF-8', 'ISO-8859-1', "\xc5bc \xd6de EUR100"), - array(array('Åbc Öde €100'), 'UTF-8', 'ISO-8859-1', null), - ); - - /** - * @var array - * @since 11.2 - */ - public static $validTests = array( - array('george Мога Ž Ψυχοφθόρα ฉันกินกระจกได้ 我能吞下玻璃而不伤身体 ', true), - array("\xFF ABC", false), - array("0xfffd ABC", true), - array('', true) - ); -}