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