Gabrielchihonglee has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402607 )
Change subject: Convert AddThis to use extension registration ...................................................................... Convert AddThis to use extension registration Updating the extension to match with latest extension registration guidelines. Bug: T184358 Change-Id: I12a9e2bec1afd350dd0d531a8cd60b5b21c04e43 --- M AddThis.php A extension.json 2 files changed, 117 insertions(+), 209 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AddThis refs/changes/07/402607/1 diff --git a/AddThis.php b/AddThis.php index a640066..f7692e8 100644 --- a/AddThis.php +++ b/AddThis.php @@ -1,212 +1,14 @@ <?php -/** - * MediaWiki extension to add AddThis widget in a portlet in the sidebar and page header. - * Installation instructions can be found on - * https://www.mediawiki.org/wiki/Extension:AddThis - * - * @addtogroup Extensions - * @author Gregory Varnum, significant contributions by Johnduhart - * @license GPL - * - * Loosely based on the Google Translator extension by Joachim De Schrijver - * Thank you to Johnduhart, Roan Kattouw, Unikum111, catrope, Nikerabbit, Reedy - * and folks at AddThis for feedback and cleaning up code - * Thank you to Raymond, Kghbln, Michawiki, Toliño, McDutchie, Bjankuloski06, - * SPQRobin, Veeven, Gucci Mane Burrr, Kaajawa, Purodha, Kwj2772, Unikum111, - * Y-M D, Xuacu, Naudefj, Gomoko, Anakmalaysia, פוילישער, Shizhao, and others - * mentioned i18n/*.json for translation work. - */ - -/** - * Exit if called outside of MediaWiki - */ -if ( !defined( 'MEDIAWIKI' ) ) { - echo "This file is an extension to the MediaWiki software and cannot be used standalone.\n"; - die( 1 ); +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'AddThis' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['CookieWarning'] = __DIR__ . '/i18n'; + /* wfWarn( + 'Deprecated PHP entry point used for CookieWarning extension. Please use wfLoadExtension' . + 'instead, see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); */ + return true; +} else { + die( 'This version of the AddThis extension requires MediaWiki 1.23+' ); } -/** - * SETTINGS - * -------- - * The following variables may be reset in your LocalSettings.php file. - * - * $wgAddThispubid - * - AddThis Profile ID - more info: http://www.addthis.com/help/profiles - * $wgAddThisBackground - * - Background color for AddThis toolbox displayed in article header - * Default is #f6f6f6 - * $wgAddThisBorder - * - Border color for AddThis toolbox displayed in article header - * Default is #a7d7f9 - * $wgAddThisSidebar - * - Display AddThis widget as sidebar portlet - * Default is true - * $wgAddThisHeader - * - Display AddThis widget in article headers - * Default is true - * $wgAddThisMain - * - Display AddThis widget on main page - * Default is true - * $wgAddThis['addressbarsharing'] - * - Enable AddThis Address Bar Sharing - * http://www.addthis.com/help/address-bar-sharing-analytics - * Default is false - * $wgAddThisSBServ[0]['service'] - * - Service code for 1st button in sidebar - * Service codes: http://www.addthis.com/services/list - * Default is compact - AddThis icon used to access full AddThis popup menu - * $wgAddThisSBServ[0]['attribs'] - * - Settings for 1st button in sidebar - * More info: http://www.addthis.com/help/client-api#attribute-config - * $wgAddThisSBServ[1]['service'] - * - Service code for 2nd button in sidebar - * Default is facebook - * $wgAddThisSBServ[1]['attribs'] - * - Settings for 2nd button in sidebar - * $wgAddThisSBServ[2]['service'] - * - Service code for 3rd button in sidebar - * Default is twitter - * $wgAddThisSBServ[2]['attribs'] - * - Settings for 3rd button in sidebar - * $wgAddThisSBServ[3]['service'] - * - Service code for 4th button in sidebar - * Default is google_plusone - * $wgAddThisSBServ[3]['attribs'] - * - Settings for 4th button in sidebar - * Default is g:plusone:count="false" style="margin-top:1px;" - * $wgAddThisSBServ[4]['service'] - * - Service code for 5th button in sidebar - * Default is email - * $wgAddThisSBServ[4]['attribs'] - * - Settings for 5th button in sidebar - * $wgAddThisHServ[0]['service'] - * - Service code for 1st button in article header after AddThis icon - * (which cannot be moved in the header) - * Default is facebook - * $wgAddThisHServ[0]['attribs'] - * - Settings for 1st button in article header - * $wgAddThisHServ[1]['service'] - * - Service code for 2nd button in article header - * Default is twitter - * $wgAddThisHServ[1]['attribs'] - * - Settings for 2nd button in article header - * $wgAddThisHServ[2]['service'] - * - Service code for 3rd button in article header - * Default is google_plusone - * $wgAddThisHServ[2]['attribs'] - * - Settings for 3rd button in article header - * Default is g:plusone:count="false" style="margin-top:1px;" - * $wgAddThisHServ[3]['service'] - * - Service code for 4th button in article header - * Default is linkedin - * $wgAddThisHServ[3]['attribs'] - * - Settings for 4th button in article header - * $wgAddThisHServ[4]['service'] - * - Service code for 5th button in article header - * Default is tumblr - * $wgAddThisHServ[4]['attribs'] - * - Settings for 5th button in article header - * $wgAddThisHServ[5]['service'] - * - Service code for 6th button in article header - * Default is stumbleupon - * $wgAddThisHServ[5]['attribs'] - * - Settings for 6th button in article header - * $wgAddThisHServ[6]['service'] - * - Service code for 7th button in article header - * Default is reddit - * $wgAddThisHServ[6]['attribs'] - * - Settings for 7th button in article header - * $wgAddThisHServ[7]['service'] - * - Service code for 8th button in article header - * Default is email - * $wgAddThisHServ[7]['attribs'] - * - Settings for 8th button in article header - */ - -$wgAddThispubid = ''; - -# Default values for most options -$wgAddThisBackground = '#f6f6f6'; -$wgAddThisBorder = '#a7d7f9'; -$wgAddThisSidebar = true; -$wgAddThisHeader = true; -$wgAddThisMain = true; -$wgAddThis = [ - 'addressbarsharing' => false, -]; - -# Sidebar settings -$wgAddThisSBServ = [ - [ - 'service' => 'compact', - ], - [ - 'service' => 'facebook', - ], - [ - 'service' => 'twitter', - ], - [ - 'service' => 'google_plusone', - 'attribs' => 'g:plusone:count="false" style="margin-top:1px;"', - ], - [ - 'service' => 'email', - ], -]; - -# Toolbar settings -$wgAddThisHServ = [ - [ - 'service' => 'facebook', - ], - [ - 'service' => 'twitter', - ], - [ - 'service' => 'google_plusone', - 'attribs' => 'g:plusone:count="false" style="margin-top:1px;"', - ], - [ - 'service' => 'linkedin', - ], - [ - 'service' => 'tumblr', - ], - [ - 'service' => 'stumbleupon', - ], - [ - 'service' => 'reddit', - ], - [ - 'service' => 'email', - ], -]; - -$wgExtensionCredits['other'][] = [ - 'path' => __FILE__, - 'name' => 'AddThis', - 'version' => '1.1.1', - 'author' => [ - '[https://www.mediawiki.org/wiki/User:Varnent Gregory Varnum]', - '[https://www.mediawiki.org/wiki/User:Johnduhart John Du Hart]', - '...' - ], - 'descriptionmsg' => 'addthis-desc', - 'url' => 'https://www.mediawiki.org/wiki/Extension:AddThis', - 'license-name' => 'GPL-2.0-only' -]; - -$wgAutoloadClasses['AddThis'] = __DIR__ . '/AddThis.body.php'; -$wgMessagesDirs['AddThis'] = __DIR__ . '/i18n'; - -$wgResourceModules['ext.addThis'] = [ - 'styles' => 'addThis.css', - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'AddThis', -]; - -$wgHooks['ArticleViewHeader'][] = 'AddThis::AddThisHeader'; -$wgHooks['ParserFirstCallInit'][] = 'AddThis::AddThisHeaderTag'; -$wgHooks['SkinBuildSidebar'][] = 'AddThis::AddThisSidebar'; diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..6310e3d --- /dev/null +++ b/extension.json @@ -0,0 +1,106 @@ +{ + "name": "AddThis", + "version": "1.1.1", + "author": "[https://www.mediawiki.org/wiki/User:Varnent Gregory Varnum] (Contributions by [https://www.mediawiki.org/wiki/User:Johnduhart John Du Hart])", + "url": "https://www.mediawiki.org/wiki/Extension:AddThis", + "descriptionmsg": "addthis-desc", + "type": "other", + "MessagesDirs": { + "AddThis": [ + "i18n" + ] + }, + "AutoloadClasses": { + "AddThis": "AddThis.body.php" + }, + "ResourceModules": { + "ext.addThis": { + "styles": "addThis.css" + } + }, + "ResourceFileModulePaths": { + "localBasePath": "", + "remoteExtPath": "AddThis" + }, + "Hooks": { + "ArticleViewHeader": "AddThis::AddThisHeader", + "ParserFirstCallInit": "AddThis::AddThisHeaderTag", + "SkinBuildSidebar": "AddThis::AddThisSidebar" + }, + "config": { + "AddThispubid": { + "value": "" + }, + "AddThisBackground": { + "value": "#f6f6f6" + }, + "AddThisBorder": { + "value": "#a7d7f9" + }, + "AddThisSidebar": { + "value": true + }, + "AddThisHeader": { + "value": true + }, + "AddThisMain": { + "value": true + }, + "AddThis": { + "value": { + "addressbarsharing": false + } + }, + "AddThisSBServ": { + "value": [ + { + "service": "compact" + }, + { + "service": "facebook" + }, + { + "service": "twitter" + }, + { + "service": "google_plusone", + "attribs": "g:plusone:count=\"false\" style=\"margin-top:1px;\"" + }, + { + "service": "email" + } + ] + }, + "AddThisHServ": { + "value": [ + { + "service": "facebook" + }, + { + "service": "twitter" + }, + { + "service": "google_plusone", + "attribs": "g:plusone:count=\"false\" style=\"margin-top:1px;\"" + }, + { + "service": "linkedin" + }, + { + "service": "tumblr" + }, + { + "service": "stumbleupon" + }, + { + "service": "reddit" + }, + { + "service": "email" + } + ] + } + }, + "manifest_version": 2 +} + -- To view, visit https://gerrit.wikimedia.org/r/402607 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12a9e2bec1afd350dd0d531a8cd60b5b21c04e43 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AddThis Gerrit-Branch: master Gerrit-Owner: Gabrielchihonglee <chihonglee...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits