Exemplo n.º 1
0
 /**
  * returns the html attributes string
  * @param  array $attributes_arr  attributes array
  * @param  array  $reserved_arr   array of attributes name that will be skipped if present in the attributes array
  * @return string                 the html attributes string
  */
 public function get_attributes_string($attributes_arr, $reserved_arr = array('type', 'name', 'id', 'value'))
 {
     $attributes = '';
     foreach ($reserved_arr as $key => $reserved) {
         if (isset($attributes_arr[$reserved])) {
             unset($attributes_arr[$reserved]);
         }
     }
     foreach ($attributes_arr as $key => $value) {
         if (!is_string($value) && !is_numeric($value)) {
             continue;
         }
         $value = cs_form::process_plain($value);
         if (trim($value) != '') {
             $value = trim($value);
             $attributes .= " {$key}=\"{$value}\"";
         }
     }
     $attributes = trim($attributes);
     return empty($attributes) ? '' : ' ' . $attributes;
 }