Ejemplo n.º 1
0
 function setColor($color, $position = NULL)
 {
     if (!is_array($color)) {
         $color = array($color);
     }
     if (!isset($position)) {
         $color = array_reverse($color);
     } elseif (!is_array($position)) {
         $position = array($position);
     }
     while ($cl = current($color)) {
         $strcl = NULL;
         if ($cl[0] == "#") {
             $rgb = color::hex2rgb($cl);
             $strcl = "colore," . $rgb[0] . "," . $rgb[1] . "," . $rgb[2];
         } elseif (strpos($cl, ",")) {
             $strcl = "colore," . $cl;
         }
         if ($strcl) {
             if (isset($position) && current($position) + 1) {
                 $this->color[current($position)] = $strcl;
             } else {
                 array_unshift($this->color, $strcl);
             }
         }
         next($position);
         next($color);
     }
 }