https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113347
Revision: 113347
Author: krinkle
Date: 2012-03-08 03:41:36 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
[ToolserverI18N] clean up
- protocol relative urls where possible
- whitespace clean up
Modified Paths:
--------------
trunk/tools/ToolserverI18N/Functions.php
trunk/tools/ToolserverI18N/TsIntuition.php
trunk/tools/ToolserverI18N/TsIntuitionUtil.php
trunk/tools/ToolserverI18N/public_html/demo/demo2.php
trunk/tools/ToolserverI18N/public_html/demo/demo3.php
trunk/tools/ToolserverI18N/public_html/demo/demo6.php
trunk/tools/ToolserverI18N/public_html/demo/demo7.php
trunk/tools/ToolserverI18N/public_html/demo/demo8.php
trunk/tools/ToolserverI18N/public_html/demo/demoBase.php
trunk/tools/ToolserverI18N/public_html/index.php
Modified: trunk/tools/ToolserverI18N/Functions.php
===================================================================
--- trunk/tools/ToolserverI18N/Functions.php 2012-03-08 03:19:51 UTC (rev
113346)
+++ trunk/tools/ToolserverI18N/Functions.php 2012-03-08 03:41:36 UTC (rev
113347)
@@ -7,7 +7,7 @@
*
* This file is licensed under
* the Creative Commons Attribution 3.0 Unported License
- * <http://creativecommons.org/licenses/by/3.0/>
+ * creativecommons.org/licenses/by/3.0/
*
* @package TsIntuition
*/
Modified: trunk/tools/ToolserverI18N/TsIntuition.php
===================================================================
--- trunk/tools/ToolserverI18N/TsIntuition.php 2012-03-08 03:19:51 UTC (rev
113346)
+++ trunk/tools/ToolserverI18N/TsIntuition.php 2012-03-08 03:41:36 UTC (rev
113347)
@@ -7,7 +7,7 @@
*
* This file is licensed under
* the Creative Commons Attribution 3.0 Unported License
- * <http://creativecommons.org/licenses/by/3.0/>
+ * creativecommons.org/licenses/by/3.0/
*
* @package TsIntuition
*/
@@ -35,7 +35,7 @@
public $mode = null; // 'in-tool', 'dashboard'
// Address to the dashboard home. Should end with a slash or .extension
- public $dashboardHome = 'http://toolserver.org/~intuition/';
+ public $dashboardHome = '//toolserver.org/~intuition/';
// Construct options
private $currentTextdomain;
@@ -81,8 +81,8 @@
private $includeVariables = array( 'messages', 'url' );
// Redirect address and status
- private $redirectTo = null;
-
+ private $redirectTo = null;
+
// Instance of MessagesFunctions
private $messagesFunctions = null;
@@ -109,7 +109,7 @@
if ( is_string( $options ) ) {
$options = array( 'domain' => $options );
}
-
+
$defaultOptions = array(
'domain' => 'general',
'lang' => null,
@@ -124,7 +124,7 @@
$options = array_merge( $defaultOptions, $options );
$this->mode = $options['mode'];
-
+
$this->loadDomainRegistry();
// The textdomain of your tool can be set here.
@@ -190,7 +190,7 @@
if ( function_exists( 'TsIntuition_inithook' ) ) {
TsIntuition_inithook( $TsIntuition );
}
-
+
}
@@ -344,7 +344,7 @@
} else {
return $this->messagesFunctions;
}
- }
+ }
/* Message functions
* ------------------------------------------------- */
@@ -359,7 +359,7 @@
* - lang: overrides the currently selected language
* - variables: numerical array to do variable replacements ($1>
var[0], $2> var[1], etc.)
* - raw-variables: boolean to determine whether the variables should
be escaped as well
- * - parsemag: boolean to determine whether the message sould be
tranformed
+ * - parsemag: boolean to determine whether the message sould be
tranformed
* using magic phrases (PLURAL, etc.)
* - escape: Optionally the return can be escaped. By default this
takes place after variable
* replacement. Set 'raw-variables' to true if you just want
the raw message
@@ -439,7 +439,7 @@
$n = $i + 1;
$msg = str_replace( "\$$n", $val, $msg );
}
-
+
// Some parsing work
if ( $options['parsemag'] === true ) {
$msg = $this->getMessagesFunctions()->parse( $msg,
$lang );
@@ -469,7 +469,7 @@
} else {
return null;
}
- }
+ }
/**
* Don't show [brackets] when suppressing errors.
@@ -614,7 +614,7 @@
/**
* Return all languages loaded in at least one domain
- * @param $domain
+ * @param $domain
* false - Show languages for which there is a translation in the
current domain
* 'any' - Show languages for which there is a translation in at least
one domain
* domain name - Show languages for which there is a translation in
the given domain
@@ -625,10 +625,10 @@
} else {
if ( $domain === false )
$domain = $this->getDomain();
-
+
$from = isset( $this->messageBlob[$domain] ) ?
$this->messageBlob[$domain] : array();
}
-
+
$return = array();
foreach( array_keys( $from ) as $lang ) {
$return[$lang] = $this->getLangName( $lang );
@@ -694,12 +694,12 @@
// Load it
$included = include( $filePath );
-
+
if ( $included === false ) {
$this->errTrigger( "File $filePath could not be loaded
", __METHOD__, E_NOTICE, __FILE__, __LINE__ );
return false;
}
-
+
// Parse it
$compact = compact( $this->includeVariables );
$this->parseTextdomain( $compact, $domain, $filePath );
@@ -731,7 +731,7 @@
}
// Was there a url defined in the textdomain file ?
- $fullurl = isset( $data['url'] ) ?
"http://toolserver.org/{$data['url']}" : null;
+ $fullurl = isset( $data['url'] ) ?
"//toolserver.org/{$data['url']}" : null;
$path = isset( $data['url'] ) ? $data['url'] : null;
$this->loadedTextdomains[$domain] = array( 'url' => $fullurl,
'path' => $path );
@@ -749,7 +749,7 @@
public function getDomainInfo( $domain ) {
$domain = ucfirst( strtolower( $domain ) );
- // Load if registered but not already loaded
+ // Load if registered but not already loaded
$this->loadTextdomain( $domain );
if ( isset( $this->loadedTextdomains[$domain] ) && is_array(
$this->loadedTextdomains[$domain] ) ) {
@@ -844,7 +844,7 @@
/**
* Get expected lifetime left in seconds.
- * Returns 0 if expired or unavailable.
+ * Returns 0 if expired or unavailable.
*/
public function getCookieLifetime() {
$expire = $this->getCookieExpiration();
@@ -863,7 +863,7 @@
/**
* FIXME: Implement in language/MessagesFunctions.php.
- *
+ *
* @todo
*/
public function gender( $male, $female, $neutral ) {
@@ -873,7 +873,7 @@
/**
* Can be founded in language/MessagesFunctions.php.
- *
+ *
* @see MessagesFunctions::parse
* @see MessagesFunctions::plural
* @deprecated
@@ -978,14 +978,14 @@
* ------------------------------------------------- */
/**
- * Show a link that explains that this tool has been
+ * Show a link that explains that this tool has been
* localized via Toolserver Intuition and that they
* can change the language by setting their preference
* in the dashboard. Or (if they've done so already)
* that they can manage their settings there
*/
public function dashboardBacklink() {
-
+
if ( $this->hasCookies() ) {
$text = $this->msg( 'bl-mysettings', 'tsintuition' );
} else {
@@ -1017,7 +1017,7 @@
// Logo
if ( is_int( $imgSize ) && $imgSize > 0 ) {
- $src =
'http://upload.wikimedia.org/wikipedia/commons/thumb/b/be'
+ $src =
'//upload.wikimedia.org/wikipedia/commons/thumb/b/be'
. '/Wikimedia_Community_Logo-Toolserver.svg'
.
"/{$imgSize}px-Wikimedia_Community_Logo-Toolserver.svg.png";
$img = TsIntuitionUtil::tag( '', 'img', array(
@@ -1064,7 +1064,7 @@
$helpTranslateDomain = strtolower( $helpTranslateDomain
);
- //
http://translatewiki.net/w/i.php?language=nl&title=Special:Translate&group=tsint-0-all
+ //
translatewiki.net/w/i.php?language=nl&title=Special:Translate&group=tsint-0-all
$twParams = array(
'title' => 'Special:Translate',
'language' => $this->getLang(),
@@ -1093,7 +1093,7 @@
* to return to the current page. To be used in other tools.
*
* @example:
- * Location: http://toolserver.org/~foo/JohnDoe.php?wiki=loremwiki_p
+ * Location: //toolserver.org/~foo/JohnDoe.php?wiki=loremwiki_p
* HTML:
* '<p>Change the settings <a href="' .
$I18N->getDashboardReturnToUrl() . '">here</a>';
*
@@ -1349,13 +1349,13 @@
if ( $die && !$this->stayalive ) {
die;
} else {
- echo "<br />\n";
+ echo "<br/>\n";
}
}
-
+
/**
* Returns true if a language is Right-to-left
- * @param $code String Language code to get the property from,
+ * @param $code String Language code to get the property from,
* current language if missing
* @return Boolean
*/
@@ -1364,10 +1364,10 @@
$code = $this->getLang();
}
require $this->localBaseDir . '/language/Rtl.php';
-
+
return in_array( $code, $rtlLanguages );
}
-
+
/**
* Return the correct HTML 'dir' attribute value for this language.
* @return String
Modified: trunk/tools/ToolserverI18N/TsIntuitionUtil.php
===================================================================
--- trunk/tools/ToolserverI18N/TsIntuitionUtil.php 2012-03-08 03:19:51 UTC
(rev 113346)
+++ trunk/tools/ToolserverI18N/TsIntuitionUtil.php 2012-03-08 03:41:36 UTC
(rev 113347)
@@ -7,7 +7,7 @@
*
* This file is licensed under
* the Creative Commons Attribution 3.0 Unported License
- * <http://creativecommons.org/licenses/by/3.0/>
+ * creativecommons.org/licenses/by/3.0/
*
* @package TsIntuition
*/
Modified: trunk/tools/ToolserverI18N/public_html/demo/demo2.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demo2.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demo2.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -13,7 +13,7 @@
// 2) Request an undefined message
// Because 'suppressnotices' is true (default),
-// this won't trigger a Notice, and show a bracket msg: '[r4nd0mstr1n9]'
+// this won't trigger a Notice, and show a bracket msg: '[r4nd0mstr1n9]'
echo $I18N->msg( 'r4nd0mstr1n9' );
Modified: trunk/tools/ToolserverI18N/public_html/demo/demo3.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demo3.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demo3.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -16,7 +16,7 @@
// 2) Request an undefined message
// Because 'suppressnotices' is false,
-// this will trigger a Notice: 'r4nd0mstr1n9' undefined
+// this will trigger a Notice: 'r4nd0mstr1n9' undefined
echo $I18N->msg( 'r4nd0mstr1n9' );
Modified: trunk/tools/ToolserverI18N/public_html/demo/demo6.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demo6.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demo6.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -12,12 +12,12 @@
echo $I18N->parentheses( 'hello' );
// Variables
-echo '<br />' . $I18N->msg( 'toolversionstamp', array(
+echo '<br/>' . $I18N->msg( 'toolversionstamp', array(
'variables' => array( '1.0', $I18N->dateFormatted( '2001-01-15' ) ),
) );
// msgExists
-echo '<br />msgExists: ';
+echo '<br/>msgExists: ';
var_dump(
$I18N->msgExists( 'welcome' )
@@ -30,7 +30,7 @@
);
// nonEmptyStr
-echo '<br />nonEmptyStr: ';
+echo '<br/>nonEmptyStr: ';
var_dump(
TsIntuitionUtil::nonEmptyStr( 'one' )
@@ -38,7 +38,7 @@
);
// nonEmptyStrs
-echo '<br />nonEmptyStrs: ';
+echo '<br/>nonEmptyStrs: ';
var_dump(
TsIntuitionUtil::nonEmptyStrs( 'one', '', 'three' )
@@ -51,7 +51,7 @@
);
// GetAcceptableLanguages
-echo "<br />getAcceptableLanguages: (default:
\$_SERVER['HTTP_ACCEPT_LANGUAGE']: ", htmlspecialchars(
$_SERVER['HTTP_ACCEPT_LANGUAGE'] ), "):<br />";
+echo "<br/>getAcceptableLanguages: (default:
\$_SERVER['HTTP_ACCEPT_LANGUAGE']: ", htmlspecialchars(
$_SERVER['HTTP_ACCEPT_LANGUAGE'] ), "):<br/>";
var_dump(
TsIntuitionUtil::getAcceptableLanguages(
@$_SERVER['HTTP_ACCEPT_LANGUAGE'] )
@@ -59,7 +59,7 @@
);
$acceptLang = 'nl-be,nl;q=0.7,en-us,en;q=0.3';
-echo "<br />getAcceptableLanguages: ( '{$acceptLang}' ):<br />";
+echo "<br/>getAcceptableLanguages: ( '{$acceptLang}' ):<br/>";
var_dump(
TsIntuitionUtil::getAcceptableLanguages( $acceptLang )
Modified: trunk/tools/ToolserverI18N/public_html/demo/demo7.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demo7.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demo7.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -13,7 +13,7 @@
echo $I18N->getLangName();
// - Specific language name
-echo '<br />' . $I18N->getLangName( 'fr' );
+echo '<br/>' . $I18N->getLangName( 'fr' );
Modified: trunk/tools/ToolserverI18N/public_html/demo/demo8.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demo8.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demo8.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -18,21 +18,21 @@
// - Raw echo
echo $I18N->msg( 'apple-stats' );
-echo '<br />';
+echo '<br/>';
// - Pass variables
-echo '<br />' . $I18N->msg( 'welcomeback', array( 'variables' => array(
'John', 'coffee' ) ) );
+echo '<br/>' . $I18N->msg( 'welcomeback', array( 'variables' => array( 'John',
'coffee' ) ) );
// - Pass variables
-echo '<br />' . $I18N->msg( 'welcomeback', array( 'variables' => array(
'George', 'tea' ) ) );
+echo '<br/>' . $I18N->msg( 'welcomeback', array( 'variables' => array(
'George', 'tea' ) ) );
-echo '<br />';
+echo '<br/>';
// - Trigger parser magic, setting $1 to '1'
-echo '<br />' . $I18N->msg( 'basket', array( 'variables' => array( '1' ),
'parsemag' => true ) );
+echo '<br/>' . $I18N->msg( 'basket', array( 'variables' => array( '1' ),
'parsemag' => true ) );
// - Trigger parser magic, setting $1 to '7'
-echo '<br />' . $I18N->msg( 'basket', array( 'variables' => array( '7' ),
'parsemag' => true ) );
+echo '<br/>' . $I18N->msg( 'basket', array( 'variables' => array( '7' ),
'parsemag' => true ) );
Modified: trunk/tools/ToolserverI18N/public_html/demo/demoBase.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/demo/demoBase.php 2012-03-08
03:19:51 UTC (rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/demo/demoBase.php 2012-03-08
03:41:36 UTC (rev 113347)
@@ -31,7 +31,7 @@
body {
font-family: sans-serif;
}
- img {
+ img {
vertical-align: middle;
}
h3 {
@@ -69,7 +69,7 @@
echo $startHTML . "<p><em>← <a href=\"../\">Return to
Dashboard</a></em></p><ul>";
foreach ( $demoRegistry as $demoFilename => $descr ) {
$descr = htmlspecialchars( $descr );
- echo "<li><a href=\"$demoFilename.php\"
title=\"$descr\">$demoFilename</a><br /><small>$descr</small></li>";
+ echo "<li><a href=\"$demoFilename.php\"
title=\"$descr\">$demoFilename</a><br/><small>$descr</small></li>";
}
echo '</ul>';
echo $outputHead;
Modified: trunk/tools/ToolserverI18N/public_html/index.php
===================================================================
--- trunk/tools/ToolserverI18N/public_html/index.php 2012-03-08 03:19:51 UTC
(rev 113346)
+++ trunk/tools/ToolserverI18N/public_html/index.php 2012-03-08 03:41:36 UTC
(rev 113347)
@@ -7,7 +7,7 @@
*
* This file is licensed under
* the Creative Commons Attribution 3.0 Unported License
- * <http://creativecommons.org/licenses/by/3.0/>
+ * creativecommons.org/licenses/by/3.0/
*
* @package TsIntuition
*/
@@ -123,7 +123,7 @@
} else {
$returnToQuery = '';
}
- $I18N->redirectTo(
"http://{$_SERVER['SERVER_NAME']}$returnTo$returnToQuery", 302 );
+ $I18N->redirectTo(
"//{$_SERVER['SERVER_NAME']}$returnTo$returnToQuery", 302 );
}
}
@@ -200,11 +200,11 @@
. kfTag( '', 'input', array( 'value' => $I18N->getLangName(),
'readonly' => 'readonly' ) )
. ' ('
. kfTag( _( 'clear-cookies' ), 'a', array( 'href' =>
$Tool->generatePermalink( array( 'action' => 'clearcookies' ) ) ) )
- . ')<br />'
+ . ')<br/>'
. kfTag( _( 'cookie-expiration' ) . _g( 'colon-separator' ),
'label' ) . kfTag( '', 'input', array( 'value' => $time, 'class' =>
"cookie-health $class", 'readonly' => 'readonly' ) )
. ' ('
. kfTag( _( 'renew-cookies' ), 'a', array( 'href' =>
$Tool->generatePermalink( array( 'action' => 'renewcookies' ) ) ) )
- . ')<br />'
+ . ')<br/>'
. $after
. '</div></fieldset></form></div><!-- #tab-currentsettings -->'
);
@@ -225,17 +225,17 @@
$form = '<div id="tab-settingsform"><form action="' . $Tool->remoteBasePath .
'" method="post" class="cleanform"><fieldset>
<legend>' . _( 'settings-legend' ) . '</legend><div class="inner">
-
+
<label>' . _html( 'choose-language' ) . _g( 'colon-separator' ) .
'</label>
' . $dropdown . '
- <br />
-
- <input type="hidden" name="action" value="prefset" />
- <input type="hidden" name="returnto" value="' . htmlspecialchars(
$kgReq->getVal( 'returnto' ) ) . '" />
- <input type="hidden" name="returntoquery" value="' . htmlspecialchars(
$kgReq->getVal( 'returntoquery' ) ) . '" />
+ <br/>
+
+ <input type="hidden" name="action" value="prefset"/>
+ <input type="hidden" name="returnto" value="' . htmlspecialchars(
$kgReq->getVal( 'returnto' ) ) . '"/>
+ <input type="hidden" name="returntoquery" value="' . htmlspecialchars(
$kgReq->getVal( 'returntoquery' ) ) . '"/>
<label></label>
- <input type="submit" nof value="' . _html( 'form-submit', 'general' ) .
'" />
- <br />
+ <input type="submit" nof value="' . _html( 'form-submit', 'general' ) .
'"/>
+ <br/>
</div></fieldset></form></div>';
@@ -245,7 +245,7 @@
// About tab
$about = '<div id="tab-about">';
-
+
$about .= '<a href="http://translatewiki.net/wiki/Translating:Toolserver">'
. Html::element( 'img', array(
'src' =>
'http://translatewiki.net/w/i.php?title=Special:TranslationStats&graphit=1&preview=&count=edits&scale=weeks&days=30&width=520&height=400&group=tsint-0-all',
@@ -265,7 +265,7 @@
$about .= '<li><a href="'
. htmlspecialchars( $domainInfo['url'] )
. '"><strong>' . htmlspecialchars( $title )
- . '</strong><br />'
+ . '</strong><br/>'
. htmlspecialchars( $domainInfo['path'] )
. '</a></li>';
} else {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs