Revision: 17218
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 27, 2009 13:23 by brettbergeron
Initial Code
<?php # # URL Sharing Helper # if ( ! function_exists('share' )) { function share($media, $title = '' ) { $encoded_url = urlencode('http://yourdomain.com'); $encoded_title = urlencode($title); if ( $media == 'twitter' ) return "http://twitter.com/home?status=$encoded_url"; if ( $media == 'technorati' ) return "http://technorati.com/faves/?add=$encoded_url"; if ( $media == 'stumbleupon' ) return "http://www.stumbleupon.com/submit?url=$encoded_url&title=$encoded_title"; if ( $media == 'reddit' ) return "http://reddit.com/submit?url=$encoded_url&title=$encoded_title"; if ( $media == 'myspace' ) return "http://www.myspace.com/Modules/PostTo/Pages/?u=$encoded_url&t=$encoded_title&c=%20"; if ( $media == 'magnolia' ) return "http://ma.gnolia.com/bookmarklet/add?url=$encoded_url&title=$encoded_title"; if ( $media == 'google' ) return "http://www.google.com/bookmarks/mark?op=add&bkmk=$encoded_url&title=$encoded_title"; if ( $media == 'linkedin' ) return "http://www.linkedin.com/shareArticle?mini=true&url=$encoded_url&title=$encoded_title&ro=false&summary=&source="; if ( $media == 'furl' ) return "http://www.furl.net/savedialog.jsp?p=1&u=$encoded_url&t=$encoded_title&r=&v=1&c="; if ( $media == 'facebook' ) return "http://www.facebook.com/sharer.php?u=$encoded_url&t=$encoded_title"; if ( $media == 'friendfeed' ) return "http://friendfeed.com/share?url=$encoded_url&title=$encoded_title"; if ( $media == 'bebo' ) return "http://bebo.com/c/share?Url=$encoded_url&Title=$encoded_title"; if ( $media == 'delicious' ) return "http://del.icio.us/post?v=4&partner=[partner]&noui&url=$encoded_url&title=$encoded_title"; } }
Initial URL
http://brettbergeron.com
Initial Description
This is a quick & dirty helper for pumping out those annoying little link sharing URLS. I've kept it simple, so all it does is return a URL formatted for a particular service. To use it, just pass a string of the service name to the helper followed by the title. This could definitely be taken to the next level by adding a parameter for the URL, but my needs were incompatible with such a feature.
Initial Title
URL Sharing Helper
Initial Tags
php, twitter, facebook
Initial Language
PHP