r112207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112206‎ | r112207 | r112208 >
Date:15:23, 23 February 2012
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Follow-up r106297: spacing fixes
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -1339,49 +1339,49 @@
13401340 $this->updateMobileUrlPath( $parsedUrl );
13411341 return wfAssembleUrl( $parsedUrl );
13421342 }
1343 -
 1343+
13441344 /**
13451345 * Update host of given URL to conform to mobile URL template.
1346 - * @param $parsedUrl array
 1346+ * @param $parsedUrl array
13471347 * Result of parseUrl() or wfParseUrl()
13481348 */
1349 - protected function updateMobileUrlHost( &$parsedUrl ) {
 1349+ protected function updateMobileUrlHost( &$parsedUrl ) {
13501350 $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'host' );
1351 - if ( !strlen( $mobileUrlHostTemplate )) {
 1351+ if ( !strlen( $mobileUrlHostTemplate ) ) {
13521352 return;
13531353 }
1354 -
1355 - $parsedHostParts = explode( ".", $parsedUrl[ 'host' ] );
 1354+
 1355+ $parsedHostParts = explode( ".", $parsedUrl['host'] );
13561356 $templateHostParts = explode( ".", $mobileUrlHostTemplate );
13571357 $targetHostParts = array();
1358 -
 1358+
13591359 foreach ( $templateHostParts as $key => $templateHostPart ) {
13601360 if ( strstr( $templateHostPart, '%h' ) ) {
13611361 $parsedHostPartKey = substr( $templateHostPart, 2 );
1362 - $targetHostParts[ $key ] = $parsedHostParts[ $parsedHostPartKey ];
1363 - } elseif ( isset( $parsedHostParts[ $key ] )
1364 - && $templateHostPart == $parsedHostParts[ $key ] ) {
 1362+ $targetHostParts[ $key ] = $parsedHostParts[$parsedHostPartKey];
 1363+ } elseif ( isset( $parsedHostParts[ $key ] )
 1364+ && $templateHostPart == $parsedHostParts[$key] ) {
13651365 $targetHostParts = $parsedHostParts;
13661366 break;
13671367 } else {
1368 - $targetHostParts[ $key ] = $templateHostPart;
 1368+ $targetHostParts[$key] = $templateHostPart;
13691369 }
13701370 }
1371 -
1372 - $parsedUrl[ 'host' ] = implode( ".", $targetHostParts );
 1371+
 1372+ $parsedUrl['host'] = implode( ".", $targetHostParts );
13731373 }
13741374
13751375 /**
13761376 * Update path of given URL to conform to mobile URL template.
1377 - *
 1377+ *
13781378 * This is just a stub at the moment; does nothing. Once this does
13791379 * something, be sure to update documentation for $wgMobileUrlTemplate.
1380 - * @param $parsedUrl array
 1380+ * @param $parsedUrl array
13811381 * Result of parseUrl() or wfParseUrl()
13821382 */
13831383 protected function updateMobileUrlPath( &$parsedUrl ) {
13841384 $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'path' );
1385 - if ( !strlen( $mobileUrlHostTemplate )) {
 1385+ if ( !strlen( $mobileUrlHostTemplate ) ) {
13861386 return;
13871387 }
13881388 return;
@@ -1389,7 +1389,7 @@
13901390
13911391 /**
13921392 * Parse mobile URL template into its host and path components.
1393 - *
 1393+ *
13941394 * Optionally specify which portion of the template you want returned.
13951395 * @param $part string
13961396 * @return Mixed
@@ -1410,7 +1410,7 @@
14111411 } else {
14121412 $host = substr( $wgMobileUrlTemplate, 0, $pathStartPos );
14131413 }
1414 -
 1414+
14151415 $path = substr( $wgMobileUrlTemplate, $pathStartPos );
14161416
14171417 if ( $part == 'host' ) {

Sign-offs

UserFlagDate
Nikerabbitinspected07:48, 24 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112180Added the ability to dynamically generate mobile URLs using a 'mobile url tem...awjrichards02:03, 23 February 2012

Comments

#Comment by MaxSem (talk | contribs)   15:24, 23 February 2012

Wrong revision mentioned, should be r112180.

Status & tagging log