Function
function Socialise($service, $link, $title = "") {
switch ($service) {
case "twitter":
return "https://twitter.com/intent/tweet?original_referer=$link&text=".$title."&url=$link";
case "facebook":
return "http://www.facebook.com/share.php?u=$link";
case "google+":
return "https://plusone.google.com/_/+1/confirm?hl=en&url=$link&title=$title";
case "digg":
return "http://digg.com/submit?url=$link&title=$title";
case "delicious":
return "http://del.icio.us/post?url=$link&title=$title";
}
}
Usage
// Outputs https://twitter.com/intent/tweet?original_referer=http://my-website.co.uk&text=Google Search&url=http://google.co.uk
$twitter_share = Socialise("twitter", "http://google.co.uk", "Google Search");
//Note: You may want to add urlencode to the function somewhere to make the URL safe