r44671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44670‎ | r44671 | r44672 >
Date:13:36, 16 December 2008
Author:mkroetzsch
Status:deferred
Tags:
Comment:
support NULL default for linker object
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Infolink.php
@@ -142,7 +142,7 @@
143143 } else { // SMW_OUTPUT_HTML, SMW_OUTPUT_FILE
144144 $link = $this->getLinker($linker)->makeKnownLinkObj($title, $this->m_caption);
145145 }
146 - } else { // Title creation failed, maybe illegal symbols or too long; make a direct URL link
 146+ } else { // Title creation failed, maybe illegal symbols or too long; make a direct URL link
147147 // (only possible if offending target parts belong to some parameter
148148 // that can be separated from title text,
149149 // e.g. as in Special:Bla/il<leg>al -> Special:Bla&p=il&lt;leg&gt;al)
@@ -172,7 +172,7 @@
173173 /**
174174 * Return hyperlink for this infolink in HTML format.
175175 */
176 - public function getHTML($linker) {
 176+ public function getHTML($linker = NULL) {
177177 return $this->getText(SMW_OUTPUT_HTML, $linker);
178178 }
179179
@@ -213,7 +213,7 @@
214214
215215 /**
216216 * Return a Linker object, using the parameter $linker if not NULL, and creatng a new one
217 - * otherwise. $linker is usually a user skin object, while the fallback linker object is
 217+ * otherwise. $linker is usually a user skin object, while the fallback linker object is
218218 * not customised to user settings.
219219 */
220220 protected function getLinker(&$linker = NULL) {
@@ -242,21 +242,21 @@
243243 if ($forTitle) {
244244 foreach ($params as $name => $value) {
245245 if ( is_string($name) && ($name != '') ) $value = $name . '=' . $value;
246 - // Escape certain problematic values. Use SMW-escape
 246+ // Escape certain problematic values. Use SMW-escape
247247 // (like URLencode but - instead of % to prevent double encoding by later MW actions)
248248 //
249249 // / : SMW's parameter separator, must not occur within params
250250 // - : used in SMW-encoding strings, needs escaping too
251251 // [ ] < > &lt; &gt; '' |: problematic in MW titles
252252 // & : sometimes problematic in MW titles ([[&amp;]] is OK, [[&test]] is OK, [[&test;]] is not OK)
253 - // (Note: '&' in strings obtained during parsing already has &entities; replaced by
 253+ // (Note: '&' in strings obtained during parsing already has &entities; replaced by
254254 // UTF8 anyway)
255255 // ' ': are equivalent with '_' in MW titles, but are not equivalent in certain parameter values
256256 // "\n": real breaks not possible in [[...]]
257257 // "#": has special meaning in URLs, triggers additional MW escapes (using . for %)
258 - // '%': must be escaped to prevent any impact of double decoding when replacing -
 258+ // '%': must be escaped to prevent any impact of double decoding when replacing -
259259 // by % before urldecode
260 - // '?': if not escaped, strange effects were observed on some sites (printout and other
 260+ // '?': if not escaped, strange effects were observed on some sites (printout and other
261261 // parameters ignored without obvious cause); SMW-escaping is always save to do -- it just
262262 // make URLs less readable
263263 //
@@ -291,18 +291,18 @@
292292 * to recover the proper paramter strings after encoding for use in wiki title names
293293 * as done by SMWInfolink::encodeParameters().
294294 *
295 - * If $allparams is set to true, it is assumed that further data should be obtained
 295+ * If $allparams is set to true, it is assumed that further data should be obtained
296296 * from the global $wgRequest, and all given parameters are read.
297297 *
298 - * $titleparam is the string extracted by MediaWiki from special page calls of the
 298+ * $titleparam is the string extracted by MediaWiki from special page calls of the
299299 * form Special:Something/titleparam
300300 * Note: it is assumed that the given $titleparam is already urldecoded, as is normal
301 - * when getting such parameters from MediaWiki. SMW-escaped parameters largely prevent
 301+ * when getting such parameters from MediaWiki. SMW-escaped parameters largely prevent
302302 * double decoding effects (i.e. there are no new "%" after one pass of urldecoding)
303303 *
304 - * The function SMWInfolink::encodeParameters() can be used to create a suitable
305 - * encoding. It is strongly recommended to not create any code that depends on the
306 - * concrete way of how parameters are encoded within this function, and to always use
 304+ * The function SMWInfolink::encodeParameters() can be used to create a suitable
 305+ * encoding. It is strongly recommended to not create any code that depends on the
 306+ * concrete way of how parameters are encoded within this function, and to always use
307307 * the respective encoding/decoding methods instead.
308308 */
309309 static public function decodeParameters($titleparam = '', $allparams = false) {

Status & tagging log