1. 程式人生 > >share buttons(google+,facebook,twitter,pinterest,linkedin)

share buttons(google+,facebook,twitter,pinterest,linkedin)

	$url = site_url() . $_SERVER["REQUEST_URI"];
	$save_url = urlencode($url);
	//https://developers.google.com/+/
	//https://developers.facebook.com/docs/web/
	//https://dev.twitter.com/docs/tweet-button
	//http://business.pinterest.com/widget-builder/#do_pin_it_button
	//http://developer.linkedin.com/publishers
	echo <<<EDO
<!-- google + -->
<div class="share_buttons">
	<div class="share_button google_share_button">
		<script type="text/javascript">
		(function() {
			var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
			po.src = 'https://apis.google.com/js/plusone.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
			window.___gcfg = {
			lang: 'es'
		})();
		</script>
		<g:plusone size="medium" href="{$url}"></g:plusone>
	</div>
<!-- google + end -->

<!-- facebook -->
	<div class="share_button facebook_share_button">
		<div id="fb-root"></div>
		<script>(function(d, s, id) {
		var js, fjs = d.getElementsByTagName(s)[0];
		if (d.getElementById(id)) return;
		js = d.createElement(s); js.id = id;
		js.src = "//connect.facebook.net/zh_CN/all.js#xfbml=1";
		fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));</script>

		<div class="fb-like" data-href="{$url}" data-send="false" data-layout="button_count" data-width="300" data-show-faces="false" data-action="recommend"></div>
	</div>
<!-- facebook end -->

<!-- twitter -->
	<div class="share_button twitter_share_button">
		<a href="https://twitter.com/share" class="twitter-share-button" url="{$url}" data-lang="es">Tweet</a>

		<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
	</div>
<!-- twitter end -->

<!-- pinterest -->
	<div class="share_button pinterest_share_button">
		<script type="text/javascript">
		(function(d){
		var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
		p.type = 'text/javascript';
		p.async = true;
		p.src = '//assets.pinterest.com/js/pinit.js';
		f.parentNode.insertBefore(p, f);
		}(document));
		</script>
		<a href="//pinterest.com/pin/create/button/?url={$save_url}&media=&description=Orientate" data-pin-do="buttonPin" data-pin-config="beside"><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a>
	</div>
<!-- pinterest end -->

<!-- linkedin -->
	<div class="share_button linkedin_share_button">
		<script src="//platform.linkedin.com/in.js" type="text/javascript">
		lang: es_ES
		</script>
		<script type="IN/Share" data-url="{$url}" data-counter="right"></script>
	</div>
<!-- linkedin end -->
</div>
EDO;