summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2022-01-05 23:09:30 +0100
committerAndrey Andreev <narf@devilix.net>2022-01-05 23:09:30 +0100
commitaae89a56a3e1b61b6a840dc455657e5e4952cf24 (patch)
treea09f630bd2dea6213be2547190d6c8adb2b74b35
parent2bb6a49cf53f916e3162a96948deb7a63763c4c3 (diff)
Drop more deprecated functionality
-rw-r--r--system/helpers/captcha_helper.php11
-rw-r--r--system/helpers/date_helper.php66
-rw-r--r--system/libraries/Form_validation.php5
-rw-r--r--tests/codeigniter/helpers/date_helper_test.php8
-rwxr-xr-xtests/mocks/database/ci_test.sqlitebin19456 -> 19456 bytes
-rw-r--r--user_guide_src/source/changelog.rst9
-rw-r--r--user_guide_src/source/helpers/captcha_helper.rst9
-rw-r--r--user_guide_src/source/helpers/date_helper.rst27
-rw-r--r--user_guide_src/source/installation/upgrade_320.rst3
9 files changed, 14 insertions, 124 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 6fce05267..43b98b71f 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -54,13 +54,10 @@ if ( ! function_exists('create_captcha'))
/**
* Create CAPTCHA
*
- * @param array $data Data for the CAPTCHA
- * @param string $img_path Path to create the image in (deprecated)
- * @param string $img_url URL to the CAPTCHA image folder (deprecated)
- * @param string $font_path Server path to font (deprecated)
- * @return string
+ * @param array $data Data for the CAPTCHA
+ * @return array
*/
- function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
+ function create_captcha($data)
{
$defaults = array(
'word' => '',
@@ -106,7 +103,7 @@ if ( ! function_exists('create_captcha'))
if ($img_path === '' OR $img_url === '')
{
- log_message('error', 'create_captcha(): $img_path and $img_url are required.');
+ log_message('error', 'create_captcha(): img_path and img_url are required.');
return FALSE;
}
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index db9e9642d..f04bdcc30 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -450,72 +450,6 @@ if ( ! function_exists('human_to_unix'))
// ------------------------------------------------------------------------
-if ( ! function_exists('nice_date'))
-{
- /**
- * Turns many "reasonably-date-like" strings into something
- * that is actually useful. This only works for dates after unix epoch.
- *
- * @deprecated 3.1.3 Use DateTime::createFromFormat($input_format, $input)->format($output_format);
- * @param string The terribly formatted date-like string
- * @param string Date format to return (same as php date function)
- * @return string
- */
- function nice_date($bad_date = '', $format = FALSE)
- {
- if (empty($bad_date))
- {
- return 'Unknown';
- }
- elseif (empty($format))
- {
- $format = 'U';
- }
-
- // Date like: YYYYMM
- if (preg_match('/^\d{6}$/i', $bad_date))
- {
- if (in_array(substr($bad_date, 0, 2), array('19', '20')))
- {
- $year = substr($bad_date, 0, 4);
- $month = substr($bad_date, 4, 2);
- }
- else
- {
- $month = substr($bad_date, 0, 2);
- $year = substr($bad_date, 2, 4);
- }
-
- return date($format, strtotime($year.'-'.$month.'-01'));
- }
-
- // Date Like: YYYYMMDD
- if (preg_match('/^\d{8}$/i', $bad_date, $matches))
- {
- return DateTime::createFromFormat('Ymd', $bad_date)->format($format);
- }
-
- // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between)
- if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches))
- {
- return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2]));
- }
-
- // Any other kind of string, when converted into UNIX time,
- // produces "0 seconds after epoc..." is probably bad...
- // return "Invalid Date".
- if (date('U', strtotime($bad_date)) === '0')
- {
- return 'Invalid Date';
- }
-
- // It's probably a valid-ish date format already
- return date($format, strtotime($bad_date));
- }
-}
-
-// ------------------------------------------------------------------------
-
if ( ! function_exists('timezone_menu'))
{
/**
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 043a97c6d..ce844686c 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -851,11 +851,6 @@ class CI_Form_validation {
{
return $line;
}
- // DEPRECATED support for non-prefixed keys, lang file again
- elseif (FALSE !== ($line = $this->CI->lang->line($rule, FALSE)))
- {
- return $line;
- }
return $this->CI->lang->line('form_validation_error_message_not_set').'('.$rule.')';
}
diff --git a/tests/codeigniter/helpers/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php
index 8d0317dcb..82db3b3de 100644
--- a/tests/codeigniter/helpers/date_helper_test.php
+++ b/tests/codeigniter/helpers/date_helper_test.php
@@ -10,14 +10,6 @@ class Date_helper_test extends CI_TestCase {
// ------------------------------------------------------------------------
- public function test_nice_date()
- {
- $this->assertEquals('2016-11-01', nice_date('201611', 'Y-m-d'));
- $this->assertEquals('2016-11-23', nice_date('20161123', 'Y-m-d'));
- }
-
- // ------------------------------------------------------------------------
-
public function test_now_local()
{
/*
diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite
index 36e4ae5de..84f09add2 100755
--- a/tests/mocks/database/ci_test.sqlite
+++ b/tests/mocks/database/ci_test.sqlite
Binary files differ
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 80a5ca0e9..b9a9e2015 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -56,6 +56,7 @@ Release Date: Not Released
- :doc:`Form Validation Library <libraries/form_validation>` changes include:
- Removed previously deprecated method ``prep_for_form()`` / rule *prep_for_form*.
+ - Removed previously deprecated ability to use language translations without the ``'form_validation_'`` prefix.
- Changed method ``set_rules()`` to throw a ``BadMethodCallException`` when its first parameter is not an array and the ``$rules`` one is unused.
- Added rule **valid_mac**, which replicates PHP's native ``filter_var()`` with ``FILTER_VALIDATE_MAC``.
- Added ability to validate entire arrays at once, if ``is_array`` is within the list of rules.
@@ -103,6 +104,7 @@ Release Date: Not Released
- Removed previously deprecated *Email Helper* (had only two functions, aliases for PHP's native ``filter_var()`` and ``mail()``).
- Removed previously deprecated *Smiley Helper*.
- Removed previously deprecated :doc:`Date Helper <helpers/date_helper>` function ``standard_date()`` (use PHP's native ``date()`` instead).
+ - Removed previously deprecated :doc:`Date Helper <helpers/date_helper>` function ``nice_date()`` (use PHP's native ``DateTime::format()`` 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()`.
@@ -138,6 +140,7 @@ Release Date: Not Released
- Added 'img_class' option.
- Added ability to generate ``data:image/png;base64`` URIs instead of writing image files to disk.
- Updated to always create PNG images instead of JPEG.
+ - Removed previously deprecated usage with ``$img_path``, ``$img_url``, ``$font_path`` as extra parameters instead of array options.
Bug fixes for 3.2.0
===================
@@ -411,7 +414,7 @@ Release Date: Jan 09, 2017
- Deprecated ``$config['allow_get_array']``.
- Deprecated ``$config['standardize_newlines']``.
- - Deprecated :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()`.
+ - Deprecated :doc:`Date Helper <helpers/date_helper>` function ``nice_date()``.
Bug fixes for 3.1.3
-------------------
@@ -423,7 +426,7 @@ Bug fixes for 3.1.3
- Fixed a bug (#4902) - :doc:`Image Manipulation Library <libraries/image_lib>` processing via ImageMagick didn't work.
- Fixed a bug (#4905) - :doc:`Loader Library <libraries/loader>` didn't take into account possible user-provided directory paths when loading helpers.
- Fixed a bug (#4916) - :doc:`Session Library <libraries/sessions>` with ``sess_match_ip`` enabled was unusable for IPv6 clients when using the 'database' driver on MySQL 5.7.5+.
-- Fixed a bug (#4917) - :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()` didn't handle YYYYMMDD inputs properly.
+- Fixed a bug (#4917) - :doc:`Date Helper <helpers/date_helper>` function ``nice_date()`` didn't handle YYYYMMDD inputs properly.
- Fixed a bug (#4923) - :doc:`Session Library <libraries/sessions>` could execute an erroneous SQL query with the 'database' driver, if the lock attempt times out.
- Fixed a bug (#4927) - :doc:`Output Library <libraries/output>` method ``get_header()`` returned the first matching header, regardless of whether it would be replaced by a second ``set_header()`` call.
- Fixed a bug (#4844) - :doc:`Email Library <libraries/email>` didn't apply ``escapeshellarg()`` to the while passing the Sendmail ``-f`` parameter through ``popen()``.
@@ -1464,7 +1467,7 @@ Bug fixes for 3.0
- Fixed a bug in :doc:`Query Builder <database/query_builder>` method ``protect_identifiers()`` where if passed along with the field names, operators got escaped as well.
- Fixed a bug (#10) - :doc:`URI Library <libraries/uri>` internal method ``_detect_uri()`` failed with paths containing a colon.
- Fixed a bug (#1387) - :doc:`Query Builder <database/query_builder>` method ``from()`` didn't escape table aliases.
-- Fixed a bug (#520) - :doc:`Date Helper <helpers/date_helper>` function :php:func:``nice_date()`` failed when the optional second parameter is not passed.
+- Fixed a bug (#520) - :doc:`Date Helper <helpers/date_helper>` function ``nice_date()`` failed when the optional second parameter is not passed.
- Fixed a bug (#318) - :doc:`Profiling Library <general/profiling>` setting *query_toggle_count* was not settable as described in the manual.
- Fixed a bug (#938) - :doc:`Config Library <libraries/config>` method ``site_url()`` added a question mark to the URL string when query strings are enabled even if it already existed.
- Fixed a bug (#999) - :doc:`Config Library <libraries/config>` method ``site_url()`` always appended ``$config['url_suffix']`` to the end of the URL string, regardless of whether a query string exists in it.
diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst
index a1c13c5c8..f8d97596a 100644
--- a/user_guide_src/source/helpers/captcha_helper.rst
+++ b/user_guide_src/source/helpers/captcha_helper.rst
@@ -129,12 +129,9 @@ Available Functions
The following functions are available:
-.. php:function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]])
+.. php:function:: create_captcha($data)
:param array $data: Array of data for the CAPTCHA
- :param string $img_path: Path to create the image in (DEPRECATED)
- :param string $img_url: URL to the CAPTCHA image folder (DEPRECATED)
- :param string $font_path: Server path to font (DEPRECATED)
:returns: array('word' => $word, 'time' => $now, 'image' => $img)
:rtype: array
@@ -159,7 +156,3 @@ The following functions are available:
The **word** is the word that appears in the captcha image, which if not
supplied to the function, will be a random string.
-
- .. note:: Usage of the ``$img_path``, ``$img_url`` and ``$font_path``
- parameters is DEPRECATED. Provide them in the ``$data`` array
- instead.
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index c63a9d291..1f6b93cda 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -157,33 +157,6 @@ The following functions are available:
$human = unix_to_human($now);
$unix = human_to_unix($human);
-.. php:function:: nice_date([$bad_date = ''[, $format = FALSE]])
-
- :param int $bad_date: The terribly formatted date-like string
- :param string $format: Date format to return (same as PHP's ``date()`` function)
- :returns: Formatted date
- :rtype: string
-
- This function can take a number poorly-formed date formats and convert
- them into something useful. It also accepts well-formed dates.
-
- The function will return a UNIX timestamp by default. You can, optionally,
- pass a format string (the same type as the PHP ``date()`` function accepts)
- as the second parameter.
-
- Example::
-
- $bad_date = '199605';
- // Should Produce: 1996-05-01
- $better_date = nice_date($bad_date, 'Y-m-d');
-
- $bad_date = '9-11-2001';
- // Should Produce: 2001-09-11
- $better_date = nice_date($bad_date, 'Y-m-d');
-
- .. note:: This function is DEPRECATED. Use PHP's native `DateTime class
- <https://secure.php.net/datetime>`_ instead.
-
.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]])
:param int $seconds: Number of seconds
diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst
index 715e8858d..368871d7d 100644
--- a/user_guide_src/source/installation/upgrade_320.rst
+++ b/user_guide_src/source/installation/upgrade_320.rst
@@ -213,6 +213,7 @@ CodeIgniter versions that have been removed in 3.2.0:
- ``CI_Form_validation::prep_for_form()`` (the *prep_for_form* rule)
- ``standard_date()`` :doc:`Date Helper <../helpers/date_helper>` function (use ``date()`` instead)
+- ``nice_date()`` :doc:`Date Helper <../helpers/date_helper>` function (use ``DateTime::format()`` instead)
- ``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)
@@ -235,6 +236,8 @@ CodeIgniter versions that have been removed in 3.2.0:
- 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()`.
+- The ``$img_path``, ``$img_url`` and ``$font_path`` parameters from
+ :doc:`CAPCHA Helper <../helpers/captcha_helper>` function :php:func:`create_captcha()` (pass as array options instead).
Step 11: Make sure you're validating all user inputs
====================================================