| @@ -5,21 +5,19 @@ | ||
| 5 | 5 | abstract class block |
| 6 | 6 | { |
| 7 | 7 | protected $data = array(); |
| 8 | 8 | protected $collection = null; |
| 9 | + protected $network; | |
| 9 | 10 | protected $fields = array(); |
| 10 | 11 | protected $fielddata = array(); |
| 11 | 12 | protected $blockname; |
| 12 | 13 | protected $is_preview = false; |
| 13 | 14 | |
| 14 | - //protected static $eventInit = false; | |
| 15 | - protected $network; | |
| 16 | 15 | |
| 17 | - | |
| 18 | 16 | public function __construct() |
| 19 | 17 | { |
| 20 | - $w = MBSocial()->whistle(); | |
| 21 | - $w->listen('display/parse/network', array($this, 'set_network'), 'tell'); | |
| 18 | + $w = MBSocial()->whistle(); | |
| 19 | + $w->listen('display/parse/network', array($this, 'set_network'), 'tell'); | |
| 22 | 20 | } |
| 23 | 21 | |
| 24 | 22 | public function set_network($network) |
| 25 | 23 | { |
| @@ -77,32 +75,22 @@ | ||
| 77 | 75 | } |
| 78 | 76 | |
| 79 | 77 | public function getColorValue($fieldname) |
| 80 | 78 | { |
| 81 | - $value = self::getValue($fieldname); | |
| 82 | - if ($this->isrgba($value)) | |
| 83 | - return $value; | |
| 84 | - | |
| 79 | + $value = $this->getValue($fieldname); | |
| 85 | 80 | if (! $value ) |
| 86 | 81 | return false; |
| 82 | + | |
| 87 | 83 | if (substr($value,0,1) !== '#') |
| 88 | 84 | { |
| 89 | 85 | $value = '#' . $value; |
| 90 | 86 | } |
| 87 | + | |
| 91 | 88 | return $value; |
| 92 | -} | |
| 93 | 89 | |
| 94 | -private function isrgba($value) | |
| 95 | -{ | |
| 96 | - if (strpos($value, 'rgb') >= 0 ) | |
| 97 | - return true; | |
| 98 | - else { | |
| 99 | - return false; | |
| 100 | - } | |
| 101 | 90 | } |
| 102 | 91 | |
| 103 | 92 | |
| 104 | - | |
| 105 | 93 | public function setPreview($preview = true) |
| 106 | 94 | { |
| 107 | 95 | $this->is_preview = $preview; |
| 108 | 96 | |
| @@ -153,11 +141,9 @@ | ||
| 153 | 141 | else |
| 154 | 142 | { |
| 155 | 143 | $default = (isset($options["default"])) ? $options["default"] : ''; |
| 156 | 144 | // stripslashes since the WP post var adds them. |
| 157 | - | |
| 158 | 145 | $blockdata[$field] = (isset($post[$field])) ? stripslashes(sanitize_text_field($post[$field])) : $default; |
| 159 | - | |
| 160 | 146 | } |
| 161 | 147 | } |
| 162 | 148 | |
| 163 | 149 | $data[$this->blockname] = $blockdata; |