summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/string_helper.php47
-rw-r--r--tests/codeigniter/helpers/string_helper_test.php32
-rw-r--r--user_guide_src/source/changelog.rst5
-rw-r--r--user_guide_src/source/helpers/string_helper.rst37
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst4
-rw-r--r--user_guide_src/source/installation/upgrade_320.rst2
6 files changed, 9 insertions, 118 deletions
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index db531fa9a..62b1a18e0 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -49,33 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// ------------------------------------------------------------------------
-if ( ! function_exists('trim_slashes'))
-{
- /**
- * Trim Slashes
- *
- * Removes any leading/trailing slashes from a string:
- *
- * /this/that/theother/
- *
- * becomes:
- *
- * this/that/theother
- *
- * @todo Remove in version 3.1+.
- * @deprecated 3.0.0 This is just an alias for PHP's native trim()
- *
- * @param string
- * @return string
- */
- function trim_slashes($str)
- {
- return trim($str, '/');
- }
-}
-
-// ------------------------------------------------------------------------
-
if ( ! function_exists('strip_slashes'))
{
/**
@@ -284,23 +257,3 @@ if ( ! function_exists('alternator'))
return $args[($i++ % count($args))];
}
}
-
-// ------------------------------------------------------------------------
-
-if ( ! function_exists('repeater'))
-{
- /**
- * Repeater function
- *
- * @todo Remove in version 3.1+.
- * @deprecated 3.0.0 This is just an alias for PHP's native str_repeat()
- *
- * @param string $data String to repeat
- * @param int $num Number of repeats
- * @return string
- */
- function repeater($data, $num = 1)
- {
- return ($num > 0) ? str_repeat($data, $num) : '';
- }
-}
diff --git a/tests/codeigniter/helpers/string_helper_test.php b/tests/codeigniter/helpers/string_helper_test.php
index 75701ec13..6de336b01 100644
--- a/tests/codeigniter/helpers/string_helper_test.php
+++ b/tests/codeigniter/helpers/string_helper_test.php
@@ -22,19 +22,6 @@ class String_helper_test extends CI_TestCase {
$this->assertEquals($expected, strip_slashes($str));
}
- public function test_trim_slashes()
- {
- $strs = array(
- '//Slashes//\/' => 'Slashes//\\',
- '/var/www/html/' => 'var/www/html'
- );
-
- foreach ($strs as $str => $expect)
- {
- $this->assertEquals($expect, trim_slashes($str));
- }
- }
-
// --------------------------------------------------------------------
public function test_strip_quotes()
@@ -108,23 +95,6 @@ class String_helper_test extends CI_TestCase {
// --------------------------------------------------------------------
- public function test_repeater()
- {
- $strs = array(
- 'a' => 'aaaaaaaaaa',
- ' ' => '          ',
- '<br>' => '<br><br><br><br><br><br><br><br><br><br>'
-
- );
-
- foreach ($strs as $str => $expect)
- {
- $this->assertEquals($expect, repeater($str, 10));
- }
- }
-
- // --------------------------------------------------------------------
-
public function test_random_string()
{
$this->assertEquals(16, strlen(random_string('alnum', 16)));
@@ -145,4 +115,4 @@ class String_helper_test extends CI_TestCase {
$this->assertEquals(124, increment_string('123', ''));
}
-} \ No newline at end of file
+}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 33f25db51..8be737b6f 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -16,6 +16,7 @@ Release Date: Not Released
- Removed previously deprecated :doc:`Date Helper <helpers/date_helper>` function ``standard_date()`` (use PHP's native ``date()`` instead).
- Removed previously deprecated :doc:`Security Helper <helpers/security_helper>` function ``do_hash()`` (use PHP's native ``hash()`` instead).
- Removed previously deprecated :doc:`HTML Helper <helpers/html_helper>` functions ``br()`` and ``nbs()`` (use PHP's native ``str_repeat()`` with ``'<br />'`` and ``'&nbsp;'`` respectively).
+ - Removed previously deprecated :doc:`String Helper <helpers/string_helper>` functions ``trim_slashes()`` and ``repeater()`` (use PHP's native ``trim()`` with ``'/'`` and ``str_repeat()`` respectively).
- Removed previously deprecated *Email Helper* (had only two functions, aliases for PHP's native ``filter_var()`` and ``mail()``).
- Libraries
@@ -2969,7 +2970,7 @@ Release Date: July 12, 2007
- Fixed various doc typos.
- Documented two functions from the :doc:`String
helper <./helpers/string_helper>` that were missing from the
- user guide: trim_slashes() and reduce_double_slashes().
+ user guide: ``trim_slashes()`` and ``reduce_double_slashes()``.
- Docs now validate to XHTML 1 transitional
- Updated the XSS Filtering to take into account the IE expression()
ability and improved certain deletions to prevent possible exploits
@@ -3000,7 +3001,7 @@ Release Date: April 15, 2007
- Added array to string into the profiler
- Code Igniter references updated to CodeIgniter
- pMachine references updated to EllisLab
-- Fixed a bug in the repeater function of :doc:`string
+- Fixed a bug in the ``repeater()`` function of :doc:`string
helper <./helpers/string_helper>`.
- Fixed a bug in ODBC driver
- Fixed a bug in result_array() that was returning an empty array when
diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst
index 53052557e..d697d824b 100644
--- a/user_guide_src/source/helpers/string_helper.rst
+++ b/user_guide_src/source/helpers/string_helper.rst
@@ -27,7 +27,6 @@ Available Functions
The following functions are available:
-
.. php:function:: random_string([$type = 'alnum'[, $len = 8]])
:param string $type: Randomization type
@@ -102,24 +101,6 @@ The following functions are available:
.. note:: To use multiple separate calls to this function simply call the
function with no arguments to re-initialize.
-.. php:function:: repeater($data[, $num = 1])
-
- :param string $data: Input
- :param int $num: Number of times to repeat
- :returns: Repeated string
- :rtype: string
-
- Generates repeating copies of the data you submit. Example::
-
- $string = "\n";
- echo repeater($string, 30);
-
- The above would generate 30 newlines.
-
- .. note:: This function is DEPRECATED. Use the native ``str_repeat()``
- instead.
-
-
.. php:function:: reduce_double_slashes($str)
:param string $str: Input string
@@ -134,7 +115,6 @@ The following functions are available:
$string = "http://example.com//index.php";
echo reduce_double_slashes($string); // results in "http://example.com/index.php"
-
.. php:function:: strip_slashes($data)
:param mixed $data: Input string or an array of strings
@@ -163,21 +143,6 @@ The following functions are available:
and handle string inputs. This however makes it just an
alias for ``stripslashes()``.
-.. php:function:: trim_slashes($str)
-
- :param string $str: Input string
- :returns: Slash-trimmed string
- :rtype: string
-
- Removes any leading/trailing slashes from a string. Example::
-
- $string = "/this/that/theother/";
- echo trim_slashes($string); // results in this/that/theother
-
- .. note:: This function is DEPRECATED. Use the native ``trim()`` instead:
- |
- | trim($str, '/');
-
.. php:function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]])
:param string $str: Text to search in
@@ -220,4 +185,4 @@ The following functions are available:
Removes single and double quotes from a string. Example::
$string = "Joe's \"dinner\"";
- $string = strip_quotes($string); //results in "Joes dinner" \ No newline at end of file
+ $string = strip_quotes($string); //results in "Joes dinner"
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index 9d0d0dc1e..c7c2b948a 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -624,7 +624,7 @@ CodeIgniter 3.1+.
String helper repeater()
========================
-:doc:`String Helper <../helpers/string_helper>` function :php:func:`repeater()` is now just an alias for
+:doc:`String Helper <../helpers/string_helper>` function ``repeater()`` is now just an alias for
PHP's native ``str_repeat()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.
.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner
@@ -633,7 +633,7 @@ PHP's native ``str_repeat()`` function. It is deprecated and scheduled for remov
String helper trim_slashes()
============================
-:doc:`String Helper <../helpers/string_helper>` function :php:func:`trim_slashes()` is now just an alias
+:doc:`String Helper <../helpers/string_helper>` function ``trim_slashes()`` is now just an alias
for PHP's native ``trim()`` function (with a slash passed as its second argument). It is deprecated and
scheduled for removal in CodeIgniter 3.1+.
diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst
index a357e20ef..8a559c268 100644
--- a/user_guide_src/source/installation/upgrade_320.rst
+++ b/user_guide_src/source/installation/upgrade_320.rst
@@ -141,6 +141,8 @@ version 3.0.0, that have been removed in 3.2.0:
- ``do_hash()`` :doc:`Security Helper <../helpers/security_helper>` function (use ``hash()`` instead)
- ``br()`` :doc:`HTML Helper <../helpers/html_helper>` function (use ``str_repeat()`` with ``'<br />'`` instead)
- ``nbs()`` :doc:`HTML Helper <../helpers/html_helper>` function (use ``str_repeat()`` with ``'&nbsp;'`` instead)
+- ``trim_slashes()`` :doc:`String Helper <../helpers/string_helper>` function (use ``trim()`` with ``'/'`` instead)
+- ``repeater()`` :doc:`String Helper <../helpers/string_helper>` function (use ``str_repeat()`` instead)
- The entire *Email Helper*, which only had two functions: