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