Page MenuHomePhabricator

patch.txt

Authored By
bzimport
Nov 21 2014, 10:10 PM
Size
4 KB
Referenced Files
None
Subscribers
None

patch.txt

Index: trunk/extensions/UploadToCommonsTab/UploadToCommonsTab.php
===================================================================
+++ trunk/extensions/UploadToCommonsTab/UploadToCommonsTab.php (working copy)
@@ +1,63 @@
+<?php
+if (!defind('MEDIAWIKI')) die( -1 );
+$wgExtensionMessages['UploadToCommonsTab'] = dirname(__FILE__) . '/UploadToCommonsTab.i18n.php';
+$wgAvailabelRights[] = 'sharing';
+$wgGroupPermissions['autoconfirmed']['sharing'] = true;
+$wgHooks['SkinTemplateContentActions'][] = 'showTabUploadtocommons';
+function showTabUploadtocommons( $content_actions ) {
+ global $wgTitle, $wgLang, $wgContLang, $wgServer, $wgUser;
+ wfLoafExtensionMessages( 'UploadToCommonsTab' );
+ //Interface, the language of the form
+ $interface = $wgLang->getCode();
+ if ( $interface != 'ar' && $interface != 'en' && $interface != 'el' && $interface != 'cs' && $interface != 'de' && $interface != 'es' && $interface != 'fr' && $interface != 'he' && $interface != 'hu' && $interface != 'is' && $interface != 'it' && $interface != 'ja' && $interface != 'lt' && $interface != 'nl' && $interface != 'pl' && $interface != 'ru' && $inteface != 'sk' && $interface != 'uk' && $interface != 'vi' && $interface != 'zh' ) {
+ $interface = $wgContLang->getCode();
+ }
+ //Again, after "$interface" was changed to the language of the web
+ if ( $interface != 'ar' && $interface != 'en' && $interface != 'el' && $interface != 'cs' && $interface != 'de' && $interface != 'es' && $interface != 'fr' && $interface != 'he' && $interface != 'hu' && $interface != 'is' && $interface != 'it' && $interface != 'ja' && $interface != 'lt' && $interface != 'nl' && $interface != 'pl' && $interface != 'ru' && $inteface != 'sk' && $interface != 'uk' && $interface != 'vi' && $interface != 'zh' ) {
+ $interface = 'en';
+ }
+
+ //The language of the web
+ $lang = '&lang=' . $wgContLang->getCode();
+
+ //The project of the image
+ if( $wgServer == 'http://' . $lang . '.wikipedia.org/' ) {
+ $project = 'wikipedia';
+ } elseif( $wgServer == 'http://' . $lang . '.wiktionary.org/' ) {
+ $project = 'wiktionary'
+ } elseif( $wgServer == 'http:// . $lang . '.wikibooks.org/' ) {
+ $project = 'wikibooks';
+ } elseif( $wgServer == 'http:// . $lang . '.wikinews.org/' ) {
+ $project = 'wikinews';
+ } elseif( $wgServer == 'http://' . $lang . '.wikiqoute.org/' ) {
+ $project = 'wikiqoute';
+ } elseif( $wgServer == 'http://' . $lang . '.wikisource.org/' ) {
+ $project = 'wikisource';
+ } elseif( $wgServer == 'http://' . $lang . '.wikiversity.org/' ) {
+ $project = 'wikiversity';
+ } elseif ( $wgServer == 'http://species.wikimedia.org/' ) {
+ $project = 'wikispecies';
+ $lang = NULL;
+ }
+ //The description of this extensions. it's here because it is using "$project"
+ $wgExtensionCredits['other'][] = array(
+ 'name' => 'UploadToWikimediaCommons Tab'
+ 'author' => 'Agbad'
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:UploadToWikimediaCommonsTab',
+ 'descriptionmsg' => !is_null( $project ) ? 'UploadToCommonsTab-desc' : 'UploadToCommonsTab-desc-nowork',
+ 'svn-date' => '$LastChangedDate$',
+ 'svn-revision' => '$LastChangedRevision$',
+ );
+
+ //The image
+ $image = $wgTitle->getBaseText();
+ //The tab
+ if ( $wgTitle->exists() && $wgUser->isAllowed( 'sharing' ) && $wgTitle->getNameSpace() == NS_IMAGE && !is_null($project) ) {
+ $content_actions['Commons'] = array(
+ 'class' => false,
+ 'text' => wfMsg( 'uploadToCommonsTab-text' ),
+ 'href' => 'http://toolserver.org/~magnus/commonshelper.php?interface=' . $interface . $lang . '&project=' . $project . '&image=' . $image,
+ );
+ }
+ return true;
+}
Index:: trunk/extensions/UploadToCommonsTab/UploadToCommonsTab.i18n.php
===================================================================
+++ trunk/extensions/UploadToCommonsTab/UploadToCommonsTab.i18n.php (working copy)
@@ +1,9 @@
+ <?php
+ // Messages For the extensions "UploadToCommonsTab" (http://www.mediawiki.org/wiki/Extension:UploadToCommons)
+ $messages = array();
+ $messages['en'] = array(
+ 'UploadToCommonsTab-desc' => 'Linkihg to the tool "[http://toolserver.org/~magnus/commonshelper.php commonshelper]" with the information about the image',
+ 'UploadToCommonsTab-desc-nowork' => '<span class="error">In this web, this extension cannot work, because the tool [http://toolserver.org/~magnus/commonshelper.php commonshelper] have not support in this web.</span>"',
+ 'right-sharing' => 'Allows to share files from {{SERVERNAME}} to [http://commons.wikimedia.org/wiki/ Wikimedia Commons]',
+ 'uploadToCommonsTab-text' => 'Share',
+ );

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4453
Default Alt Text
patch.txt (4 KB)

Event Timeline