Пример #1
0
 function getType()
 {
     $this->data = wpdreams_admin_hex2rgb($this->data);
     $this->name = $this->name . "_colorpicker";
     echo "<span class='wpdreamsColorPicker'>";
     if ($this->label != "") {
         echo "<label for='wpdreamscolorpicker_" . self::$_instancenumber . "'>" . $this->label . "</label>";
     }
     echo "<input type='text' class='color' id='" . $this->name . "' id='wpdreamscolorpicker_" . self::$_instancenumber . "'  name='" . $this->name . "' id='wpdreamscolorpicker_" . self::$_instancenumber . "' value='" . $this->data . "' />";
     echo "<div class='triggerer'></div>\n      </span>";
 }
Пример #2
0
 function processData()
 {
     $this->data = str_replace("\n", "", $this->data);
     preg_match("/(.*?)-(.*?)-(.*?)-(.*)/", $this->data, $matches);
     $this->grad_type = $matches[1];
     $this->rotation = $matches[2];
     if ($this->rotation == null || $this->rotation == '') {
         $this->rotation = 0;
     }
     $this->leftcolor = wpdreams_admin_hex2rgb($matches[3]);
     $this->rightcolor = wpdreams_admin_hex2rgb($matches[4]);
     $this->data = $this->grad_type . '-' . $this->rotation . '-' . $this->leftcolor . '-' . $this->rightcolor;
 }
Пример #3
0
 function getType()
 {
     $this->data = wpdreams_admin_hex2rgb($this->data);
     $this->name = $this->name . "_colorpicker";
     echo "<span class='wpdreamsColorPicker'>";
     if ($this->label != "") {
         echo "<label for='wpdreamscolorpicker_" . self::$_instancenumber . "'>" . $this->label . "</label>";
     }
     echo "<input type='text' class='color' id='" . $this->name . "' id='wpdreamscolorpicker_" . self::$_instancenumber . "'  name='" . $this->name . "' id='wpdreamscolorpicker_" . self::$_instancenumber . "' value='" . $this->data . "' />";
     //echo "<input type='button' class='wpdreamscolorpicker button-secondary' value='Select Color'>";
     //echo "<div class='' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div>";
     echo "<div class='triggerer'></div>\n      </span>";
 }
Пример #4
0
    function wpdreams_gradient_css_rgba($data, $print = true)
    {
        $data = str_replace("\n", "", $data);
        preg_match("/(.*?)-(.*?)-(.*?)-(.*)/", $data, $matches);
        if (!isset($matches[1]) || !isset($matches[2]) || !isset($matches[3])) {
            // Probably only 1 color..
            echo "background: " . $data . ";";
            return;
        }
        $type = $matches[1];
        $deg = $matches[2];
        $color1 = wpdreams_admin_hex2rgb($matches[3]);
        $color2 = wpdreams_admin_hex2rgb($matches[4]);
        ob_start();
        //compatibility
        if ($type != '0' || $type != 0) {
            ?>
linear-gradient(<?php 
            echo $deg;
            ?>
deg, <?php 
            echo $color1;
            ?>
, <?php 
            echo $color2;
            ?>
)<?php 
        } else {
            //radial
            ?>
radial-gradient(ellipse at center,  <?php 
            echo $color1;
            ?>
, <?php 
            echo $color2;
            ?>
)<?php 
        }
        $out = ob_get_clean();
        if ($print) {
            echo $out;
        }
        return $out;
    }