PluginProbe
Social Share Buttons / 1.1.2
Social Share Buttons v1.1.2
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 +11 -92 1.71.1.2 View file →
@@ -14,9 +14,9 @@
14 14 protected $countable = false; // If network supports count of likes / shares / favs
15 15 protected $count_api = ''; // API URL for requesting counts
16 16 protected $count_check_time = 14400; // (PHP 5.3) 4 * HOUR_IN_SECONDS; // Transient time, how often to check network for new counts
17 17 protected $share_url = null; // URL to link to when sharing something
18 - protected $is_popup = true; // Open in Popup or not
18 + protected $popup = true; // Open in Popup or not
19 19 protected $popup_dimensions = array(400,300); // Default popup dimensions
20 20 protected $return_var; // Count API return var ( JSON format )
21 21
22 22 // mobile or not settings - not yet developed
@@ -25,42 +25,30 @@
25 25
26 26 /** Options for Share Icons */
27 27 protected $profile_url = null; // URL to the network's profiles.
28 28 protected $profile_placeholder; // Placeholder for profile input text field [aka 'user name' or so ]
29 - protected $profile_label; // Not in use at the moment?
29 + protected $profile_label;
30 30
31 31 protected $nice_name; // Nice name for display in the Editor interface
32 32
33 - protected $label; // Label (default) Text. This will be in the button, e.g. on hover
33 + protected $label; // Lavel (default) Text. This will be in the button, e.g. on hover
34 34
35 35 protected $icon_type = 'fab'; // Icon library set
36 36 protected $icon = 'fa-circle'; // Icon
37 - protected $icon_image_id; // for svg type icons.
38 - protected $icon_image_url;
39 - protected $icon_image_size;
40 -// protected $icon_image_alt = '';
41 37
42 38 protected $color = '#fff';
43 39
44 40 // extra options [internal]
45 - protected $is_native = true; // is this network built-in, or imported? Relevant for network settings
46 - protected $is_editable = true; // should this network be user-editable?
47 - protected $is_active = true;
48 - protected $is_limitedpro = false; // the network is only intended for MB PRO
49 - protected $forcesamewindow = false; // never open this in a new window / i.e. email / print type networks
41 + protected $limitedpro = false; // the network is only intended for MB PRO
42 + protected $forcesamewindow = false; // never open this in a new window
50 43
51 - protected $default_options = null;
52 -
53 44 public function __construct()
54 45 {
55 - if (is_null($this->profile_placeholder))
56 - $this->profile_placeholder = __('User Name','mbsocial');
57 - if (is_null($this->profile_label))
58 - $this->profile_label = __('Follow', 'mbsocial');
59 -
60 - $this->default_options = $this->get_all_options(); // init them as default. For save function
46 + $this->profile_placeholder = __('User Name','mbsocial');
47 + $this->profile_label = __('Follow', 'mbsocial');
61 48 }
62 49
50 +
63 51 public function get($name)
64 52 {
65 53 if (isset($this->$name))
66 54 return $this->$name;
@@ -65,77 +53,11 @@
65 53 if (isset($this->$name))
66 54 return $this->$name;
67 55 else
68 56 return null;
69 - }
70 57
71 - public function get_all_options()
72 - {
73 - $popup_width = isset($this->popup_dimensions[0]) ? $this->popup_dimensions[0] : 0;
74 - $popup_height = isset($this->popup_dimensions[1]) ? $this->popup_dimensions[1] : 0;
75 -
76 -
77 - // iterate on this next time perhaps.
78 - //$attrs = get_object_vars($this);
79 -
80 - $options = array(
81 - 'active' => $this->is_active, // no nw setting for this
82 - 'popup' => $this->is_popup,
83 - 'label' => $this->label,
84 - 'share_url' => $this->share_url,
85 - 'profile_url' => $this->profile_url,
86 - 'popup_width' => $popup_width,
87 - 'popup_height' => $popup_height,
88 - 'icon_type' => $this->icon_type,
89 - 'icon' => $this->icon,
90 - 'icon_image_id' => $this->icon_image_id,
91 - 'icon_image_url' => $this->icon_image_url,
92 - // 'icon_image_alt' => $this->icon_image_alt,
93 - 'icon_image_size' => $this->icon_image_size,
94 - 'color' => $this->color,
95 - 'displayMobile' => $this->displayMobile,
96 - 'displayDesktop' => $this->displayDesktop,
97 - );
98 -
99 - return $options;
100 58 }
101 59
102 - public function get_all_defaults()
103 - {
104 - return $this->default_options;
105 - }
106 -
107 - public function load_settings($settings)
108 - {
109 - if (! $settings)
110 - return;
111 - foreach($settings as $setting => $value)
112 - {
113 - if (is_null($value) || strlen($value) == 0)
114 - continue;
115 -
116 - switch($setting)
117 - {
118 - case 'active':
119 - $this->is_active = ($value == 1) ? true : false;
120 - break;
121 - case 'popup':
122 - $this->is_popup = ($value == 1) ? true : false;
123 - break;
124 - case 'popup_width':
125 - $this->popup_dimensions[0] = $value;
126 - break;
127 - case 'popup_height':
128 - $this->popup_dimensions[1] = $value;
129 - break;
130 - default:
131 - $this->{$setting} = $value;
132 - break;
133 - }
134 - }
135 - }
136 -
137 -
138 60 public function forMobile()
139 61 {
140 62 return $this->displayMobile;
141 63 }
@@ -144,13 +66,8 @@
144 66 {
145 67 return $this->displayDesktop;
146 68 }
147 69
148 - /** If current running setting of network should display count
149 - *
150 - * Even if network supports displaying a counter, this should not be the case when showing the 'profile'
151 - * @return boolean
152 - */
153 70 public function isCountable()
154 71 {
155 72 $use_profile = MBSocial()->whistle()->ask('editor/profile/use');
156 73 if ($use_profile == 1)
@@ -183,9 +100,9 @@
183 100 $use_profile = MBSocial()->whistle()->ask('editor/profile/use');
184 101 if ($use_profile == 1)
185 102 return false;
186 103 else {
187 - return $this->is_popup;
104 + return $this->popup;
188 105 }
189 106 }
190 107
191 108 /** Return the label for this network and use **/
@@ -235,8 +152,10 @@
235 152 return $this->share_url;
236 153 }
237 154
238 155 }
156 +
157 +
239 158 }
240 159
241 160 /* Network dependent creating of a button. Called from collection class */
242 161 public function createButton($args = array())