xhtmlentities() public static method

Converts special characters in a string to XHTML-valid ASCII encoding the same as htmlentities except this method allows the use of HTML tags within your string. Signature is the same as htmlentities except that the only character sets available (third argument) are UTF-8 (default) and ISO-8859-1 (Latin-1).
public static xhtmlentities ( string $string, integer $quoteStyle = ENT_NOQUOTES, string $charset = 'UTF-8', boolean $doubleEncode = false ) : string
$string string
$quoteStyle integer Constants available are ENT_NOQUOTES (default), ENT_QUOTES, ENT_COMPAT
$charset string Only valid options are UTF-8 (default) and ISO-8859-1 (Latin-1)
$doubleEncode boolean Default is false
return string
 /**
  * Adds label tags to a form element
  *
  * @param array $args
  * @param str $formElement
  * @return str
  */
 protected function _getLabel(array $args, $formElement)
 {
     if (!isset($args['label']) && isset($args['name']) && (!isset($args['type']) || !in_array($args['type'], $this->_staticTypes))) {
         $args['label'] = ucfirst($args['name']);
     }
     if (isset($args['label'])) {
         $label = get::xhtmlentities($args['label']);
         if (isset($_POST['errors']) && isset($args['name']) && isset($_POST['errors'][$args['name']])) {
             $label .= ' ' . $this->getErrorMessageContainer($args['name'], $_POST['errors'][$args['name']]);
         }
         $labelFirst = !isset($args['labelFirst']) || $args['labelFirst'];
         if (isset($args['id'])) {
             $label = '<label for="' . $args['id'] . '" id="' . $args['id'] . 'label">' . $label . '</label>';
         }
         if (isset($args['addBreak']) && $args['addBreak']) {
             $label = $labelFirst ? $label . '<br />' : '<br />' . $label;
         }
         $formElement = $labelFirst ? $label . $formElement : $formElement . $label;
         if (!isset($args['id'])) {
             $formElement = '<label>' . $formElement . '</label>';
         }
     }
     return $formElement;
 }