public function new_service($label, $url, $icon)
{
// Validate
$label = trim(wp_html_excerpt(wp_kses($label, array()), 30));
$url = trim(esc_url_raw($url));
$icon = trim(esc_url_raw($icon));
if ($label && $url && $icon) {
$options = get_option('sharing-options');
if (!is_array($options)) {
$options = array();
}
$service_id = 'custom-' . time();
// Add a new custom service
$options['global']['custom'][] = $service_id;
if (false !== $this->global) {
$this->global['custom'][] = $service_id;
}
update_option('sharing-options', $options);
// Create a custom service and set the options for it
$service = new Share_Custom($service_id, array('name' => $label, 'url' => $url, 'icon' => $icon));
$this->set_service($service_id, $service);
// Return the service
return $service;
}
return false;
}