| @@ -2,9 +2,8 @@ | ||
| 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; | |
| 7 | 6 | |
| 8 | 7 | abstract class mbNetwork |
| 9 | 8 | { |
| 10 | 9 | |
| @@ -15,10 +14,8 @@ | ||
| 15 | 14 | protected $countable = false; // If network supports count of likes / shares / favs |
| 16 | 15 | protected $count_api = ''; // API URL for requesting counts |
| 17 | 16 | protected $count_check_time = 14400; // (PHP 5.3) 4 * HOUR_IN_SECONDS; // Transient time, how often to check network for new counts |
| 18 | 17 | 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) | |
| 21 | 18 | protected $is_popup = true; // Open in Popup or not |
| 22 | 19 | protected $popup_dimensions = array(400,300); // Default popup dimensions |
| 23 | 20 | protected $return_var; // Count API return var ( JSON format ) |
| 24 | 21 | |
| @@ -36,12 +33,8 @@ | ||
| 36 | 33 | protected $label; // Label (default) Text. This will be in the button, e.g. on hover |
| 37 | 34 | |
| 38 | 35 | protected $icon_type = 'fab'; // Icon library set |
| 39 | 36 | protected $icon = 'fa-circle'; // Icon |
| 40 | - protected $icon_image_id; // for svg type icons. | |
| 41 | - protected $icon_image_url; | |
| 42 | - protected $icon_image_size; | |
| 43 | -// protected $icon_image_alt = ''; | |
| 44 | 37 | |
| 45 | 38 | protected $color = '#fff'; |
| 46 | 39 | |
| 47 | 40 | // extra options [internal] |
| @@ -50,18 +43,12 @@ | ||
| 50 | 43 | protected $is_active = true; |
| 51 | 44 | protected $is_limitedpro = false; // the network is only intended for MB PRO |
| 52 | 45 | protected $forcesamewindow = false; // never open this in a new window / i.e. email / print type networks |
| 53 | 46 | |
| 54 | - protected $default_options = null; | |
| 55 | - | |
| 56 | 47 | public function __construct() |
| 57 | 48 | { |
| 58 | - if (is_null($this->profile_placeholder)) | |
| 59 | - $this->profile_placeholder = __('User Name','mbsocial'); | |
| 60 | - if (is_null($this->profile_label)) | |
| 61 | - $this->profile_label = __('Follow', 'mbsocial'); | |
| 62 | - | |
| 63 | - $this->default_options = $this->get_all_options(); // init them as default. For save function | |
| 49 | + $this->profile_placeholder = __('User Name','mbsocial'); | |
| 50 | + $this->profile_label = __('Follow', 'mbsocial'); | |
| 64 | 51 | } |
| 65 | 52 | |
| 66 | 53 | public function get($name) |
| 67 | 54 | { |
| @@ -75,12 +62,8 @@ | ||
| 75 | 62 | { |
| 76 | 63 | $popup_width = isset($this->popup_dimensions[0]) ? $this->popup_dimensions[0] : 0; |
| 77 | 64 | $popup_height = isset($this->popup_dimensions[1]) ? $this->popup_dimensions[1] : 0; |
| 78 | 65 | |
| 79 | - | |
| 80 | - // iterate on this next time perhaps. | |
| 81 | - //$attrs = get_object_vars($this); | |
| 82 | - | |
| 83 | 66 | $options = array( |
| 84 | 67 | 'active' => $this->is_active, // no nw setting for this |
| 85 | 68 | 'popup' => $this->is_popup, |
| 86 | 69 | 'label' => $this->label, |
| @@ -89,25 +72,16 @@ | ||
| 89 | 72 | 'popup_width' => $popup_width, |
| 90 | 73 | 'popup_height' => $popup_height, |
| 91 | 74 | 'icon_type' => $this->icon_type, |
| 92 | 75 | 'icon' => $this->icon, |
| 93 | - 'icon_image_id' => $this->icon_image_id, | |
| 94 | - 'icon_image_url' => $this->icon_image_url, | |
| 95 | - // 'icon_image_alt' => $this->icon_image_alt, | |
| 96 | - 'icon_image_size' => $this->icon_image_size, | |
| 97 | 76 | 'color' => $this->color, |
| 98 | 77 | 'displayMobile' => $this->displayMobile, |
| 99 | - 'displayDesktop' => $this->displayDesktop, | |
| 78 | + 'displayDesktop' => $this->displayDesktop, | |
| 100 | 79 | ); |
| 101 | 80 | |
| 102 | 81 | return $options; |
| 103 | 82 | } |
| 104 | 83 | |
| 105 | - public function get_all_defaults() | |
| 106 | - { | |
| 107 | - return $this->default_options; | |
| 108 | - } | |
| 109 | - | |
| 110 | 84 | public function load_settings($settings) |
| 111 | 85 | { |
| 112 | 86 | if (! $settings) |
| 113 | 87 | return; |
| @@ -179,16 +153,8 @@ | ||
| 179 | 153 | |
| 180 | 154 | return true; |
| 181 | 155 | } |
| 182 | 156 | |
| 183 | - public function has_alternate() | |
| 184 | - { | |
| 185 | - if (is_null($this->alternate_url)) | |
| 186 | - return false; | |
| 187 | - | |
| 188 | - return true; | |
| 189 | - } | |
| 190 | - | |
| 191 | 157 | /** Use this function to check if popup link should be used **/ |
| 192 | 158 | public function is_popup() |
| 193 | 159 | { |
| 194 | 160 | $use_profile = MBSocial()->whistle()->ask('editor/profile/use'); |
| @@ -236,16 +202,12 @@ | ||
| 236 | 202 | } |
| 237 | 203 | elseif ($is_profile && $is_share) |
| 238 | 204 | { |
| 239 | 205 | $use_profile = MBSocial()->whistle()->ask('editor/profile/use'); |
| 240 | - $use_alternate = MBSocial()->whistle()->ask('editor/profile/alternate'); | |
| 241 | 206 | |
| 242 | 207 | if ($use_profile == 1) |
| 243 | 208 | { |
| 244 | - if ($use_alternate == 1) | |
| 245 | - return $this->alternate_url; | |
| 246 | - else | |
| 247 | - return $this->profile_url; | |
| 209 | + return $this->profile_url; | |
| 248 | 210 | } |
| 249 | 211 | else { |
| 250 | 212 | return $this->share_url; |
| 251 | 213 | } |
| @@ -276,9 +238,9 @@ | ||
| 276 | 238 | "; |
| 277 | 239 | |
| 278 | 240 | $html .= "</a></span>"; |
| 279 | 241 | |
| 280 | - $button = \MaxButtons\str_get_html($html); | |
| 242 | + $button = str_get_html($html); | |
| 281 | 243 | return $button; |
| 282 | 244 | } |
| 283 | 245 | |
| 284 | 246 | public function getRemoteShareCount($share_url) |