GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing www.mediawiki.org — Extension:SNSButtonsInSidebar - MediaWiki
The SNSButtonsInSidebar adds SNS buttons in the sidebar on every page. Installation
Code
<?php /** * MediaWiki extension to add SNS buttons in the sidebar * Installation instructions can be found on * http://www.mediawiki.org/wiki/Extension:SNSButtonsInSidebar * * @ingroup Extensions * @author Jmkim dot com * @license GNU Public License */ // Exit if called outside of MediaWiki if( !defined( 'MEDIAWIKI' ) ) exit; // SETTINGS $wgSNSButtonsTitle = 'Recommendations'; $wgExtensionCredits['parserhook'][] = array( 'path' => __FILE__, 'name' => 'SNSButtonsInSidebar', 'version' => '1.0.0', 'author' => 'Jmkim dot com', 'description' => 'SNSButtonsInSidebar Extension', 'url' => 'https://www.mediawiki.org/wiki/Extension:SNSButtonsInSidebar' ); // Register class and localisations $dir = dirname(__FILE__) . '/'; $wgAutoloadClasses['SNSButtonsInSidebar'] = $dir.'SNSButtonsInSidebar.class.php'; // Hook to modify the sidebar $wgHooks['SkinBuildSidebar'][] = 'SNSButtonsInSidebar::renderSNSButtonsInSidebar';
<?php if (!defined('MEDIAWIKI')) exit; class SNSButtonsInSidebar { static function renderSNSButtonsInSidebar( $skin, &$bar ) { global $wgFacebookCommonScriptWritten, $wgFacebookAppId; $btnsText = ''; if( !isset($wgFacebookCommonScriptWritten) || !$wgFacebookCommonScriptWritten ) { if( !isset($wgFacebookAppId) ) $wgFacebookAppId = ''; $wgFacebookCommonScriptWritten = true; $btnsText .= '<div id="fb-root">'; $btnsText .= '</div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1&appId='.$wgFacebookAppId.'"></script>'; } $btnsText .= '<script type="text/javascript">'; $btnsText .= '(function() {'; $btnsText .= "var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;"; $btnsText .= "po.src = 'https://apis.google.com/js/plusone.js';"; $btnsText .= "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);"; $btnsText .= '})();'; $btnsText .= '</script>'; global $wgServer; $btnsText .= '<div class="fb-like" data-href="'.$wgServer.'"'; $btnsText .= ' data-send="false" data-layout="button_count"'; $btnsText .= ' data-width="130" data-show-faces="false"'; $btnsText .= ' data-action="like" data-colorscheme="light"'; $btnsText .= '></div>'; $btnsText .= '<div style="height:5px"></div>'; $btnsText .= '<div class="g-plusone" data-width="130" data-href="'.$wgServer.'"></div>'; global $wgSNSButtonsTitle; $bar[$wgSNSButtonsTitle] = $btnsText; return true; } } See also | ||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||||||||||