summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-07 15:13:03 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-07 15:13:03 +0100
commitac023e10e7d9e4ad11783ff7e1154d2701a1ec18 (patch)
treec85d3443a95e08d0f0cdc12eabe7f38c458ffeb3 /system
parenta20ec975e653f501cca8e1cf57a9ea244417990f (diff)
Change Text helper default tag from <strong> to <mark>
Supersedes PR #1497
Diffstat (limited to 'system')
-rw-r--r--system/helpers/text_helper.php24
1 files changed, 8 insertions, 16 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;
}
}