Jaxel Well-known member Jan 5, 2015 #1 I want to use wordtrim on a raw text field. However, the built-in wordtrim helper uses htmlspecialchars, so it inherently cant be used with raw text. Does XF have a helper for this?
I want to use wordtrim on a raw text field. However, the built-in wordtrim helper uses htmlspecialchars, so it inherently cant be used with raw text. Does XF have a helper for this?
Snog Well-known member Jan 5, 2015 #2 In a template? Yes.. Code: {xen:helper wordtrim, Your_String, Trim_Length} In PHP... Code: XenForo_Helper_String::wholeWordTrim(Your_String, Trim_Length) I don't see anything in the php code about htmlspecialchars. I must be blind.
In a template? Yes.. Code: {xen:helper wordtrim, Your_String, Trim_Length} In PHP... Code: XenForo_Helper_String::wholeWordTrim(Your_String, Trim_Length) I don't see anything in the php code about htmlspecialchars. I must be blind.
Jaxel Well-known member Jan 6, 2015 #3 Snog said: I don't see anything in the php code about htmlspecialchars. I must be blind. Click to expand... XenForo_Template_Helper_Core Code: public static function helperWordTrim($string, $trimLength) { return htmlspecialchars(XenForo_Helper_String::wholeWordTrim($string, $trimLength)); }
Snog said: I don't see anything in the php code about htmlspecialchars. I must be blind. Click to expand... XenForo_Template_Helper_Core Code: public static function helperWordTrim($string, $trimLength) { return htmlspecialchars(XenForo_Helper_String::wholeWordTrim($string, $trimLength)); }
Snog Well-known member Jan 6, 2015 #4 OK, I'm blind. Have you tried setting up your own helper that calls XenForo_Helper_String::wholeWordTrim($string, $trimLength) without htmlspecialchars? Code: public static function helperYourHelper($string, $trimLength) { return XenForo_Helper_String::wholeWordTrim($string, $trimLength); } Last edited: Jan 6, 2015
OK, I'm blind. Have you tried setting up your own helper that calls XenForo_Helper_String::wholeWordTrim($string, $trimLength) without htmlspecialchars? Code: public static function helperYourHelper($string, $trimLength) { return XenForo_Helper_String::wholeWordTrim($string, $trimLength); }