* @param array $possible
* @param string $value
* @param array|string $attrs
* @return string
*/
public static function Select( $possible, $value=null, $attrs = []){
$attr_string = self::Attributes($attrs);
$html = "\n';
return $html;
}
/**
* Generate html ';
continue;
}
$selected = '';
if( $key == $current_value ){
$selected = ' selected ';
}
$html .= '';
}
return $html;
}
/**
* Generate html attributes
* @param array|string $attributes
* @return string;
*/
public static function Attributes($attributes){
if( is_string($attributes) ){
return $attributes;
}
$attr_string = '';
foreach($attributes as $attr => $value){
$attr_string .= ' ' . self::Chars($attr) . '="' . self::Chars($value) . '"';
}
return $attr_string;
}
public static function Chars($str){
return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false);
}
}