PluginProbe
Social Share Buttons / 1.19
Social Share Buttons v1.19
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-network.php +18 -3 1.61.19 View file →
@@ -2,8 +2,9 @@
2 2 namespace MBSocial;
3 3 defined('ABSPATH') or die('No direct access permitted');
4 4
5 5 use \MaxButtons\MaxUtils as MaxUtils;
6 +use \MaxButtons\simple_html_dom as simple_html_dom;
6 7
7 8 abstract class mbNetwork
8 9 {
9 10
@@ -14,8 +15,10 @@
14 15 protected $countable = false; // If network supports count of likes / shares / favs
15 16 protected $count_api = ''; // API URL for requesting counts
16 17 protected $count_check_time = 14400; // (PHP 5.3) 4 * HOUR_IN_SECONDS; // Transient time, how often to check network for new counts
17 18 protected $share_url = null; // URL to link to when sharing something
19 + protected $alternate_url = null; // if another URL needs to be
20 + protected $alternate_label = null; // Label for the other option (checkbox)
18 21 protected $is_popup = true; // Open in Popup or not
19 22 protected $popup_dimensions = array(400,300); // Default popup dimensions
20 23 protected $return_var; // Count API return var ( JSON format )
21 24
@@ -55,9 +58,9 @@
55 58 if (is_null($this->profile_placeholder))
56 59 $this->profile_placeholder = __('User Name','mbsocial');
57 60 if (is_null($this->profile_label))
58 61 $this->profile_label = __('Follow', 'mbsocial');
59 -
62 +
60 63 $this->default_options = $this->get_all_options(); // init them as default. For save function
61 64 }
62 65
63 66 public function get($name)
@@ -176,8 +179,16 @@
176 179
177 180 return true;
178 181 }
179 182
183 + public function has_alternate()
184 + {
185 + if (is_null($this->alternate_url))
186 + return false;
187 +
188 + return true;
189 + }
190 +
180 191 /** Use this function to check if popup link should be used **/
181 192 public function is_popup()
182 193 {
183 194 $use_profile = MBSocial()->whistle()->ask('editor/profile/use');
@@ -225,12 +236,16 @@
225 236 }
226 237 elseif ($is_profile && $is_share)
227 238 {
228 239 $use_profile = MBSocial()->whistle()->ask('editor/profile/use');
240 + $use_alternate = MBSocial()->whistle()->ask('editor/profile/alternate');
229 241
230 242 if ($use_profile == 1)
231 243 {
232 - return $this->profile_url;
244 + if ($use_alternate == 1)
245 + return $this->alternate_url;
246 + else
247 + return $this->profile_url;
233 248 }
234 249 else {
235 250 return $this->share_url;
236 251 }
@@ -261,9 +276,9 @@
261 276 ";
262 277
263 278 $html .= "</a></span>";
264 279
265 - $button = str_get_html($html);
280 + $button = \MaxButtons\str_get_html($html);
266 281 return $button;
267 282 }
268 283
269 284 public function getRemoteShareCount($share_url)