Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php |
— | — | @@ -1339,49 +1339,49 @@ |
1340 | 1340 | $this->updateMobileUrlPath( $parsedUrl ); |
1341 | 1341 | return wfAssembleUrl( $parsedUrl ); |
1342 | 1342 | } |
1343 | | - |
| 1343 | + |
1344 | 1344 | /** |
1345 | 1345 | * Update host of given URL to conform to mobile URL template. |
1346 | | - * @param $parsedUrl array |
| 1346 | + * @param $parsedUrl array |
1347 | 1347 | * Result of parseUrl() or wfParseUrl() |
1348 | 1348 | */ |
1349 | | - protected function updateMobileUrlHost( &$parsedUrl ) { |
| 1349 | + protected function updateMobileUrlHost( &$parsedUrl ) { |
1350 | 1350 | $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'host' ); |
1351 | | - if ( !strlen( $mobileUrlHostTemplate )) { |
| 1351 | + if ( !strlen( $mobileUrlHostTemplate ) ) { |
1352 | 1352 | return; |
1353 | 1353 | } |
1354 | | - |
1355 | | - $parsedHostParts = explode( ".", $parsedUrl[ 'host' ] ); |
| 1354 | + |
| 1355 | + $parsedHostParts = explode( ".", $parsedUrl['host'] ); |
1356 | 1356 | $templateHostParts = explode( ".", $mobileUrlHostTemplate ); |
1357 | 1357 | $targetHostParts = array(); |
1358 | | - |
| 1358 | + |
1359 | 1359 | foreach ( $templateHostParts as $key => $templateHostPart ) { |
1360 | 1360 | if ( strstr( $templateHostPart, '%h' ) ) { |
1361 | 1361 | $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] ) { |
1365 | 1365 | $targetHostParts = $parsedHostParts; |
1366 | 1366 | break; |
1367 | 1367 | } else { |
1368 | | - $targetHostParts[ $key ] = $templateHostPart; |
| 1368 | + $targetHostParts[$key] = $templateHostPart; |
1369 | 1369 | } |
1370 | 1370 | } |
1371 | | - |
1372 | | - $parsedUrl[ 'host' ] = implode( ".", $targetHostParts ); |
| 1371 | + |
| 1372 | + $parsedUrl['host'] = implode( ".", $targetHostParts ); |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | /** |
1376 | 1376 | * Update path of given URL to conform to mobile URL template. |
1377 | | - * |
| 1377 | + * |
1378 | 1378 | * This is just a stub at the moment; does nothing. Once this does |
1379 | 1379 | * something, be sure to update documentation for $wgMobileUrlTemplate. |
1380 | | - * @param $parsedUrl array |
| 1380 | + * @param $parsedUrl array |
1381 | 1381 | * Result of parseUrl() or wfParseUrl() |
1382 | 1382 | */ |
1383 | 1383 | protected function updateMobileUrlPath( &$parsedUrl ) { |
1384 | 1384 | $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'path' ); |
1385 | | - if ( !strlen( $mobileUrlHostTemplate )) { |
| 1385 | + if ( !strlen( $mobileUrlHostTemplate ) ) { |
1386 | 1386 | return; |
1387 | 1387 | } |
1388 | 1388 | return; |
— | — | @@ -1389,7 +1389,7 @@ |
1390 | 1390 | |
1391 | 1391 | /** |
1392 | 1392 | * Parse mobile URL template into its host and path components. |
1393 | | - * |
| 1393 | + * |
1394 | 1394 | * Optionally specify which portion of the template you want returned. |
1395 | 1395 | * @param $part string |
1396 | 1396 | * @return Mixed |
— | — | @@ -1410,7 +1410,7 @@ |
1411 | 1411 | } else { |
1412 | 1412 | $host = substr( $wgMobileUrlTemplate, 0, $pathStartPos ); |
1413 | 1413 | } |
1414 | | - |
| 1414 | + |
1415 | 1415 | $path = substr( $wgMobileUrlTemplate, $pathStartPos ); |
1416 | 1416 | |
1417 | 1417 | if ( $part == 'host' ) { |