diff options
author | Andrey Andreev <narf@devilix.net> | 2022-01-05 22:44:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2022-01-05 22:44:53 +0100 |
commit | e837d3589ba5c5da5daa58f69bdc14447c90bc51 (patch) | |
tree | 9b2fd6ec4f4d753b2c68f3f21ec626e1bd5eabb0 | |
parent | 627f1058c1d72b267ab8ab441219198d6f2c24c6 (diff) |
Drop some previously deprecated functionality
-rw-r--r-- | system/database/DB_forge.php | 10 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/url_helper.php | 15 | ||||
-rw-r--r-- | system/libraries/Pagination.php | 8 | ||||
-rw-r--r-- | tests/codeigniter/helpers/string_helper_test.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/helpers/url_helper_test.php | 4 | ||||
-rwxr-xr-x | tests/mocks/database/ci_test.sqlite | bin | 19456 -> 19456 bytes | |||
-rw-r--r-- | user_guide_src/source/changelog.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/database/forge.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/helpers/string_helper.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/helpers/url_helper.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_320.rst | 5 | ||||
-rw-r--r-- | user_guide_src/source/libraries/pagination.rst | 3 |
13 files changed, 17 insertions, 47 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index ce9b30d82..f31823536 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -556,25 +556,17 @@ abstract class CI_DB_forge { /** * Column Add * - * @todo Remove deprecated $_after option in 3.1+ * @param string $table Table name * @param array $field Column definition - * @param string $_after Column for AFTER clause (deprecated) * @return bool */ - public function add_column($table, $field, $_after = NULL) + public function add_column($table, $field) { // Work-around for literal column definitions is_array($field) OR $field = array($field); foreach (array_keys($field) as $k) { - // Backwards-compatibility work-around for MySQL/CUBRID AFTER clause (remove in 3.1+) - if ($_after !== NULL && is_array($field[$k]) && ! isset($field[$k]['after'])) - { - $field[$k]['after'] = $_after; - } - $this->add_field(array($k => $field[$k])); } diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 3a05525db..5b359f730 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -170,7 +170,7 @@ if ( ! function_exists('random_string')) /** * Create a "Random" String * - * @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1 + * @param string type of random string. basic, alpha, alnum, numeric, nozero, md5 and sha1 * @param int number of characters * @return string */ @@ -200,10 +200,8 @@ if ( ! function_exists('random_string')) break; } return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); - case 'unique': // todo: remove in 3.1+ case 'md5': return md5(uniqid(mt_rand())); - case 'encrypt': // todo: remove in 3.1+ case 'sha1': return sha1(uniqid(mt_rand(), TRUE)); } diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 4c060a203..17601c40c 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -470,31 +470,20 @@ if ( ! function_exists('url_title')) * human-friendly URL string with a "separator" string * as the word separator. * - * @todo Remove old 'dash' and 'underscore' usage in 3.1+. * @param string $str Input string - * @param string $separator Word separator - * (usually '-' or '_') + * @param string $separator Word separator (usually '-' or '_') * @param bool $lowercase Whether to transform the output string to lowercase * @return string */ function url_title($str, $separator = '-', $lowercase = FALSE) { - if ($separator === 'dash') - { - $separator = '-'; - } - elseif ($separator === 'underscore') - { - $separator = '_'; - } - $q_separator = preg_quote($separator, '#'); $trans = array( '&.+?;' => '', '[^\w\d _-]' => '', '\s+' => $separator, - '('.$q_separator.')+' => $separator + '('.$q_separator.')+' => $separator, ); $str = strip_tags($str); diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 20418c00a..837ac4b32 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -363,14 +363,6 @@ class CI_Pagination { unset($params['attributes']); } - // Deprecated legacy support for the anchor_class option - // Should be removed in CI 3.1+ - if (isset($params['anchor_class'])) - { - empty($params['anchor_class']) OR $attributes['class'] = $params['anchor_class']; - unset($params['anchor_class']); - } - foreach ($params as $key => $val) { if (property_exists($this, $key)) diff --git a/tests/codeigniter/helpers/string_helper_test.php b/tests/codeigniter/helpers/string_helper_test.php index 4f15909ff..f6d473a41 100644 --- a/tests/codeigniter/helpers/string_helper_test.php +++ b/tests/codeigniter/helpers/string_helper_test.php @@ -98,7 +98,7 @@ class String_helper_test extends CI_TestCase { public function test_random_string() { $this->assertEquals(16, strlen(random_string('alnum', 16))); - $this->assertEquals(32, strlen(random_string('unique', 16))); + $this->assertEquals(32, strlen(random_string('md5', 16))); $this->assertEquals('string', gettype(random_string('numeric', 16))); } diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php index 5f936568b..1b295511e 100644 --- a/tests/codeigniter/helpers/url_helper_test.php +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -21,7 +21,7 @@ class Url_helper_test extends CI_TestCase { foreach ($words as $in => $out) { - $this->assertEquals($out, url_title($in, 'dash', TRUE)); + $this->assertEquals($out, url_title($in, '-', TRUE)); } } @@ -41,7 +41,7 @@ class Url_helper_test extends CI_TestCase { foreach ($words as $in => $out) { - $this->assertEquals($out, url_title($in, 'underscore')); + $this->assertEquals($out, url_title($in, '_')); } } diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite Binary files differindex db14455eb..36e4ae5de 100755 --- a/tests/mocks/database/ci_test.sqlite +++ b/tests/mocks/database/ci_test.sqlite diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2a729264e..80a5ca0e9 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -39,6 +39,7 @@ Release Date: Not Released - Removed previously deprecated *Cart Library*. - Removed previously deprecated *Javascript Library* (it was always experimental in the first place). + - Removed previously deprecated ``anchor_class`` option from :doc:`Pagination Library <libraries/pagination>`. - Added TLS and UNIX socket connection support to :doc:`Session Library <libraries/sessions>` 'redis' driver. - Updated :doc:`ZIP Library <libraries/zip>` method ``read_dir()`` to include hidden (dot-prefixed) files. @@ -88,6 +89,7 @@ Release Date: Not Released - :doc:`Database Forge <database/forge>`: - Added support for declaring date/time type fields default values as ``CURRENT_TIMESTAMP`` and similar. + - Removed previously deprecated ``$_after`` parameter for ``add_column()``. - :doc:`Query Builder <database/query_builder>`: @@ -103,6 +105,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:`File Helper <helpers/file_helper>` function ``read_file()`` (use PHP's native ``file_get_contents()`` instead). + - Removed previously deprecated options ``'dash'`` and ``'underscore'`` from :doc:`URL Helper <helpers/url_helper>` function :php:func:`url_title()`. - Added new function :php:func:`ordinal_format()` to :doc:`Inflector Helper <helpers/inflector_helper>`. - :doc:`Download Helper <helpers/download_helper>` changes include: @@ -115,6 +118,7 @@ Release Date: Not Released - Removed previously deprecated function ``trim_slashes()`` (use PHP's native ``trim()`` with ``'/'`` instead). - Removed previously deprecated function ``repeater()`` (use PHP's native ``str_repeat()`` instead). + - Removed previously deprecated ``'unique'`` and ``'encrypt'`` options from ``random_string()``. - :doc:`HTML Helper <helpers/html_helper>` changes include: diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index c6cacb1b0..1562a1a2d 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -322,11 +322,10 @@ Class Reference .. php:class:: CI_DB_forge - .. php:method:: add_column($table[, $field = array()[, $_after = NULL]]) + .. php:method:: add_column($table[, $field = array()]) :param string $table: Table name to add the column to :param array $field: Column definition(s) - :param string $_after: Column for AFTER clause (deprecated) :returns: TRUE on success, FALSE on failure :rtype: bool diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index 4663bb08b..c9b5e278c 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -52,9 +52,6 @@ The following functions are available: echo random_string('alnum', 16); - .. note:: Usage of the *unique* and *encrypt* types is DEPRECATED. They - are just aliases for *md5* and *sha1* respectively. - .. php:function:: increment_string($str[, $separator = '_'[, $first = 1]]) :param string $str: Input string diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index adeab8c58..037e613ea 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -298,9 +298,6 @@ The following functions are available: $url_title = url_title($title, 'underscore'); // Produces: Whats_wrong_with_CSS - .. note:: Old usage of 'dash' and 'underscore' as the second parameter - is DEPRECATED. - The third parameter determines whether or not lowercase characters are forced. By default they are not. Options are boolean TRUE/FALSE. diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst index 48914c414..715e8858d 100644 --- a/user_guide_src/source/installation/upgrade_320.rst +++ b/user_guide_src/source/installation/upgrade_320.rst @@ -231,6 +231,11 @@ CodeIgniter versions that have been removed in 3.2.0: - The entire *Smiley Helper* (an archived version is available on GitHub: `bcit-ci/ci3-smiley-helper <https://github.com/bcit-ci/ci3-smiley-helper>`_) +- The ``$_after`` parameter from :doc:`Database Forge <../database/forge>` method ``add_column()``. +- The ``anchor_class`` option from :doc:`Pagination Library <../libraries/pagination>` (use ``class`` instead). +- The ``unique`` and ``encrypt`` options from :doc:`String Helper <../helpers/string_helper>` function ``random_string()``. +- The ``underscore`` and ``dash`` options from :doc:`URL Helper <../helpers/url_helper>`` function :php:func:`url_title()`. + Step 11: Make sure you're validating all user inputs ==================================================== diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index fbc75ea56..760f50c94 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -277,9 +277,6 @@ by the pagination class, you can set them as key/value pairs in the // Produces: class="myclass" $config['attributes'] = array('class' => 'myclass'); -.. note:: Usage of the old method of setting classes via "anchor_class" - is deprecated. - ***************************** Disabling the "rel" attribute ***************************** |