function form_fields() { $params = $this->defaults; $fields = array(array('type' => 'text', 'name' => 'title', 'desc' => __('Title:', APP_TD)), array('type' => 'checkbox', 'name' => 'use_tooltips', 'desc' => __('Use descriptions as tooltips (hides descriptions)', APP_TD))); $social_networks = APP_Social_Networks::get_support(); if (!empty($params['social_networks'])) { if (!$params['exclude_mode']) { $social_networks = $params['social_networks']; } else { $social_networks = array_diff($social_networks, $params['social_networks']); } } foreach ($social_networks as $network_id) { $fields[] = array('type' => 'checkbox', 'name' => "social_{$network_id}_inc", 'desc' => sprintf(__('Show %s button', APP_TD), APP_Social_Networks::get_title($network_id))); $fields[] = array('type' => 'text', 'name' => "social_{$network_id}_url", 'desc' => sprintf(__('%s URL', APP_TD), APP_Social_Networks::get_title($network_id))); $fields[] = array('type' => 'text', 'name' => "social_{$network_id}_desc", 'desc' => sprintf(__('%s Description', APP_TD), APP_Social_Networks::get_title($network_id))); } return $fields; }
} static function get_sanitize_method($type) { $settings = self::$networks[$type]; return $settings['sanitize']; } static function sanitize_default($username) { return sanitize_user($username, true); } static function get_support() { $networks = array_keys(self::$networks); return apply_filters('appthemes_social_networks', $networks); } } APP_Social_Networks::register_network('facebook', array('title' => __('Facebook', APP_TD))); APP_Social_Networks::register_network('twitter', array('title' => __('Twitter', APP_TD))); APP_Social_Networks::register_network('linkedin', array('title' => __('LinkedIn', APP_TD), 'user_url' => 'http://linkedin.com/in/%s/')); APP_Social_Networks::register_network('google-plus', array('title' => __('Google+', APP_TD), 'base_url' => 'http://plus.google.com/', 'user_url' => 'http://plus.google.com/%s/', 'sanitize' => 'appthemes_numbers_only', 'tip' => sprintf(__('Enter your Google+ ID here. The URL will look like this: %s where the number is your ID.', APP_TD), 'http://plus.google.com/108097040296611426034/'))); APP_Social_Networks::register_network('youtube', array('title' => __('YouTube', APP_TD), 'user_url' => 'http://youtube.com/user/%s/')); APP_Social_Networks::register_network('instagram', array('title' => __('Instagram', APP_TD))); APP_Social_Networks::register_network('pinterest', array('title' => __('Pinterest', APP_TD))); APP_Social_Networks::register_network('github', array('title' => __('Github', APP_TD))); APP_Social_Networks::register_network('path', array('title' => __('Path', APP_TD))); APP_Social_Networks::register_network('vimeo', array('title' => __('Vimeo', APP_TD))); APP_Social_Networks::register_network('flickr', array('title' => __('Flickr', APP_TD))); APP_Social_Networks::register_network('picassa', array('title' => __('Picassa', APP_TD))); APP_Social_Networks::register_network('foursquare', array('title' => __('Foursquare', APP_TD))); APP_Social_Networks::register_network('wordpress', array('title' => __('WordPress', APP_TD), 'user_url' => 'http://%s.wordpress.com/'));
foreach (APP_Social_Networks::get_support() as $network_id) { ?> <?php if (!empty($instance["social_{$network_id}_inc"]) && !empty($instance["social_{$network_id}_url"])) { ?> <li> <a <?php echo !empty($instance['use_tooltips']) && !empty($instance["social_{$network_id}_inc"]) && !empty($instance["social_{$network_id}_desc"]) ? 'data-tooltip ' . 'title="' . esc_attr($instance["social_{$network_id}_desc"]) . '"' : ''; ?> class="<?php echo esc_attr($network_id); ?> " href="<?php echo esc_url(APP_Social_Networks::get_url($network_id, $instance["social_{$network_id}_url"])); ?> " target="_blank"> <?php if (empty($instance['images_url'])) { ?> <i class="fi-social-<?php echo esc_attr($network_id); ?> "></i> <?php } else { ?>