本文整理汇总了PHP中html_wikilink函数的典型用法代码示例。如果您正苦于以下问题:PHP html_wikilink函数的具体用法?PHP html_wikilink怎么用?PHP html_wikilink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_wikilink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
$query = cleanID($_POST['q']);
if (empty($query)) {
$query = cleanID($_GET['q']);
}
if (empty($query)) {
return;
}
require_once DOKU_INC . 'inc/html.php';
require_once DOKU_INC . 'inc/fulltext.php';
$data = array();
$data = ft_pageLookup($query);
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id) {
print '<li>';
$ns = getNS($id);
if ($ns) {
$name = shorten(noNS($id), ' (' . $ns . ')', 30);
} else {
$name = $id;
}
print html_wikilink(':' . $id, $name);
print '</li>';
}
print '</ul>';
}
示例2: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
global $INPUT;
$query = $INPUT->post->str('q');
if (empty($query)) {
$query = $INPUT->get->str('q');
}
if (empty($query)) {
return;
}
$query = urldecode($query);
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
$name = noNS($id) . ' (' . $ns . ')';
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
}
print '</ul>';
}
示例3: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
$query = $_POST['q'];
if (empty($query)) {
$query = $_GET['q'];
}
if (empty($query)) {
return;
}
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
$name = shorten(noNS($id), ' (' . $ns . ')', 30);
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
}
print '</ul>';
}
示例4: handle_start
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
global $INFO;
if ($ACT != 'show') {
return;
}
if (!$INFO['exists']) {
return;
}
# don't try to read an article that doesn't exist
$all = rtrim(rawWiki($ID));
$inner = substr($all, 2, -2);
if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
if (!strpos($inner, '://') === false) {
$url = $inner;
# link is URL already
} else {
msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
$url = html_wikilink($inner, $name = null, $search = '');
$url = substr($url, strpos($url, '"') + 1);
$url = substr($url, 0, strpos($url, '"'));
}
idx_addPage($ID);
# ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
send_redirect($url);
}
}
示例5: handle
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler)
{
// extract target page from match pattern
$page = substr($match, 11, -2);
// prepare message here instead of in render
$message = '<div class="noteredirect">' . sprintf($this->getLang('redirect_to'), html_wikilink($page)) . '</div>';
return array($page, $message);
}
示例6: run
/**
* Handle the user input [required]
*
* @param helper_plugin_bureaucracy_field[] $fields the list of fields in the form
* @param string $thanks the thank you message as defined in the form
* or default one. Might be modified by the action
* before returned
* @param array $argv additional arguments passed to the action
* @return bool|string false on error, $thanks on success
*/
public function run($fields, $thanks, $argv)
{
global $ID;
// prepare replacements
$this->prepareNamespacetemplateReplacements();
$this->prepareDateTimereplacements();
$this->prepareLanguagePlaceholder();
$this->prepareNoincludeReplacement();
$this->prepareFieldReplacements($fields);
//handle arguments
$page_to_modify = array_shift($argv);
if ($page_to_modify === '_self') {
# shortcut to modify the same page as the submitter
$page_to_modify = $ID;
} else {
//resolve against page which contains the form
resolve_pageid(getNS($ID), $page_to_modify, $ignored);
}
$template_section_id = cleanID(array_shift($argv));
if (!page_exists($page_to_modify)) {
msg(sprintf($this->getLang('e_pagenotexists'), html_wikilink($page_to_modify)), -1);
return false;
}
// check auth
//
// This is an important point. In order to be able to modify a page via this method ALL you need is READ access to the page
// This is good for admins to be able to only allow people to modify a page via a certain method. If you want to protect the page
// from people to WRITE via this method, deny access to the form page.
$auth = $this->aclcheck($page_to_modify);
// runas
if ($auth < AUTH_READ) {
msg($this->getLang('e_denied'), -1);
return false;
}
// fetch template
$template = rawWiki($page_to_modify);
if (empty($template)) {
msg(sprintf($this->getLang('e_template'), $page_to_modify), -1);
return false;
}
// do the replacements
$template = $this->updatePage($template, $template_section_id);
if (!$template) {
msg(sprintf($this->getLang('e_failedtoparse'), $page_to_modify), -1);
return false;
}
// save page
saveWikiText($page_to_modify, $template, sprintf($this->getLang('summary'), $ID));
//thanks message with redirect
$link = wl($page_to_modify);
return sprintf($this->getLang('pleasewait'), "<script type='text/javascript' charset='utf-8'>location.replace('{$link}')</script>", html_wikilink($page_to_modify));
}
示例7: _prepend_to_edit
/**
* main hooks
*/
function _prepend_to_edit(&$event, $param)
{
global $ID;
if ($event->data != 'edit') {
return;
}
if (!$this->_auth_check_all($ID)) {
return;
}
$link = html_wikilink($ID . '?do=editx');
$intro = $this->locale_xhtml('intro');
$intro = str_replace('@LINK@', $link, $intro);
print $intro;
}
示例8: xhtml
public function xhtml()
{
global $ID;
$ns = getNS($ID);
list($files, $subprojects) = Projects_file::project_files($ns);
$generated = array();
$source = array();
foreach ($files as $id => $file) {
if ($file->type() == 'source') {
$source[$id] = $file;
} elseif ($file->type() == 'generated') {
$generated[$id] = $file;
}
}
ksort($generated);
ksort($source);
sort($subprojects);
echo '<h1>Source files</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button('source') . '</li>' . DOKU_LF;
foreach ($source as $id => $file) {
echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . '</li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
echo '<h1>Generated files</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button('generated') . '</li>' . DOKU_LF;
foreach ($generated as $id => $file) {
$make = make_button($id, $file->status() == PROJECTS_MADE);
echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . ', ' . $make . '</li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
echo '<h1>Subprojects</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button($ID, 'project') . '</li>' . DOKU_LF;
foreach ($subprojects as $sub) {
echo '<li><a href="' . wl($sub . ':', array('do' => 'manage_files')) . '">' . noNS($sub) . '</a></li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
if ($ns) {
$name = getNS($ns);
$id = $name . ':';
if (!$name) {
$id = '/';
$name = '/ (root)';
}
echo '<h1>Parent projects</h1>' . DOKU_LF;
echo '<ul><li><a href="' . wl($id, array('do' => 'manage_files')) . '">' . $name . '</a></li></ul>' . DOKU_LF;
}
}
示例9: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_qsearch()
{
global $lang;
global $INPUT;
$maxnumbersuggestions = 50;
$query = $INPUT->post->str('q');
if (empty($query)) {
$query = $INPUT->get->str('q');
}
if (empty($query)) {
return;
}
$query = urldecode($query);
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
$counter = 0;
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
/* Displays the Header of the Namespace-Page or of namespace:start as the Name of the NS */
$ns_name = p_get_first_heading(getNS($id));
if (!$ns_name) {
$ns_name = p_get_first_heading(getNS($id) . ':start');
}
$name = shorten(' [' . $ns_name . ']', 30);
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
$counter++;
if ($counter > $maxnumbersuggestions) {
echo '<li>...</li>';
break;
}
}
print '</ul>';
}
示例10: handle
/**
* Handler to prepare matched data for the rendering process
*
* This function can only pass data to render() via its return value - render()
* may be not be run during the object's current life.
*
* Usually you should only need the $match param.
*
* @param string $match The text matched by the patterns
* @param int $state The lexer state for the match
* @param int $pos The character position of the matched text
* @param Doku_Handler $handler Reference to the Doku_Handler object
* @return array Return an array with all data you want to use in render
*/
public function handle($match, $state, $pos, Doku_Handler $handler)
{
// extract target page from match pattern
if ($match[0] == '#') {
# #REDIRECT PAGE
$page = substr($match, 10);
} else {
# ~~REDIRECT>PAGE~~
$page = substr($match, 11, -2);
}
$page = trim($page);
if (!preg_match('#^(https?)://#i', $page)) {
$link = html_wikilink($page);
} else {
$link = '<a href="' . hsc($page) . '" class="urlextern">' . hsc($page) . '</a>';
}
// prepare message here instead of in render
$message = '<div class="noteredirect">' . sprintf($this->getLang('redirect_to'), $link) . '</div>';
return array($page, $message);
}
示例11: addDependence
public function addDependence($dependence, $automatic)
{
$li = $this->newElement('li');
$this->list->appendChild($li);
$span = $this->newElement('span', array('use' => $dependence, 'class' => 'dependency'));
$li->appendChild($span);
$use = $this->loadElement(html_wikilink($dependence));
$span->appendChild($use);
if ($automatic) {
$li->appendChild($this->newText('(automatic)'));
} else {
if ($this->editable) {
$li->appendChild($this->newText('('));
$input = $this->newElement('a', array('class' => 'remove_dependency action', 'use' => $dependence, 'href' => ''), 'remove');
$li->appendChild($input);
$li->appendChild($this->newText(')'));
}
}
}
示例12: tpl_pagelink
/**
* Prints a link to a WikiPage
*
* Wrapper around html_wikilink
*
* @author Andreas Gohr <andi@splitbrain.org>
*
* @param string $id page id
* @param string|null $name the name of the link
* @return bool true
*/
function tpl_pagelink($id, $name = null)
{
print '<bdi>' . html_wikilink($id, $name) . '</bdi>';
return true;
}
示例13: _html_wikilink
/**
* Renders the page link, plus tooltip, abstract, casing, etc...
* @param string $id
* @param bool $display
* @param string $abstract
* @param array $opt
* @param bool $track_snippets
* @param bool $raw => non-formatted (no html)
* @return string
*/
private function _html_wikilink($id, $display, $abstract, $opt, $track_snippets = true, $raw = false)
{
$id = strpos($id, ':') === false ? ':' . $id : $id;
// : needed for root pages (root level)
$link = html_wikilink($id, $display);
$type = $opt['snippet']['type'];
$inline = '';
$after = '';
if ($type == 'tooltip') {
$tooltip = str_replace("\n\n", "\n", $abstract);
$tooltip = htmlentities($tooltip, ENT_QUOTES, 'UTF-8');
$link = $this->_add_tooltip($link, $tooltip);
} elseif (in_array($type, array('quoted', 'plain', 'inline')) && $this->snippet_cnt > 0) {
$short = $this->_shorten($abstract, $opt['snippet']['extent']);
$short = htmlentities($short, ENT_QUOTES, 'UTF-8');
if (!empty($short)) {
if ($type == 'quoted' || $type == 'plain') {
$more = html_wikilink($id, 'more');
$after = trim($short);
$after = str_replace("\n\n", "\n", $after);
$after = str_replace("\n", '<br/>', $after);
$after = '<div class="' . $type . '">' . $after . $more . '</div>' . DOKU_LF;
} elseif ($type == 'inline') {
$inline .= '<span class=inline>' . $short . '</span>';
}
}
}
$border = $opt['underline'] ? 'border' : '';
if ($raw) {
$wikilink = $link . $inline;
} else {
$wikilink = '<li class="' . $border . '">' . $link . $inline . DOKU_LF . $after . '</li>';
}
if ($track_snippets) {
$this->snippet_cnt--;
}
return $wikilink;
}
示例14: render
/**
* Handles the actual output creation.
*/
function render($mode, &$renderer, $data)
{
global $lang;
if ($mode == 'xhtml') {
$renderer->info['cache'] = false;
@(require_once DOKU_INC . 'inc/fulltext.php');
$backlinks = ft_backlinks($data[0]);
$renderer->doc .= '<div id="plugin__backlinks">' . DW_LF;
if (!empty($backlinks)) {
$renderer->doc .= '<ul class="idx">';
foreach ($backlinks as $backlink) {
$name = p_get_metadata($backlink, 'title');
if (empty($name)) {
$name = $backlink;
}
$renderer->doc .= '<li><div class="li">';
$renderer->doc .= html_wikilink(':' . $backlink, $name, '');
$renderer->doc .= '</div></li>';
}
$renderer->doc .= '</ul>';
} else {
$renderer->doc .= "<strong>Plugin Backlinks: " . $lang['nothingfound'] . "</strong>";
}
$renderer->doc .= '</div>' . DW_LF;
return true;
}
return false;
}
示例15: tpl_img
<?php
tpl_img(900, 700);
/* parameters: maximum width, maximum height (and more) */
?>
<div class="img_detail">
<?php
tpl_img_meta();
?>
<dl>
<?php
echo '<dt>' . $lang['reference'] . ':</dt>';
$media_usage = ft_mediause($IMG, true);
if (count($media_usage) > 0) {
foreach ($media_usage as $path) {
echo '<dd>' . html_wikilink($path) . '</dd>';
}
} else {
echo '<dd>' . $lang['nothingfound'] . '</dd>';
}
?>
</dl>
<p><?php
echo $lang['media_acl_warning'];
?>
</p>
</div>
<?php
//Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw'));
?>
<?php