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-admin.php +9 -134 1.41.1.2 View file →
@@ -56,8 +56,9 @@
56 56 {
57 57 $fields = apply_filters('mbsocial/display_fields', $this->fields);
58 58 $output = '';
59 59
60 +
60 61 foreach($fields as $id => $item)
61 62 {
62 63 $field = $item['field'];
63 64 $output .= $field->output($item['start'], $item['end']);
@@ -100,8 +101,9 @@
100 101 {
101 102 $active_networks = array();
102 103 }
103 104 $networks = mbSocial()->networks()->get();
105 +
104 106 $selected = array();
105 107 $unselected = array();
106 108 $readmore = array();
107 109
@@ -108,19 +110,14 @@
108 110 // set active networks. Support doubles.
109 111 foreach($active_networks as $index => $network_name)
110 112 {
111 113 $network = mbSocial()->networks()->get($network_name);
112 - if (! is_object($network)) // could be removed network.
113 - continue;
114 - if ($network->get('is_active'))
115 - $selected[$index] = $network;
114 + $selected[$index] = $network;
116 115 }
117 116
118 117 foreach($networks as $index => $network)
119 118 {
120 119 $priority = $network->get('priority');
121 - if (! $network->get('is_active'))
122 - { continue; }
123 120 $is_active = array_search($network->get('network'), $active_networks); // retrieve the array index
124 121
125 122 if ($is_active !== false)
126 123 {
@@ -126,8 +123,14 @@
126 123 {
127 124 $priority = 'selected';
128 125 }
129 126
127 + /* if ($priority == 'selected')
128 + {
129 + continue; // ignore active, since it's set earlier.
130 + //$selected[$is_active] = $network;
131 +
132 + } */
130 133 if ($priority == 'unselected')
131 134 $unselected[] = $network;
132 135 if ($priority == 'readmore')
133 136 $readmore[] = $network;
@@ -155,57 +158,8 @@
155 158 $networks_array = $this->get_default_networks($active_networks);
156 159 return $networks_array;
157 160 }
158 161
159 - // render icons with input from different icon libraries (/future)
160 - public function renderIcon($args)
161 - {
162 - $defaults = array('icon' => '',
163 - 'icon_type' => '',
164 - 'icon_size' => 20,
165 - 'title' => '',
166 - );
167 -
168 - $args = wp_parse_args($args, $defaults);
169 -
170 - $icon_type = $args['icon_type'];
171 - $icon = $args['icon'];
172 - $icon_size = $args['icon_size'];
173 - $title = $args['title'];
174 -
175 - $faUtils = FAUtils::getInstance();
176 -
177 - switch($icon_type)
178 - {
179 - case 'fa': // FA5
180 - case 'fab':
181 - case 'fas':
182 - case 'far':
183 - $args = array('icon' => trim($icon_type) . ' ' . trim($icon), 'title' => $title);
184 - if ($icon_size)
185 - {
186 - $args['size'] = $icon_size;
187 - }
188 -
189 - $svg = $faUtils->getFASVG($args);
190 - $output = "<span class='mb-icon'>$svg</span>";
191 - break;
192 - case 'nucleo':
193 - $output = "<span class='mb-icon'><i class='$icon_type $icon' title='$title' > </i></span>";
194 - break;
195 - case 'svg':
196 - case 'png':
197 - $output = "<span class='mb-icon " . $icon_type . "'><img src='" . $icon . "' alt='" . $title . "'></span>";
198 - break;
199 -
200 - default:
201 - $output = '';
202 - break;
203 - }
204 -
205 - return apply_filters('display/render/icon', $output, $args);
206 - }
207 -
208 162 public function header( $args = array() )
209 163 {
210 164 $defaults = array(
211 165 'title' => '',
@@ -228,85 +182,6 @@
228 182 <a href="https://maxbuttons.com" target="_blank">', '</a>') );
229 183 }
230 184
231 185
232 - public function do_review_notice () {
233 -
234 - $current_user_id = get_current_user_id();
235 - $version = MBSOCIAL_VERSION_NUM;
236 -
237 - $review = get_user_meta( $current_user_id, 'mbsocial_review_notice' , true );
238 -
239 - if ($review == '')
240 - {
241 - //$created = get_option("MBFREE_CREATED");
242 - $show = time() + (7* DAY_IN_SECONDS);
243 - update_user_meta($current_user_id, 'mbsocial_review_notice', $show);
244 - return;
245 - }
246 -
247 - $display_review = false;
248 -
249 - if ($review == 'off')
250 - { return; // no show
251 -
252 - }
253 - elseif (is_numeric($review))
254 - {
255 - $now = time();
256 -
257 - if ($now > $review)
258 - {
259 - $display_review = true;
260 -
261 - }
262 - }
263 -
264 - // load style / script. It's seperated since it should show everywhere in admin.
265 - if ($display_review)
266 - {
267 - add_action( 'admin_notices', array( $this, 'mbsocial_review_notice'));
268 - // registered in admin scripts
269 - if (method_exists(MB(), 'load_library'))
270 - MB()->load_library('review_notice');
271 - }
272 -
273 - }
274 -
275 - public function mbsocial_review_notice()
276 - {
277 - include_once( mbSocial()->get_plugin_path() . '/admin/review_notice.php');
278 - }
279 -
280 - public function save_review_notice()
281 - {
282 - $status = isset($_POST["status"]) ? sanitize_text_field($_POST["status"]) : '';
283 - $current_user_id = get_current_user_id();
284 -
285 - $updated = false;
286 -
287 - if ($status == 'off')
288 - {
289 - $updated = true;
290 - update_user_meta($current_user_id, 'mbsocial_review_notice', 'off');
291 -
292 - }
293 - if ($status == 'later')
294 - {
295 - $updated = true;
296 - $later = time() + (14 * DAY_IN_SECONDS );
297 -
298 - update_user_meta($current_user_id, 'mbsocial_review_notice', $later);
299 - }
300 - if ($status == 'reviewoffer-dismiss') // different ad!
301 - {
302 - $updated = true;
303 - update_user_meta($current_user_id, 'mbsocial_review_notice', 'off');
304 -
305 - }
306 -
307 - echo json_encode(array("updated" => $updated)) ;
308 -
309 - exit();
310 - }
311 186
312 187 }