コード例 #1
0
 public static function get_p_css_a($e, $p, $link_sel)
 {
     // $ best: will store 'the value of the priority rule that has'more' contained in the high-style, indoor / outdoor
     // relative to the element $ e '$ p
     //
     //$best: memorizzera' il valore della regola che ha priorita' piu' alta contenuta nello stile interno/esterno,
     //relativamente all'elemento $e e alla proprita' $p
     $best = null;
     //id
     if (isset($e->attr["id"])) {
         $id = BasicChecks::GetElementStyleId($e, $e->attr["id"] . ":" . $link_sel, $p);
         $best = BasicChecks::getPriorityInfo($best, $id);
     }
     //classe
     if (isset($e->attr["class"])) {
         $class = BasicChecks::GetElementStyleClass($e, $e->attr["class"] . ":" . $link_sel, $p);
         $best = BasicChecks::getPriorityInfo($best, $class);
     }
     //tag
     $tag = BasicChecks::GetElementStyle($e, $e->tag . ":" . $link_sel, $p);
     $best = BasicChecks::getPriorityInfo($best, $tag);
     // if $ p style inline there is no 'I return the best value of $
     //se nello stile inline $p non c'e' restituisco il valore di $best
     //echo("<p>regola</p>");
     //print_r($best["css_rule"]);
     global $array_css;
     if (isset($best["css_rule"])) {
         $same = false;
         if (sizeof($array_css) > 0) {
             $size_of_best = sizeof($best["css_rule"]["prev"]);
             foreach ($array_css as $rule) {
                 $size_of_prev_rules = sizeof($rule["prev"]);
                 if ($size_of_prev_rules == $size_of_best) {
                     for ($i = 0; $i < $size_of_prev_rules; $i++) {
                         if ($rule["prev"][$i] == $best["css_rule"]["prev"][$i]) {
                             $same = true;
                         } else {
                             $same = false;
                             break;
                         }
                     }
                     if ($same == true) {
                         break;
                     }
                 }
             }
         }
         if ($same == false) {
             array_push($array_css, $best["css_rule"]);
         }
     }
     return $best["valore"];
 }