tra('Anchor Link'), 'documentation' => 'PluginAlink', 'description' => tra('Create a link to an anchor'), 'prefs' => ['wikiplugin_alink'], 'body' => tra('Anchor link label.'), 'introduced' => 1, 'iconname' => 'link', 'tags' => [ 'basic' ], 'params' => [ 'aname' => [ 'required' => true, 'name' => tra('Anchor Name'), 'description' => tra('The anchor name as defined in the Aname plugin.'), 'default' => '', 'since' => '1', ], 'pagename' => [ 'required' => false, 'name' => tra('Page Name'), 'description' => tra('The name of the wiki page containing the anchor. If empty, the anchor name will be searched for on the wiki page where the plugin is used.'), 'filter' => 'pagename', 'default' => '', 'profile_reference' => 'wiki_page', 'since' => '1', ], ], ]; } function wikiplugin_alink($data, $params) { global $prefs; $multilinguallib = TikiLib::lib('multilingual'); $tikilib = TikiLib::lib('tiki'); extract($params, EXTR_SKIP); if (! isset($aname)) { return ("missing parameter for aname
"); } // the following replace is necessary to maintain compliance with XHTML 1.0 Transitional // and the same behavior as tikilib.php. This will change when the world arrives at XHTML 1.0 Strict. $aname = preg_replace('/[^a-zA-Z0-9]+/', '_', $aname); if (isset($pagename) && $pagename) { // Stolen, with some modifications, from tikilib.php line 4717-4723 if ($desc = $tikilib->page_exists_desc($pagename)) { // to choose the best page language $bestLang = ($prefs['feature_multilingual'] == 'y' && $prefs['feature_best_language'] == 'y') ? "&bl" : ""; // $bestLang = $prefs['feature_best_language'] == 'y' ? "&bl" : ""; return "$data"; } else { return $data . '?'; } } elseif (isset($_REQUEST['page'])) { $urlPrefix = "tiki-index.php?page="; if ($prefs['feature_sefurl'] == 'y') { $urlPrefix = ""; } return "$data"; } else { return "$data"; } }