Exemplo n.º 1
0
 /**
  * Check radio button groups are marked using "fieldset" and "legend" elements
  * Return: use global variable $is_radio_buttons_grouped to return true (grouped properly) or false (not grouped)
  */
 public static function is_radio_buttons_grouped($e)
 {
     $radio_buttons = array();
     foreach ($e->find("input") as $e_input) {
         if (strtolower(trim($e_input->attr["type"])) == "radio") {
             array_push($radio_buttons, $e_input);
         }
     }
     for ($i = 0; $i < count($radio_buttons); $i++) {
         for ($j = 0; $j < count($radio_buttons); $j++) {
             if ($i != $j && strtolower(trim($radio_buttons[$i]->attr["name"])) == strtolower(trim($radio_buttons[$j]->attr["name"])) && !BasicChecks::has_parent($radio_buttons[$i], "fieldset") && !BasicChecks::has_parent($radio_buttons[$i], "legend")) {
                 return false;
             }
         }
     }
     return true;
 }