| @@ -77,22 +77,32 @@ | ||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function getColorValue($fieldname) |
| 80 | 80 | { |
| 81 | - $value = $this->getValue($fieldname); | |
| 81 | + $value = self::getValue($fieldname); | |
| 82 | + if ($this->isrgba($value)) | |
| 83 | + return $value; | |
| 84 | + | |
| 82 | 85 | if (! $value ) |
| 83 | 86 | return false; |
| 84 | - | |
| 85 | 87 | if (substr($value,0,1) !== '#') |
| 86 | 88 | { |
| 87 | 89 | $value = '#' . $value; |
| 88 | 90 | } |
| 89 | - | |
| 90 | 91 | return $value; |
| 92 | +} | |
| 91 | 93 | |
| 94 | +private function isrgba($value) | |
| 95 | +{ | |
| 96 | + if (strpos($value, 'rgb') >= 0 ) | |
| 97 | + return true; | |
| 98 | + else { | |
| 99 | + return false; | |
| 100 | + } | |
| 92 | 101 | } |
| 93 | 102 | |
| 94 | 103 | |
| 104 | + | |
| 95 | 105 | public function setPreview($preview = true) |
| 96 | 106 | { |
| 97 | 107 | $this->is_preview = $preview; |
| 98 | 108 | |
| @@ -143,9 +153,11 @@ | ||
| 143 | 153 | else |
| 144 | 154 | { |
| 145 | 155 | $default = (isset($options["default"])) ? $options["default"] : ''; |
| 146 | 156 | // stripslashes since the WP post var adds them. |
| 157 | + | |
| 147 | 158 | $blockdata[$field] = (isset($post[$field])) ? stripslashes(sanitize_text_field($post[$field])) : $default; |
| 159 | + | |
| 148 | 160 | } |
| 149 | 161 | } |
| 150 | 162 | |
| 151 | 163 | $data[$this->blockname] = $blockdata; |