summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-15 20:44:02 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-15 20:44:02 +0100
commitcd74d36ae1ac34c25271b5ff81cc2fd8df099724 (patch)
tree75765a7dbf41fb80ab71a20b611cfd1c93cb8fbb
parent81f036753272391360ba5b64e6dd93c4101a8733 (diff)
Rename CI_Utf8::_is_ascii() to is_ascii() and make it public
No reason for it to be protected.
-rw-r--r--system/core/Utf8.php6
-rw-r--r--tests/codeigniter/core/Utf8_test.php4
-rw-r--r--tests/mocks/core/utf8.php5
-rw-r--r--user_guide_src/source/changelog.rst1
4 files changed, 5 insertions, 11 deletions
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 6ca1a02ca..98352db6f 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -73,14 +73,12 @@ class CI_Utf8 {
*
* Ensures strings contain only valid UTF-8 characters.
*
- * @uses CI_Utf8::_is_ascii() Decide whether a conversion is needed
- *
* @param string $str String to clean
* @return string
*/
public function clean_string($str)
{
- if ($this->_is_ascii($str) === FALSE)
+ if ($this->is_ascii($str) === FALSE)
{
if (ICONV_ENABLED)
{
@@ -147,7 +145,7 @@ class CI_Utf8 {
* @param string $str String to check
* @return bool
*/
- protected function _is_ascii($str)
+ public function is_ascii($str)
{
return (preg_match('/[^\x00-\x7F]/S', $str) === 0);
}
diff --git a/tests/codeigniter/core/Utf8_test.php b/tests/codeigniter/core/Utf8_test.php
index 71299134e..2cf404841 100644
--- a/tests/codeigniter/core/Utf8_test.php
+++ b/tests/codeigniter/core/Utf8_test.php
@@ -18,8 +18,8 @@ class Utf8_test extends CI_TestCase {
public function test_is_ascii()
{
- $this->assertTrue($this->utf8->is_ascii_test('foo bar'));
- $this->assertFalse($this->utf8->is_ascii_test('тест'));
+ $this->assertTrue($this->utf8->is_ascii('foo bar'));
+ $this->assertFalse($this->utf8->is_ascii('тест'));
}
} \ No newline at end of file
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
index 30b78adfe..c8214a62a 100644
--- a/tests/mocks/core/utf8.php
+++ b/tests/mocks/core/utf8.php
@@ -13,9 +13,4 @@ class Mock_Core_Utf8 extends CI_Utf8 {
defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
}
- public function is_ascii_test($str)
- {
- return $this->_is_ascii($str);
- }
-
} \ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index ca31669e8..bda4cbab4 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -505,6 +505,7 @@ Release Date: Not Released
- ``UTF8_ENABLED`` now requires only one of `Multibyte String <http://php.net/mbstring>`_ or `iconv <http://php.net/iconv>`_ to be available instead of both.
- Changed method ``clean_string()`` to utilize ``mb_convert_encoding()`` if it is available but ``iconv()`` is not.
+ - Renamed method ``_is_ascii()`` to ``is_ascii()`` and made it public.
- Added `compatibility layers <general/compatibility_functions>` for PHP's `mbstring <http://php.net/mbstring>`_ (limited support) and `password <http://php.net/password>`_ extensions.
- Removed ``CI_CORE`` boolean constant from *CodeIgniter.php* (no longer Reactor and Core versions).