r105924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105923‎ | r105924 | r105925 >
Date:20:03, 12 December 2011
Author:dantman
Status:ok
Tags:
Comment:
Followup r105919:
- Fix a loose $variant I missed when cleaning up other methods.
- Add documentation to getLocalURL.
- Swap the disorganized docs on the dependent methods with a see comment.
- Add RELEASE-NOTES.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -239,6 +239,10 @@
240240 Context source and is required.
241241 * The Title::escape{Local,Full,Canonical}URL methods are deprecated, please use
242242 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.
243247
244248 == Compatibility ==
245249
Index: trunk/phase3/includes/Title.php
@@ -1259,10 +1259,9 @@
12601260 * Get a real URL referring to this title, with interwiki link and
12611261 * fragment
12621262 *
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
12671266 * @return String the URL
12681267 */
12691268 public function getFullURL( $query = '', $query2 = false ) {
@@ -1287,11 +1286,15 @@
12881287 * Get a URL with no fragment or server name. If this page is generated
12891288 * with action=render, $wgServer is prepended.
12901289 *
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
12961299 * @return String the URL
12971300 */
12981301 public function getLocalURL( $query = '', $query2 = false ) {
@@ -1379,11 +1382,9 @@
13801383 * The result obviously should not be URL-escaped, but does need to be
13811384 * HTML-escaped if it's being output in HTML.
13821385 *
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
13881389 * @return String the URL
13891390 */
13901391 public function getLinkURL( $query = '', $query2 = false ) {
@@ -1403,7 +1404,9 @@
14041405 * Get an HTML-escaped version of the URL form, suitable for
14051406 * using in a link, without a server name or fragment
14061407 *
1407 - * @param $query String an optional query string
 1408+ * See getLocalURL for the arguments.
 1409+ *
 1410+ * @see self::getLocalURL
14081411 * @return String the URL
14091412 */
14101413 public function escapeLocalURL( $query = '', $query2 = false ) {
@@ -1415,7 +1418,9 @@
14161419 * Get an HTML-escaped version of the URL form, suitable for
14171420 * using in a link, including the server name and fragment
14181421 *
1419 - * @param $query String an optional query string
 1422+ * See getLocalURL for the arguments.
 1423+ *
 1424+ * @see self::getLocalURL
14201425 * @return String the URL
14211426 */
14221427 public function escapeFullURL( $query = '', $query2 = false ) {
@@ -1432,8 +1437,9 @@
14331438 * if $wgInternalServer is not set. If the server variable used is
14341439 * protocol-relative, the URL will be expanded to http://
14351440 *
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
14381444 * @return String the URL
14391445 */
14401446 public function getInternalURL( $query = '', $query2 = false ) {
@@ -1452,20 +1458,25 @@
14531459 *
14541460 * NOTE: Unlike getInternalURL(), the canonical URL includes the fragment
14551461 *
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
14581465 * @return string The URL
14591466 * @since 1.18
14601467 */
14611468 public function getCanonicalURL( $query = '', $query2 = false ) {
14621469 $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 );
14641471 wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) );
14651472 return $url;
14661473 }
14671474
14681475 /**
14691476 * HTML-escaped version of getCanonicalURL()
 1477+ *
 1478+ * See getLocalURL for the arguments.
 1479+ *
 1480+ * @see self::getLocalURL
14701481 * @since 1.18
14711482 */
14721483 public function escapeCanonicalURL( $query = '', $query2 = false ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105919Replace get{Local,Full,Link,Canonical}URL's $variant argument with a secondar...dantman19:19, 12 December 2011

Status & tagging log