diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-01 14:45:41 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-01 14:45:41 +0100 |
commit | 9b5a84dfb0c8a4ba078beb516373e7bb7d8d3ed7 (patch) | |
tree | f54308feff8f6fed3924bb7bb60030738097c2f9 | |
parent | fe58c1c633cdfc11efc22a4d9bd888fab4a2a15c (diff) |
Remove previously deprecated FV Library method/rule prep_for_form()
-rw-r--r-- | system/libraries/Form_validation.php | 32 | ||||
-rw-r--r-- | tests/codeigniter/libraries/Form_validation_test.php | 14 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_320.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/libraries/form_validation.rst | 1 |
5 files changed, 4 insertions, 49 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 384caf000..c2bc22f95 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1488,38 +1488,6 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * Prep data for form - * - * This function allows HTML to be safely shown in a form. - * Special characters are converted. - * - * @deprecated 3.0.6 Not used anywhere within the framework and pretty much useless - * @param mixed $data Input data - * @return mixed - */ - public function prep_for_form($data) - { - if ($this->_safe_form_data === FALSE OR empty($data)) - { - return $data; - } - - if (is_array($data)) - { - foreach ($data as $key => $val) - { - $data[$key] = $this->prep_for_form($val); - } - - return $data; - } - - return str_replace(array("'", '"', '<', '>'), array(''', '"', '<', '>'), stripslashes($data)); - } - - // -------------------------------------------------------------------- - - /** * Prep URL * * @param string diff --git a/tests/codeigniter/libraries/Form_validation_test.php b/tests/codeigniter/libraries/Form_validation_test.php index 5f4bb9316..4be080f90 100644 --- a/tests/codeigniter/libraries/Form_validation_test.php +++ b/tests/codeigniter/libraries/Form_validation_test.php @@ -579,20 +579,6 @@ class Form_validation_test extends CI_TestCase { $this->assertFalse($this->form_validation->regex_match('bar', $regex)); } - public function test_prep_for_form() - { - $this->form_validation->reset_validation(); - $error_msg_unprepped = '<error =\'foobar\'">'; - $error_msg_prepped = '<error ='foobar'">'; - $this->form_validation->set_rules('foo', 'label', 'required', array('required' => $error_msg_unprepped)); - $_POST = array('foo' => ''); - $this->form_validation->run(); - $error_arr = $this->form_validation->error_array(); - - $this->assertEquals('', $this->form_validation->prep_for_form('')); - $this->assertEquals(array('foo' => $error_msg_prepped), $this->form_validation->prep_for_form($error_arr)); - } - public function test_prep_url() { $this->assertEquals('', $this->form_validation->prep_url('')); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f6d39cbfe..a61ad164b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -13,6 +13,7 @@ Release Date: Not Released - Removed previously deprecated :doc:`Input Library <libraries/input>` method ``is_cli_request()`` (use :php:func:`is_cli()` instead). - Removed previously deprecated :doc:`Routing Class <general/routing>` methods ``fetch_directory()``, ``fetch_class()`` and ``fetch_method()`` (use the respective class properties instead). - Removed previously deprecated :doc:`Config Library <libraries/config>` method ``system_url()`` (encourages insecure practices). + - Removed previously deprecated :doc:`Form Validation Library <libraries/form_validation>` method ``prep_for_form()`` / rule *prep_for_form*. - 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 ``' '`` respectively). @@ -2748,7 +2749,7 @@ Release Date: January 30, 2008 class. <./libraries/sessions>` - Removed 'last_visit' from the Session class. - Added a language entry for valid_ip validation error. - - Modified prep_for_form() in the Validation class to accept + - Modified ``prep_for_form()`` in the Validation class to accept arrays, adding support for POST array validation (via callbacks only) - Added an "integer" rule into the Validation library. diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst index 2bc4e53d3..4e4a73b67 100644 --- a/user_guide_src/source/installation/upgrade_320.rst +++ b/user_guide_src/source/installation/upgrade_320.rst @@ -129,13 +129,14 @@ Step 7: Remove usage of previously deprecated functionalities ============================================================= The following is a list of functionalities deprecated in CodeIgniter -version 3.0.0, that have been removed in 3.2.0: +version 3.0.x, that have been removed in 3.2.0: - ``CI_Input::is_cli_request()`` (use :php:func:`is_cli()` instead) - ``CI_Router::fetch_directory()`` (use ``CI_Router::$directory instead) - ``CI_Router::fetch_class()`` (use ``CI_Router::$class`` instead) - ``CI_Router::fetch_method()`` (use ``CI_Router::$method`` instead) - ``CI_Config::system_url()`` (encourages insecure practices) +- ``CI_Form_validation::prep_for_form()`` (the *prep_for_form* rule) - ``standard_date()`` :doc:`Date Helper <../helpers/date_helper>` function (use ``date()`` instead) - ``do_hash()`` :doc:`Security Helper <../helpers/security_helper>` function (use ``hash()`` instead) diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index b503b9be0..915ce876f 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -1009,7 +1009,6 @@ to use: ==================== ========= ============================================================================================================== Name Parameter Description ==================== ========= ============================================================================================================== -**prep_for_form** No DEPRECATED: Converts special characters so that HTML data can be shown in a form field without breaking it. **prep_url** No Adds "\http://" to URLs if missing. **strip_image_tags** No Strips the HTML from image tags leaving the raw URL. **encode_php_tags** No Converts PHP tags to entities. |