Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -239,6 +239,10 @@ |
240 | 240 | Context source and is required. |
241 | 241 | * The Title::escape{Local,Full,Canonical}URL methods are deprecated, please use |
242 | 242 | proper html building methods to escape the normal get{...}URL methods instead. |
| 243 | +* The $variant arguments in the Title::get{Local,Full,Link,Canonical}URL methods |
| 244 | + have been replaced with a secondary query argument. |
| 245 | +* The $variant argument in the hooks for the Title::get{Local,Full,Link,Canonical}URL |
| 246 | + methods have been removed, the variant is now part of the $query argument. |
243 | 247 | |
244 | 248 | == Compatibility == |
245 | 249 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1259,10 +1259,9 @@ |
1260 | 1260 | * Get a real URL referring to this title, with interwiki link and |
1261 | 1261 | * fragment |
1262 | 1262 | * |
1263 | | - * @param $query \twotypes{\string,\array} an optional query string, not used for interwiki |
1264 | | - * links. Can be specified as an associative array as well, e.g., |
1265 | | - * array( 'action' => 'edit' ) (keys and values will be URL-escaped). |
1266 | | - * @param $variant String language variant of url (for sr, zh..) |
| 1263 | + * See getLocalURL for the arguments. |
| 1264 | + * |
| 1265 | + * @see self::getLocalURL |
1267 | 1266 | * @return String the URL |
1268 | 1267 | */ |
1269 | 1268 | public function getFullURL( $query = '', $query2 = false ) { |
— | — | @@ -1287,11 +1286,15 @@ |
1288 | 1287 | * Get a URL with no fragment or server name. If this page is generated |
1289 | 1288 | * with action=render, $wgServer is prepended. |
1290 | 1289 | * |
1291 | | - * @param $query Mixed: an optional query string; if not specified, |
1292 | | - * $wgArticlePath will be used. Can be specified as an associative array |
1293 | | - * as well, e.g., array( 'action' => 'edit' ) (keys and values will be |
1294 | | - * URL-escaped). |
1295 | | - * @param $variant String language variant of url (for sr, zh..) |
| 1290 | + |
| 1291 | + * @param $query \twotypes{\string,\array} an optional query string, |
| 1292 | + * not used for interwiki links. Can be specified as an associative array as well, |
| 1293 | + * e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). |
| 1294 | + * Some query patterns will trigger various shorturl path replacements. |
| 1295 | + * @param $query2 Mixed: An optional secondary query array. This one MUST |
| 1296 | + * be an array. If a string is passed it will be interpreted as a deprecated |
| 1297 | + * variant argument and urlencoded into a variant= argument. |
| 1298 | + * This second query argument will be added to the $query |
1296 | 1299 | * @return String the URL |
1297 | 1300 | */ |
1298 | 1301 | public function getLocalURL( $query = '', $query2 = false ) { |
— | — | @@ -1379,11 +1382,9 @@ |
1380 | 1383 | * The result obviously should not be URL-escaped, but does need to be |
1381 | 1384 | * HTML-escaped if it's being output in HTML. |
1382 | 1385 | * |
1383 | | - * @param $query Array of Strings An associative array of key => value pairs for the |
1384 | | - * query string. Keys and values will be escaped. |
1385 | | - * @param $variant String language variant of URL (for sr, zh..). Ignored |
1386 | | - * for external links. Default is "false" (same variant as current page, |
1387 | | - * for anonymous users). |
| 1386 | + * See getLocalURL for the arguments. |
| 1387 | + * |
| 1388 | + * @see self::getLocalURL |
1388 | 1389 | * @return String the URL |
1389 | 1390 | */ |
1390 | 1391 | public function getLinkURL( $query = '', $query2 = false ) { |
— | — | @@ -1403,7 +1404,9 @@ |
1404 | 1405 | * Get an HTML-escaped version of the URL form, suitable for |
1405 | 1406 | * using in a link, without a server name or fragment |
1406 | 1407 | * |
1407 | | - * @param $query String an optional query string |
| 1408 | + * See getLocalURL for the arguments. |
| 1409 | + * |
| 1410 | + * @see self::getLocalURL |
1408 | 1411 | * @return String the URL |
1409 | 1412 | */ |
1410 | 1413 | public function escapeLocalURL( $query = '', $query2 = false ) { |
— | — | @@ -1415,7 +1418,9 @@ |
1416 | 1419 | * Get an HTML-escaped version of the URL form, suitable for |
1417 | 1420 | * using in a link, including the server name and fragment |
1418 | 1421 | * |
1419 | | - * @param $query String an optional query string |
| 1422 | + * See getLocalURL for the arguments. |
| 1423 | + * |
| 1424 | + * @see self::getLocalURL |
1420 | 1425 | * @return String the URL |
1421 | 1426 | */ |
1422 | 1427 | public function escapeFullURL( $query = '', $query2 = false ) { |
— | — | @@ -1432,8 +1437,9 @@ |
1433 | 1438 | * if $wgInternalServer is not set. If the server variable used is |
1434 | 1439 | * protocol-relative, the URL will be expanded to http:// |
1435 | 1440 | * |
1436 | | - * @param $query String an optional query string |
1437 | | - * @param $variant String language variant of url (for sr, zh..) |
| 1441 | + * See getLocalURL for the arguments. |
| 1442 | + * |
| 1443 | + * @see self::getLocalURL |
1438 | 1444 | * @return String the URL |
1439 | 1445 | */ |
1440 | 1446 | public function getInternalURL( $query = '', $query2 = false ) { |
— | — | @@ -1452,20 +1458,25 @@ |
1453 | 1459 | * |
1454 | 1460 | * NOTE: Unlike getInternalURL(), the canonical URL includes the fragment |
1455 | 1461 | * |
1456 | | - * @param $query string An optional query string |
1457 | | - * @param $variant string Language variant of URL (for sr, zh, ...) |
| 1462 | + * See getLocalURL for the arguments. |
| 1463 | + * |
| 1464 | + * @see self::getLocalURL |
1458 | 1465 | * @return string The URL |
1459 | 1466 | * @since 1.18 |
1460 | 1467 | */ |
1461 | 1468 | public function getCanonicalURL( $query = '', $query2 = false ) { |
1462 | 1469 | $query = self::fixUrlQueryArgs( $query, $query2 ); |
1463 | | - $url = wfExpandUrl( $this->getLocalURL( $query, $variant ) . $this->getFragmentForURL(), PROTO_CANONICAL ); |
| 1470 | + $url = wfExpandUrl( $this->getLocalURL( $query ) . $this->getFragmentForURL(), PROTO_CANONICAL ); |
1464 | 1471 | wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) ); |
1465 | 1472 | return $url; |
1466 | 1473 | } |
1467 | 1474 | |
1468 | 1475 | /** |
1469 | 1476 | * HTML-escaped version of getCanonicalURL() |
| 1477 | + * |
| 1478 | + * See getLocalURL for the arguments. |
| 1479 | + * |
| 1480 | + * @see self::getLocalURL |
1470 | 1481 | * @since 1.18 |
1471 | 1482 | */ |
1472 | 1483 | public function escapeCanonicalURL( $query = '', $query2 = false ) { |