/**
 * Encode to HTML5 entities.
 *
 * @param string $string_
 * @param string $charset_
 *
 * @return string
 */
function escape5($string_, $charset_ = null, $flags_ = ENT_QUOTES)
{
    return \html\escape($string_, $charset_, ENT_HTML5, $flags_);
}
 /**
  * @see \html\escape escape
  */
 public static function escapeHtml($string_, Io_Charset $charset_ = null, $flags_ = ENT_QUOTES)
 {
     if (null === $charset_) {
         return \html\escape($string_, null, ENT_XHTML, $flags_);
     }
     return \html\escape($string_, $charset_->name(), ENT_XHTML, $flags_);
 }
 function printErrors($includeSubPanels_ = true, $expandThreshold_ = 4)
 {
     $errors = $this->errors($includeSubPanels_);
     if (1 > ($count = $this->countErrors($includeSubPanels_))) {
         return;
     }
     // TODO Localize ...
     printf('
     <div class="ui_panel_errors">
       <div class="ui_panel_disclosure_header">
         <h2 class="title">%2$s (%3$s)</h2>
         <a href="javascript:void(0);" rel="%1$s-errors" class="ui_panel_disclosure_toggle%4$s">collapse</a>
       </div>', $this->id(), \html\escape(I18n::translate('ui/panel/errors/title')), $count, $count > $expandThreshold_ ? '' : ' expanded');
     printf('<ul id="%1$s-errors" class="ui_panel_errors">', $this->id());
     foreach ($errors as $panelId => $value) {
         if ($includeSubPanels_) {
             if (!($title = $value['panel']->title)) {
                 $title = $value['panel']->name;
             }
             printf('<li class="ui_panel_error_category"><label for="%1$s">%2$s</label><ul>', $value['panel']->id(), \html\escape($title));
         }
         foreach ($value['errors'] as $error) {
             printf('<li class="ui_panel_error"><label for="%1$s">%2$s</label></li>', $value['panel']->id(), \html\escape($error['message']));
         }
         if ($includeSubPanels_) {
             echo '</ul></li>';
         }
     }
     echo '</ul></div>';
 }