diff options
author | Andrey Andreev <narf@devilix.net> | 2014-01-07 15:13:03 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-01-07 15:13:03 +0100 |
commit | ac023e10e7d9e4ad11783ff7e1154d2701a1ec18 (patch) | |
tree | c85d3443a95e08d0f0cdc12eabe7f38c458ffeb3 | |
parent | a20ec975e653f501cca8e1cf57a9ea244417990f (diff) |
Change Text helper default tag from <strong> to <mark>
Supersedes PR #1497
-rw-r--r-- | system/helpers/text_helper.php | 24 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 7 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_300.rst | 20 |
3 files changed, 31 insertions, 20 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index b2351db95..c6d14784b 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -329,25 +329,17 @@ if ( ! function_exists('highlight_phrase')) * * Highlights a phrase within a text string * - * @param string the text string - * @param string the phrase you'd like to highlight - * @param string the openging tag to precede the phrase with - * @param string the closing tag to end the phrase with + * @param string $str the text string + * @param string $phrase the phrase you'd like to highlight + * @param string $tag_open the openging tag to precede the phrase with + * @param string $tag_close the closing tag to end the phrase with * @return string */ - function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>') + function highlight_phrase($str, $phrase, $tag_open = '<mark>', $tag_close = '</mark>') { - if ($str === '') - { - return ''; - } - - if ($phrase !== '') - { - return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open.'\\1'.$tag_close, $str); - } - - return $str; + return ($str !== '' && $phrase !== '') + ? preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open.'\\1'.$tag_close, $str) + : $str; } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index cf15e0fe2..e285ab014 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -130,9 +130,10 @@ Release Date: Not Released - Added *colors* configuration to allow customization for the *background*, *border*, *text* and *grid* colors. - Added *filename* to the returned array elements. - - :doc:`Directory Helper <helpers/directory_helper>` :php:func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array. - - :doc:`Array Helper <helpers/array_helper>` :php:func:`element()` and :php:func:`elements()` now return NULL instead of FALSE when the required elements don't exist. - - :doc:`Language Helper <helpers/language_helper>` :php:func:`lang()` now accepts an optional list of additional HTML attributes. + - :doc:`Directory Helper <helpers/directory_helper>` :func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array. + - :doc:`Array Helper <helpers/array_helper>` :func:`element()` and :php:func:`elements()` now return NULL instead of FALSE when the required elements don't exist. + - :doc:`Language Helper <helpers/language_helper>` :func:`lang()` now accepts an optional list of additional HTML attributes. + - Changed the default tag for use in :doc:`Text Helper <helpers/text_helper>` :func:`highlight_phrase()` to ``<mark>`` (formerly ``<strong>``). - Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively. - Database diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index ec80e8041..41153df16 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -488,4 +488,22 @@ The new function is both available at all times for you to use and shorter to ty CodeIgniter 3.1+. .. note:: This method is still available, but you're strongly encouraged to remove its usage - sooner rather than later.
\ No newline at end of file + sooner rather than later. + +*********************************************************** +Step 17: Check your usage of Text helper highlight_phrase() +*********************************************************** + +The default HTML tag used by :doc:`Text Helper <../helpers/text_helper>` function +:func:`highlight_phrase()` has been changed from ``<strong>`` to the new HTML5 +tag ``<mark>``. + +Unless you've used your own highlighting tags, this might cause trouble +for your visitors who use older web browsers such as Internet Explorer 8. +We therefore suggest that you add the following code to your CSS files +in order to avoid backwards compatibility with old browsers:: + + mark { + background: #ff0; + color: #000; + };
\ No newline at end of file |