Example #1
0
 function testWithDefinedExternalAndDescription()
 {
     $link = new WikiParser_OutputLink();
     $link->setIdentifier('out:Test');
     $link->setDescription('ABC');
     $link->setExternals(array('out' => 'http://example.com/$page', 'other' => 'http://www.example.com/$page'));
     $this->assertLinkIs('<a href="http://example.com/Test" class="wiki ext_page out">ABC</a>', $link->getHtml());
 }
Example #2
0
 function get_wiki_link_replacement($pageLink, $extra = array(), $ck_editor = false)
 {
     global $tikilib, $prefs;
     $wikilib = TikiLib::lib('wiki');
     // 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');
     $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->setQualifier($reltype);
     $link->setDescription($description);
     $link->setWikiLookup(array($this, 'parser_helper_wiki_info_getter'));
     $link->setWikiLinkBuilder(array($this, 'parser_helper_wiki_link_builder'));
     $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);
 }