Index: trunk/extensions/SemanticForms/includes/SF_GlobalFunctions.php |
— | — | @@ -3,9 +3,10 @@ |
4 | 4 | * Global functions and constants for Semantic Forms. |
5 | 5 | * |
6 | 6 | * @author Yaron Koren |
| 7 | + * @author Harold Solbrig |
7 | 8 | */ |
8 | 9 | |
9 | | -define('SF_VERSION','0.6.3'); |
| 10 | +define('SF_VERSION','0.6.4'); |
10 | 11 | |
11 | 12 | $wgExtensionFunctions[] = 'sfgSetupExtension'; |
12 | 13 | $wgExtensionFunctions[] = 'sfgParserFunctions'; |
— | — | @@ -171,9 +172,16 @@ |
172 | 173 | * Creates HTML linking to a wiki page |
173 | 174 | */ |
174 | 175 | function sffLinkText($namespace, $name, $text = NULL) { |
175 | | - global $wgContLang; |
176 | | - $iq = new SMWInlineQuery(); |
177 | | - return $iq->makeTitleString($wgContLang->getNsText($namespace) . ':' . $name, $text, true); |
| 176 | + global $wgContLang; |
| 177 | + |
| 178 | + $inText = $wgContLang->getNsText($namespace) . ':' . $name; |
| 179 | + $title = Title::newFromText( $inText ); |
| 180 | + if ($title === NULL) { |
| 181 | + return $inText; // TODO maybe report an error here? |
| 182 | + } |
| 183 | + if ( NULL === $text ) $text = $title->getText(); |
| 184 | + $l = new Linker(); |
| 185 | + return $l->makeLinkObj($title, $label); |
178 | 186 | } |
179 | 187 | |
180 | 188 | /** |
— | — | @@ -243,7 +251,14 @@ |
244 | 252 | } |
245 | 253 | // if that didn't work, check if this page's namespace |
246 | 254 | // has a default form specified |
247 | | - if ($add_data_link = sffGetAddDataLinkForPage($db, $title, $title->getNsText(), NS_PROJECT)) { |
| 255 | + $namespace = $title->getNsText(); |
| 256 | + if ('' === $namespace) { |
| 257 | + // if it's in the main (blank) namespace, check for |
| 258 | + // the file named with the word for "Main" in this |
| 259 | + // language |
| 260 | + $namespace = wfMsgForContent('sf_blank_namespace'); |
| 261 | + } |
| 262 | + if ($add_data_link = sffGetAddDataLinkForPage($db, $title, $namespace, NS_PROJECT)) { |
248 | 263 | return $add_data_link; |
249 | 264 | } |
250 | 265 | // if nothing found still, return null |