Index: trunk/extensions/AddThis/AddThis.body.php |
— | — | @@ -0,0 +1,109 @@ |
| 2 | +<?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
| 4 | +/** |
| 5 | + * Class file for the AddThis extension |
| 6 | + * |
| 7 | + * @addtogroup Extensions |
| 8 | + * @license GPL |
| 9 | + */ |
| 10 | +class AddThis { |
| 11 | + |
| 12 | +/** |
| 13 | + * Parser hook for the <addthis /> tag extension. |
| 14 | + * |
| 15 | + */ |
| 16 | + public static function parserHook( $parser ) { |
| 17 | + global $wgOut, $wgAddThispubid, $wgAddThisHeader, $wgAddThisHServ1, $wgAddThisHServ1set, $wgAddThisHServ2, $wgAddThisHServ2set, $wgAddThisHServ3, $wgAddThisHServ3set, $wgAddThisHServ4, $wgAddThisHServ4set, |
| 18 | + $wgAddThisHServ5, $wgAddThisHServ5set, $wgAddThisHServ6, $wgAddThisHServ6set, $wgAddThisHServ7, $wgAddThisHServ7set, $wgAddThisHServ8, $wgAddThisHServ8set, $wgAddThisBackground, $wgAddThisBorder; |
| 19 | + # Localisation for "Share" |
| 20 | + $share = wfMsg( 'addthis' ); |
| 21 | + # Output AddThis widget |
| 22 | + $output .='<!-- AddThis Button BEGIN --> |
| 23 | + <div class="addthis_toolbox addthis_default_style" id="addthistoolbar" style="background:'.$wgAddThisBackground.'; border-color:'.$wgAddThisBorder.';"> |
| 24 | + <a href="http://www.addthis.com/bookmark.php?v=250&pubid=ra-4eb75def4ec6488b" class="addthis_button_compact"> ' . $share . '</a><span class="addthis_separator"> </span> |
| 25 | + <a class="addthis_button_'.$wgAddThisHServ1.'" '.$wgAddThisHServ1set.'></a> |
| 26 | + <a class="addthis_button_'.$wgAddThisHServ2.'" '.$wgAddThisHServ2set.'></a> |
| 27 | + <a class="addthis_button_'.$wgAddThisHServ3.'" '.$wgAddThisHServ3set.'></a> |
| 28 | + <a class="addthis_button_'.$wgAddThisHServ4.'" '.$wgAddThisHServ4set.'></a> |
| 29 | + <a class="addthis_button_'.$wgAddThisHServ5.'" '.$wgAddThisHServ5set.'></a> |
| 30 | + <a class="addthis_button_'.$wgAddThisHServ6.'" '.$wgAddThisHServ6set.'></a> |
| 31 | + <a class="addthis_button_'.$wgAddThisHServ7.'" '.$wgAddThisHServ7set.'></a> |
| 32 | + <a class="addthis_button_'.$wgAddThisHServ8.'" '.$wgAddThisHServ8set.'></a> |
| 33 | + </div> |
| 34 | + <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$wgAddThispubid.'"></script> |
| 35 | + <!-- AddThis Button END -->'; |
| 36 | + return $output; |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | +/** |
| 41 | + * Function for sidebar portlet |
| 42 | + * |
| 43 | + */ |
| 44 | + static function AddThisSidebar( $skin, &$bar ) { |
| 45 | + global $wgOut, $wgAddThispubid, $wgAddThisSidebar, $wgAddThisSBServ1, $wgAddThisSBServ2, $wgAddThisSBServ3, $wgAddThisSBServ4, $wgAddThisSBServ5, $wgAddThisSBServ1set, $wgAddThisSBServ2set, |
| 46 | + $wgAddThisSBServ3set, $wgAddThisSBServ4set, $wgScriptPath, $wgAddThisSBServ5set; |
| 47 | + # Load css stylesheet |
| 48 | + $wgOut->addModuleStyles( 'ext.addThis' ); |
| 49 | + # Check setting to enable/disable sidebar portlet |
| 50 | + if(strtolower($wgAddThisSidebar) == 'true') { |
| 51 | + # Output AddThis widget |
| 52 | + $bar['addthis'] = '<!-- AddThis Button BEGIN --> |
| 53 | + <div class="addthis_toolbox addthis_default_style" id="addthissidebar"> |
| 54 | + <a class="addthis_button_'.$wgAddThisSBServ1.'" '.$wgAddThisSBServ1set.'></a> |
| 55 | + <a class="addthis_button_'.$wgAddThisSBServ2.'" '.$wgAddThisSBServ2set.'></a> |
| 56 | + <a class="addthis_button_'.$wgAddThisSBServ3.'" '.$wgAddThisSBServ3set.'></a> |
| 57 | + <a class="addthis_button_'.$wgAddThisSBServ4.'" '.$wgAddThisSBServ4set.'></a> |
| 58 | + <a class="addthis_button_'.$wgAddThisSBServ5.'" '.$wgAddThisSBServ5set.'></a> |
| 59 | + </div> |
| 60 | + <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$wgAddThispubid.'"></script> |
| 61 | + <!-- AddThis Button END -->'; |
| 62 | + return $bar; |
| 63 | + } |
| 64 | + return true; |
| 65 | + } |
| 66 | + |
| 67 | + |
| 68 | +/** |
| 69 | + * Function for article header toolbar |
| 70 | + * |
| 71 | + */ |
| 72 | + public static function AddThisHeader( &$article, &$outputDone, &$pcache ) { |
| 73 | + global $wgOut, $wgAddThispubid, $wgAddThisHeader, $wgAddThisMain, $wgAddThisMainpage, $wgRequest, $wgAddThisHServ1, $wgAddThisHServ1set, $wgAddThisHServ2, $wgAddThisHServ2set, $wgAddThisHServ3, |
| 74 | + $wgAddThisHServ3set, $wgAddThisHServ4, $wgAddThisHServ4set, $wgAddThisHServ5, $wgAddThisHServ5set, $wgAddThisHServ6, $wgAddThisHServ6set, $wgAddThisHServ7, $wgAddThisHServ7set, $wgAddThisHServ8, |
| 75 | + $wgAddThisHServ8set, $wgAddThisBackground, $wgAddThisBorder; |
| 76 | + # Localisation for "Share" |
| 77 | + $share = wfMsg( 'addthis' ); |
| 78 | + # Check if page is in main namespace |
| 79 | + $title = $article->getTitle(); |
| 80 | + # Check setting to enable/disable article header tooblar |
| 81 | + if(strtolower($wgAddThisHeader) == 'true') { |
| 82 | + # Check if article is mainpage set by [[MediaWiki:Mainpage]] |
| 83 | + if ($wgRequest->getText( 'title' )==str_replace( ' ', '_', wfMsg( 'mainpage' ) ) ) { |
| 84 | + # Check setting to enable/disable article header toolbar on mainpage |
| 85 | + if(strtolower($wgAddThisMain) == 'false') { |
| 86 | + return true; |
| 87 | + } |
| 88 | + } |
| 89 | + # Check if page is in content namespace |
| 90 | + if ( MWNamespace::isContent( $title->getNamespace() ) ) { |
| 91 | + # Output AddThis widget |
| 92 | + $wgOut->addHTML('<!-- AddThis Button BEGIN --> |
| 93 | + <div class="addthis_toolbox addthis_default_style" id="addthisheader" style="background:'.$wgAddThisBackground.'; border-color:'.$wgAddThisBorder.';"> |
| 94 | + <a href="http://www.addthis.com/bookmark.php?v=250&pubid=ra-4eb75def4ec6488b" class="addthis_button_compact"> ' . $share . '</a><span class="addthis_separator"> </span> |
| 95 | + <a class="addthis_button_'.$wgAddThisHServ1.'" '.$wgAddThisHServ1set.'></a> |
| 96 | + <a class="addthis_button_'.$wgAddThisHServ2.'" '.$wgAddThisHServ2set.'></a> |
| 97 | + <a class="addthis_button_'.$wgAddThisHServ3.'" '.$wgAddThisHServ3set.'></a> |
| 98 | + <a class="addthis_button_'.$wgAddThisHServ4.'" '.$wgAddThisHServ4set.'></a> |
| 99 | + <a class="addthis_button_'.$wgAddThisHServ5.'" '.$wgAddThisHServ5set.'></a> |
| 100 | + <a class="addthis_button_'.$wgAddThisHServ6.'" '.$wgAddThisHServ6set.'></a> |
| 101 | + <a class="addthis_button_'.$wgAddThisHServ7.'" '.$wgAddThisHServ7set.'></a> |
| 102 | + <a class="addthis_button_'.$wgAddThisHServ8.'" '.$wgAddThisHServ8set.'></a> |
| 103 | + </div> |
| 104 | + <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$wgAddThispubid.'"></script> |
| 105 | + <!-- AddThis Button END -->'); |
| 106 | + } |
| 107 | + } |
| 108 | + return true; |
| 109 | + } |
| 110 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/AddThis/AddThis.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 111 | + native |
Index: trunk/extensions/AddThis/AddThis.i18n.php |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for extension AddThis |
| 5 | + * |
| 6 | + * @addtogroup Extensions |
| 7 | + * @license GPL |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Gregory Varnum |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'addthis' => 'Share', |
| 17 | + 'addthis-desc' => 'Adds [http://www.addthis.com AddThis widget] to the sidebar and creates toolbar displayed on article header or by using <nowiki><addthis /></nowiki> tag.', |
| 18 | +); |
| 19 | + |
| 20 | +/** Russian (Русский) |
| 21 | + * @author Unikum111 |
| 22 | + */ |
| 23 | +$messages['ru'] = array ( |
| 24 | + 'addthis' => 'Поделиться', |
| 25 | + 'addthis-desc' => 'Добавляет [http://www.addthis.com кнопку AddThis] на боковую панель и в заголовок статьи.' |
| 26 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/AddThis/AddThis.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: trunk/extensions/AddThis/AddThis.php |
— | — | @@ -0,0 +1,201 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * MediaWiki extension to add AddThis widget in a portlet in the sidebar and page header. |
| 5 | + * Installation instructions can be found on |
| 6 | + * http://www.mediawiki.org/wiki/Extension:AddThis |
| 7 | + * |
| 8 | + * @addtogroup Extensions |
| 9 | + * @author Gregory Varnum |
| 10 | + * @license GPL |
| 11 | + * |
| 12 | + * Loosely based on the Google Translator extension by Joachim De Schrijver |
| 13 | + */ |
| 14 | + |
| 15 | +/** |
| 16 | + * Exit if called outside of MediaWiki |
| 17 | + */ |
| 18 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 19 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 20 | + die( 1 ); |
| 21 | +} |
| 22 | + |
| 23 | + |
| 24 | +/** |
| 25 | + * SETTINGS |
| 26 | + * -------- |
| 27 | + * The following variables may be reset in your LocalSettings.php file. |
| 28 | + * |
| 29 | + * $wgAddThispubid |
| 30 | + * - AddThis Profile ID - more info: http://www.addthis.com/help/profiles |
| 31 | + * $wgAddThisBackground |
| 32 | + * - Background color for AddThis toolbox displayed in article header |
| 33 | + * Default is #f6f6f6 |
| 34 | + * $wgAddThisBorder |
| 35 | + * - Border color for AddThis toolbox displayed in article header |
| 36 | + * Default is #a7d7f9 |
| 37 | + * $wgAddThisSidebar |
| 38 | + * - Display AddThis widget as sidebar portlet |
| 39 | + * Default is true |
| 40 | + * $wgAddThisHeader |
| 41 | + * - Display AddThis widget in article headers |
| 42 | + * Default is true |
| 43 | + * $wgAddThisMain |
| 44 | + * - Display AddThis widget on main page |
| 45 | + * Default is true |
| 46 | + * $wgAddThisSBServ1 |
| 47 | + * - Service code for 1st button in sidebar - service codes: http://www.addthis.com/services/list |
| 48 | + * Default is compact - AddThis icon used to access full AddThis popup menu |
| 49 | + * $wgAddThisSBServ1set |
| 50 | + * - Settings for 1st button in sidebar - more info: http://www.addthis.com/help/client-api#attribute-config |
| 51 | + * $wgAddThisSBServ2 |
| 52 | + * - Service code for 2nd button in sidebar |
| 53 | + * Default is facebook |
| 54 | + * $wgAddThisSBServ2set |
| 55 | + * - Settings for 2nd button in sidebar |
| 56 | + * $wgAddThisSBServ3 |
| 57 | + * - Service code for 3rd button in sidebar |
| 58 | + * Default is twitter |
| 59 | + * $wgAddThisSBServ3set |
| 60 | + * - Settings for 3rd button in sidebar |
| 61 | + * $wgAddThisSBServ4 |
| 62 | + * - Service code for 4th button in sidebar |
| 63 | + * Default is google_plusone |
| 64 | + * $wgAddThisSBServ4set |
| 65 | + * - Settings for 4th button in sidebar |
| 66 | + * Default is g:plusone:count="false" style="margin-top:1px;" |
| 67 | + * $wgAddThisSBServ5 |
| 68 | + * - Service code for 5th button in sidebar |
| 69 | + * Default is email |
| 70 | + * $wgAddThisSBServ5set |
| 71 | + * - Settings for 5th button in sidebar |
| 72 | + * $wgAddThisHServ1 |
| 73 | + * - Service code for 1st button in article header after AddThis icon (which cannot be moved in the header) |
| 74 | + * Default is facebook |
| 75 | + * $wgAddThisHServ1set |
| 76 | + * - Settings for 1st button in article header |
| 77 | + * $wgAddThisHServ2 |
| 78 | + * - Service code for 2nd button in article header |
| 79 | + * Default is twitter |
| 80 | + * $wgAddThisHServ2set |
| 81 | + * - Settings for 2nd button in article header |
| 82 | + * $wgAddThisHServ3 |
| 83 | + * - Service code for 3rd button in article header |
| 84 | + * Default is google_plusone |
| 85 | + * $wgAddThisHServ3set |
| 86 | + * - Settings for 3rd button in article header |
| 87 | + * Default is g:plusone:count="false" style="margin-top:1px;" |
| 88 | + * $wgAddThisHServ4 |
| 89 | + * - Service code for 4th button in article header |
| 90 | + * Default is linkedin |
| 91 | + * $wgAddThisHServ4set |
| 92 | + * - Settings for 4th button in article header |
| 93 | + * $wgAddThisHServ5 |
| 94 | + * - Service code for 5th button in article header |
| 95 | + * Default is tumblr |
| 96 | + * $wgAddThisHServ5set |
| 97 | + * - Settings for 5th button in article header |
| 98 | + * $wgAddThisHServ6 |
| 99 | + * - Service code for 6th button in article header |
| 100 | + * Default is stumbleupon |
| 101 | + * $wgAddThisHServ6set |
| 102 | + * - Settings for 6th button in article header |
| 103 | + * $wgAddThisHServ7 |
| 104 | + * - Service code for 7th button in article header |
| 105 | + * Default is reddit |
| 106 | + * $wgAddThisHServ7set |
| 107 | + * - Settings for 7th button in article header |
| 108 | + * $wgAddThisHServ8 |
| 109 | + * - Service code for 8th button in article header |
| 110 | + * Default is email |
| 111 | + * $wgAddThisHServ8set |
| 112 | + * - Settings for 8th button in article header |
| 113 | + */ |
| 114 | + |
| 115 | +$wgAddThispubid = ''; |
| 116 | + |
| 117 | +# Default values for most options |
| 118 | +$wgAddThisBackground = '#f6f6f6'; |
| 119 | +$wgAddThisBorder = '#a7d7f9'; |
| 120 | +$wgAddThisSidebar = 'true'; |
| 121 | +$wgAddThisHeader = 'true'; |
| 122 | +$wgAddThisMain = 'true'; |
| 123 | + |
| 124 | +# Sidebar settings |
| 125 | +$wgAddThisSBServ1 = 'compact'; |
| 126 | +$wgAddThisSBServ1set = ''; |
| 127 | +$wgAddThisSBServ2 = 'facebook'; |
| 128 | +$wgAddThisSBServ2set = ''; |
| 129 | +$wgAddThisSBServ3 = 'twitter'; |
| 130 | +$wgAddThisSBServ3set = ''; |
| 131 | +$wgAddThisSBServ4 = 'google_plusone'; |
| 132 | +$wgAddThisSBServ4set = 'g:plusone:count="false" style="margin-top:1px;"'; |
| 133 | +$wgAddThisSBServ5 = 'email'; |
| 134 | +$wgAddThisSBServ5set = ''; |
| 135 | + |
| 136 | +# Toolbar settings |
| 137 | +$wgAddThisHServ1 = 'facebook'; |
| 138 | +$wgAddThisHServ1set = ''; |
| 139 | +$wgAddThisHServ2 = 'twitter'; |
| 140 | +$wgAddThisHServ2set = ''; |
| 141 | +$wgAddThisHServ3 = 'google_plusone'; |
| 142 | +$wgAddThisHServ3set = 'g:plusone:count="false" style="margin-top:1px;"'; |
| 143 | +$wgAddThisHServ4 = 'linkedin'; |
| 144 | +$wgAddThisHServ4set = ''; |
| 145 | +$wgAddThisHServ5 = 'tumblr'; |
| 146 | +$wgAddThisHServ5set = ''; |
| 147 | +$wgAddThisHServ6 = 'stumbleupon'; |
| 148 | +$wgAddThisHServ6set = ''; |
| 149 | +$wgAddThisHServ7 = 'reddit'; |
| 150 | +$wgAddThisHServ7set = ''; |
| 151 | +$wgAddThisHServ8 = 'email'; |
| 152 | +$wgAddThisHServ8set = ''; |
| 153 | + |
| 154 | + |
| 155 | +/** |
| 156 | + * Credits |
| 157 | + * |
| 158 | + */ |
| 159 | +$wgExtensionCredits['other'][] = array( |
| 160 | + 'name' => 'AddThis', |
| 161 | + 'version' => '1.0e', |
| 162 | + 'author' => '[http://en.wikipedia.org/wiki/User:Varnent Gregory Varnum]', |
| 163 | + 'description' => 'Adds [http://www.addthis.com AddThis button] to the sidebar and page header', |
| 164 | + 'descriptionmsg' => 'addthis-desc', |
| 165 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:AddThis', |
| 166 | +); |
| 167 | + |
| 168 | + |
| 169 | +/** |
| 170 | + * Register class and localisations |
| 171 | + * |
| 172 | + */ |
| 173 | +$dir = dirname(__FILE__) . '/'; |
| 174 | +$wgAutoloadClasses['AddThis'] = $dir . 'AddThis.body.php'; |
| 175 | +$wgExtensionMessagesFiles['AddThis'] = $dir . 'AddThis.i18n.php'; |
| 176 | + |
| 177 | + |
| 178 | +$wgResourceModules['ext.addThis'] = array( |
| 179 | + 'styles' => 'addThis.css', |
| 180 | + 'localBasePath' => dirname( __FILE__ ), |
| 181 | + 'remoteExtPath' => 'AddThis', |
| 182 | +); |
| 183 | + |
| 184 | + |
| 185 | +/** |
| 186 | + * Hooks |
| 187 | + * |
| 188 | + */ |
| 189 | +$wgHooks['ArticleViewHeader'][] = 'AddThis::AddThisHeader'; |
| 190 | +$wgHooks['ParserFirstCallInit'][] = 'addThisHeaderTag'; |
| 191 | +$wgHooks['SkinBuildSidebar'][] = 'AddThis::AddThisSidebar'; |
| 192 | + |
| 193 | + |
| 194 | +/** |
| 195 | + * Register parser hook |
| 196 | + * |
| 197 | + * @param $parser Parser |
| 198 | + */ |
| 199 | +function addThisHeaderTag( &$parser ) { |
| 200 | + $parser->setHook( 'addthis', 'AddThis::parserHook' ); |
| 201 | + return true; |
| 202 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/AddThis/AddThis.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 203 | + native |
Index: trunk/extensions/AddThis/addThis.css |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +/** |
| 3 | +* Stylesheet for AddThis extension. |
| 4 | +* |
| 5 | +* You may modify the CSS code on the MediaWiki:Common.css |
| 6 | +* page to adjust padding, alignment, etc. |
| 7 | +* |
| 8 | +* @addtogroup Extensions |
| 9 | +* @license GPL |
| 10 | +*/ |
| 11 | + |
| 12 | +.at15t_compact { |
| 13 | + margin-right: 0px !important; |
| 14 | +} |
| 15 | + |
| 16 | +.addthis_separator { |
| 17 | + border-right: 1px solid; |
| 18 | + margin-left:2px !important; |
| 19 | + margin-right:7px !important; |
| 20 | +} |
| 21 | + |
| 22 | +.addthis_button_compact { |
| 23 | + font-size:90%; |
| 24 | +} |
| 25 | + |
| 26 | +#addthistoolbar { |
| 27 | + float:right; |
| 28 | + padding:5px; |
| 29 | + padding-top:5px; |
| 30 | + margin-left:10px; |
| 31 | + margin-bottom:10px; |
| 32 | + border-style:solid; |
| 33 | + border-width:1px; |
| 34 | +} |
| 35 | + |
| 36 | +#addthisheader { |
| 37 | + float:right; |
| 38 | + padding:5px; |
| 39 | + padding-top:10px; |
| 40 | + margin-left:10px; |
| 41 | + margin-bottom:10px; |
| 42 | + border-style:solid; |
| 43 | + border-width:1px; |
| 44 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/AddThis/addThis.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |
Index: trunk/extensions/AddThis/RELEASE NOTES |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +For the latest release notes, please see: |
| 3 | +http://www.mediawiki.org/wiki/Extension:AddThis#Release_notes |
\ No newline at end of file |