public static function checkLinkContrastWcag2AAA($cssPropriety, $bodyAttribute)
 {
     global $background, $foreground;
     global $global_e, $global_content_dom;
     global $stringa_testo_prova;
     $e = $global_e;
     $content_dom = $global_content_dom;
     BasicChecks::setCssSelectors($content_dom);
     if (!BasicChecks::isElementVisible($e)) {
         return true;
     }
     $background = '';
     $foreground = '';
     if (trim(BasicChecks::remove_children($e)) == "" || trim(BasicChecks::remove_children($e)) == " ") {
         //l'elemento non contiene testo "visibile": non eseguo il controllo del contrasto
         // the element has no text "visible": Do not run the contrast control
         return true;
     }
     $foreground = BasicChecks::getForegroundA($e, $cssPropriety);
     if ($foreground == "undetermined") {
         return true;
     }
     if (($foreground == "" || $foreground == null) && $bodyAttribute != null) {
         $app = $e->parent();
         while ($app->tag != "body" && $app->tag != "html" && $app->tag != null) {
             $app = $app->parent();
         }
         if ($app != null && isset($app->attr[$bodyAttribute])) {
             $foreground = $app->attr[$bodyAttribute];
         }
     }
     if ($foreground == "undetermined") {
         return true;
     }
     if ($foreground == "" || $foreground == null) {
         return true;
     }
     $background = BasicChecks::getBackgroundA($e, $cssPropriety);
     if ($background == "undetermined") {
         return true;
     }
     if ($background == "" || $background == null) {
         $background = BasicChecks::getBackground($e);
     }
     if ($background == "" || $background == null || $background == "-1") {
         return true;
     }
     if ($background == "undetermined") {
         return true;
     }
     $background = BasicChecks::convert_color_to_hex($background);
     $foreground = BasicChecks::convert_color_to_hex($foreground);
     $ris = '';
     $ris = BasicChecks::ContrastRatio(strtolower($background), strtolower($foreground));
     //echo "tag->"; echo $e->tag; echo " bg->"; echo $background; echo " fr->"; echo $foreground; echo " ris="; echo $ris; echo "<br>";
     $size = BasicChecks::fontSizeToPt($e);
     $bold = BasicChecks::get_p_css($e, "font-weight");
     if ($size < 0) {
         //formato non supportato
         return true;
     } elseif ($size >= 18 || $bold == "bold" && $size >= 14) {
         $threashold = 4.5;
     } else {
         $threashold = 7;
     }
     $stringa_testo_prova = '';
     $stringa_testo_prova = "<p>ris: " . $ris . " threashold: " . $threashold . "</p>";
     if ($ris < $threashold) {
         return false;
     } else {
         return true;
     }
     return true;
 }
 public static function checkColorContrastForGeneralElementWCAG2AAA()
 {
     //WCAG2.0 Contrast check
     global $background, $foreground;
     global $global_e, $global_content_dom;
     global $stringa_testo_prova;
     $e = $global_e;
     $content_dom = $global_content_dom;
     BasicChecks::setCssSelectors($content_dom);
     $background = '';
     $foreground = '';
     //elementi testuali
     if (($e->tag == "div" || $e->tag == "p" || $e->tag == "span" || $e->tag == "strong" || $e->tag == "em" || $e->tag == "q" || $e->tag == "cite" || $e->tag == "blockquote" || $e->tag == "li" || $e->tag == "dd" || $e->tag == "dt" || $e->tag == "td" || $e->tag == "th" || $e->tag == "h1" || $e->tag == "h2" || $e->tag == "h3" || $e->tag == "h4" || $e->tag == "h5" || $e->tag == "h6" || $e->tag == "label" || $e->tag == "acronym" || $e->tag == "abbr" || $e->tag == "code" || $e->tag == "pre") && BasicChecks::isElementVisible($e)) {
         if (trim(BasicChecks::remove_children($e)) == "" || trim(BasicChecks::remove_children($e)) == "&nbsp;") {
             //l'elemento non contiene testo "visibile": non eseguo il controllo del contrasto
             return true;
         }
         $background = BasicChecks::getBackground($e);
         $foreground = BasicChecks::getForeground($e);
         if ($foreground == "" || $foreground == null || $background == "undetermined") {
             return true;
         }
         if ($background == "" || $background == null || $background == "-1" || $background == "undetermined") {
             return true;
         }
         $background = BasicChecks::convert_color_to_hex($background);
         $foreground = BasicChecks::convert_color_to_hex($foreground);
         $ris = '';
         $ris = BasicChecks::ContrastRatio(strtolower($background), strtolower($foreground));
         //echo "tag->"; echo $e->tag; echo " bg->"; echo $background; echo " fr->"; echo $foreground; echo " ris="; echo $ris; echo "<br>";
         $size = BasicChecks::fontSizeToPt($e);
         $bold = BasicChecks::get_p_css($e, "font-weight");
         if ($e->tag == "h1" || $e->tag == "h2" || $e->tag == "h3" || $e->tag == "h4" || $e->tag == "h5" || $e->tag == "h6") {
             $bold = "bold";
         }
         if ($size < 0) {
             //formato non supportato
             return true;
         } elseif ($size >= 18 || $bold == "bold" && $size >= 14) {
             $threashold = 4.5;
         } else {
             $threashold = 7;
         }
         $stringa_testo_prova = '';
         $stringa_testo_prova = "<p>ris: " . $ris . " threashold: " . $threashold . "</p>";
         if ($ris < $threashold) {
             return false;
         } else {
             return true;
         }
     }
     return true;
 }