function testRenderFromDifferentNamespaceWithMultipleParts() { $this->info['Abc_Def_HelloWorld_Test'] = array('pageName' => 'Abc_Def_HelloWorld_Test', 'prettyName' => 'Abc / Def / HelloWorld / Test', 'namespace' => 'Abc_Def_HelloWorld', 'namespace_parts' => array('Abc', 'Def', 'HelloWorld'), 'baseName' => 'Test', 'description' => '', 'lastModif' => 1234567890); // ((Test)) within a page in HelloWorld namespace $link = new WikiParser_OutputLink(); $link->setWikiLookup(array($this, 'getPageInfo')); $link->setNamespace('Foobar', '_'); $link->setIdentifier('Abc_Def_HelloWorld_Test'); $this->assertLinkIs('<a href="Abc_Def_HelloWorld_Test" title="Abc / Def / HelloWorld / Test" class="wiki wiki_page"><span class="namespace first">Abc</span><span class="namespace">Def</span><span class="namespace last">HelloWorld</span>Test</a>', $link->getHtml()); }
function get_wiki_link_replacement($pageLink, $extra = array(), $ck_editor = false) { global $prefs; $wikilib = TikiLib::lib('wiki'); $tikilib = TikiLib::lib('tiki'); // Fetch all externals once static $externals = false; if (false === $externals) { $externals = $tikilib->fetchMap('SELECT LOWER(`name`), `extwiki` FROM `tiki_extwiki`'); } $displayLink = $pageLink; // HTML entities encoding breaks page lookup $pageLink = html_entity_decode($pageLink, ENT_COMPAT, 'UTF-8'); if ($prefs['namespace_enabled'] == 'y' && $prefs['namespace_force_links'] == 'y' && $wikilib->get_namespace($this->option['page']) && !$wikilib->get_namespace($pageLink)) { $pageLink = $wikilib->get_namespace($this->option['page']) . $prefs['namespace_separator'] . $pageLink; } $description = null; $reltype = null; $processPlural = false; $anchor = null; if (array_key_exists('description', $extra)) { $description = $extra['description']; } if (array_key_exists('reltype', $extra)) { $reltype = $extra['reltype']; } if (array_key_exists('plural', $extra)) { $processPlural = (bool) $extra['plural']; } if (array_key_exists('anchor', $extra)) { $anchor = $extra['anchor']; } $link = new WikiParser_OutputLink(); $link->setIdentifier($pageLink); $link->setNamespace($this->option['namespace'], $prefs['namespace_separator']); $link->setQualifier($reltype); $link->setDescription($description); $link->setWikiLookup(array($this, 'parser_helper_wiki_info_getter')); $link->setWikiLinkBuilder(function ($pageLink) { $wikilib = TikiLib::lib('wiki'); return $wikilib->sefurl($pageLink); }); $link->setExternals($externals); $link->setHandlePlurals($processPlural); $link->setAnchor($anchor); if ($prefs['feature_multilingual'] == 'y' && isset($GLOBALS['pageLang'])) { $link->setLanguage($GLOBALS['pageLang']); } return $link->getHtml($ck_editor); }