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