/** * Create output */ function render($format, &$renderer, $data) { global $ID; if ($format != 'xhtml') { return false; } $renderer->doc .= '<a href="' . exportlink($ID, 's5', sizeof($data) ? array('s5theme' => $data[0]) : null) . '" title="' . $this->getLang('view') . '">'; $renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/s5/screen.gif" align="right" alt="' . $this->getLang('view') . '" width="48" height="48" />'; $renderer->doc .= '</a>'; return true; }
/** * Add impressjs-button to pagetools * * @param Doku_Event $event * @param mixed $param not defined */ public function addbutton(&$event, $param) { global $ID, $conf; $jslocal = $this->getLang('js'); switch ($conf['template']) { case 'dokuwiki': case 'arago': case 'adoradark': $this->array_insert($event->data['items'], -1, array('impressjs' => '<li>' . ' <a href=' . exportlink($ID, 'impressjs') . ' class="action impressjs" rel="nofollow" title="' . $jslocal['btn_impressjs'] . '">' . ' <span>' . $jslocal['btn_impressjs'] . '</span>' . ' </a>' . '</li>')); break; } }
/** * Handle the actual output creation. * * @param $aFormat String The output format to generate. * @param $aRenderer Object A reference to the renderer object. * @param $aData Array The data created by the <tt>handle()</tt> * method. * @return Boolean <tt>TRUE</tt> if rendered successfully, or * <tt>FALSE</tt> otherwise. * @public * @see handle() */ public function render($mode, Doku_Renderer $renderer, $data) { global $ID; if($mode == 'xhtml'){ if (is_a($renderer, 'renderer_plugin_revealjs')){ //pass } else { $renderer->doc .= '<a href="'.exportlink($ID, 'revealjs',sizeof($data)?array('theme'=>$data[0]):null).'" title="'.$this->getLang('view').'">'; $renderer->doc .= '<img src="'.DOKU_BASE.'lib/plugins/revealjs/start_button.png" align="right" alt="'.$this->getLang('view').'"/>'; $renderer->doc .= '</a>'; } return true; } return false; }
/** * Create output */ function render($format, Doku_Renderer $renderer, $data) { global $ID, $REV; if (!$data) { // Export button if ($format != 'xhtml') { return false; } $renderer->doc .= '<a href="' . exportlink($ID, 'mellelexport', $REV != '' ? 'rev=' . $REV : '') . '?purge=1&dummy=' . microtime(true) . '" title="Export page to Redit Mellel format">'; $renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/mellelexport/MellelDocument.png" align="right" alt="Export page to Redit Mellel format" width="48" height="48" />'; $renderer->doc .= '</a>'; return true; } else { // Extended info list($info_type, $info_value) = $data; if ($info_type == "template") { // Template-based export $renderer->template = $info_value; } } return false; }
function exportSioc() { global $ID, $INFO, $conf, $REV, $auth; // Test for hidden pages if (isHiddenPage($ID)) { $this->_exit("HTTP/1.0 404 Not Found"); } // Get type of SIOC content $sioc_type = $this->_getContenttype(); // Test for valid types if (!($sioc_type == 'post' && $INFO['exists'] || $sioc_type == 'user' || $sioc_type == 'container')) { $this->_exit("HTTP/1.0 404 Not Found"); } // Test for permission if (!$INFO['perm']) { // not enough rights to see the wiki page $this->_exit("HTTP/1.0 401 Unauthorized"); } // Forward to URI with explicit type attribut if (!isset($_GET['type'])) { header('Location:' . $_SERVER['REQUEST_URI'] . '&type=' . $sioc_type, true, 302); } // Include SIOC libs require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sioc_inc.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sioc_dokuwiki.php'; // Create exporter $rdf = new SIOCExporter(); $rdf->_profile_url = normalizeUri(getAbsUrl(exportlink($ID, 'siocxml', array('type' => $sioc_type), false, '&'))); $rdf->setURLParameters('type', 'id', 'page', false); // Create SIOC-RDF content switch ($sioc_type) { case 'container': $rdf = $this->_exportContainercontent($rdf); break; case 'user': $rdf = $this->_exportUsercontent($rdf); break; case 'post': default: $rdf = $this->_exportPostcontent($rdf); break; } // export if ($this->getConf('noindx')) { header("X-Robots-Tag: noindex", true); } $rdf->export(); //print_r(headers_list()); die(); die; }
?> </div> </div> <?php flush(); ?> <?php /*old includehook*/ @(include dirname(__FILE__) . '/pageheader.html'); ?> <div class="page"> <!-- <a href="<?php echo exportlink($ID, '.odt'); ?> "><img src="<?php echo DOKU_BASE; ?> lib/plugins/odt/odt.png" alt="ODT Export"></a> --> <!-- ......... wikipage start ......... --> <?php tpl_content(); ?> <!-- ......... wikipage stop ......... --> </div> <div class="clearer"> </div> <?php
function render($format, &$renderer, $data) { if ($format != 'xhtml') { return; } global $ID; $svg_wiki_page = trim(substr($data[1], 6, -2)); //name of wiki page containing SVG image resolve_pageid(getNS($ID), $svg_wiki_page, $exists); //resolve relative IDs //detect image size for stupid browsers (like firefox) - ugly (fails if svg does not contain information about it's size) $svg_dimensions = ''; preg_match('/width="[0-9]+" height="[0-9]+"/', $data[1] . rawWiki($svg_wiki_page), $_); if (isset($_[0])) { $svg_dimensions = $_[0]; } // Check alignment $ralign = (bool) preg_match('/^\\{\\{ /', $data[1]); $lalign = (bool) preg_match('/ \\}\\}$/', $data[1]); switch (true) { case $lalign & $ralign: $align = 'center'; break; case $ralign: $align = 'right'; break; case $lalign: $align = 'left'; break; default: $align = ''; } if ($data[0] === '<svg') { $svgenc = $this->svg_base64_encode($data[1]); $renderer->doc .= $this->svg_format_embed($svgenc, 'inline-svg@' . $ID, $svg_dimensions); return true; } if ($data[0] === '{{sv' || $data[0] === '{{ s') { $svglink = exportlink($svg_wiki_page, 'svg'); $renderer->doc .= $this->svg_format_embed($svglink, 'image:' . htmlspecialchars($svg_wiki_page), $svg_dimensions, $align); $renderer->doc .= '<br /><small>' . html_wikilink($svg_wiki_page, 'svg@' . $svg_wiki_page) . '</small>'; return true; } if ($data[0] === '{{SV' || $data[0] === '{{ S') { $svgenc = $this->svg_base64_encode(rawWiki($svg_wiki_page)); $renderer->doc .= $this->svg_format_embed($svgenc, 'image:' . htmlspecialchars($svg_wiki_page), $svg_dimensions, $align); $renderer->doc .= '<br /><small>' . html_wikilink($svg_wiki_page, 'SVG@' . $svg_wiki_page) . '</small>'; return true; } }
/** * Create output */ function render($format, &$renderer, $data) { global $ID, $REV; if (!$data) { // Export button if ($format != 'xhtml') { return false; } $renderer->doc .= '<a href="' . exportlink($ID, 'odt', $REV != '' ? 'rev=' . $REV : '') . '" title="' . $this->getLang('view') . '">'; $renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/odt/odt.png" align="right" alt="' . $this->getLang('view') . '" width="48" height="48" />'; $renderer->doc .= '</a>'; return true; } else { // Extended info list($info_type, $info_value) = $data; if ($info_type == "template") { // Template-based export $renderer->template = $info_value; p_set_metadata($ID, array("relation" => array("odt" => array("template" => $info_value)))); } } return false; }
/** * Print the correct HTML meta headers * * This has to go into the head section of your template. * * @triggers TPL_METAHEADER_OUTPUT * @param boolean $alt Should feeds and alternative format links be added? * @author Andreas Gohr <*****@*****.**> */ function tpl_metaheaders($alt = true) { global $ID; global $REV; global $INFO; global $ACT; global $QUERY; global $lang; global $conf; $it = 2; // prepare the head array $head = array(); // the usual stuff $head['meta'][] = array('name' => 'generator', 'content' => 'DokuWiki ' . getVersion()); $head['link'][] = array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => DOKU_BASE . 'lib/exe/opensearch.php', 'title' => $conf['title']); $head['link'][] = array('rel' => 'start', 'href' => DOKU_BASE); if (actionOK('index')) { $head['link'][] = array('rel' => 'contents', 'href' => wl($ID, 'do=index', false, '&'), 'title' => $lang['btn_index']); } if ($alt) { $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Recent Changes', 'href' => DOKU_BASE . 'feed.php'); $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Current Namespace', 'href' => DOKU_BASE . 'feed.php?mode=list&ns=' . $INFO['namespace']); if (($ACT == 'show' || $ACT == 'search') && $INFO['writable']) { $head['link'][] = array('rel' => 'alternate', 'type' => 'application/wiki', 'title' => $lang['btn_edit'], 'href' => wl($ID, 'do=edit', false, '&')); } if ($ACT == 'search') { $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Search Result', 'href' => DOKU_BASE . 'feed.php?mode=search&q=' . $QUERY); } if (actionOK('export_xhtml')) { $head['link'][] = array('rel' => 'alternate', 'type' => 'text/html', 'title' => 'Plain HTML', 'href' => exportlink($ID, 'xhtml', '', false, '&')); } if (actionOK('export_raw')) { $head['link'][] = array('rel' => 'alternate', 'type' => 'text/plain', 'title' => 'Wiki Markup', 'href' => exportlink($ID, 'raw', '', false, '&')); } } // setup robot tags apropriate for different modes if (($ACT == 'show' || $ACT == 'export_xhtml') && !$REV) { if ($INFO['exists']) { //delay indexing: if (time() - $INFO['lastmod'] >= $conf['indexdelay']) { $head['meta'][] = array('name' => 'robots', 'content' => 'index,follow'); } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,nofollow'); } } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,follow'); } } elseif (defined('DOKU_MEDIADETAIL')) { $head['meta'][] = array('name' => 'robots', 'content' => 'index,follow'); } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,nofollow'); } // set metadata if ($ACT == 'show' || $ACT == 'export_xhtml') { // date of modification if ($REV) { $head['meta'][] = array('name' => 'date', 'content' => date('Y-m-d\\TH:i:sO', $REV)); } else { $head['meta'][] = array('name' => 'date', 'content' => date('Y-m-d\\TH:i:sO', $INFO['lastmod'])); } // keywords (explicit or implicit) if (!empty($INFO['meta']['subject'])) { $head['meta'][] = array('name' => 'keywords', 'content' => join(',', $INFO['meta']['subject'])); } else { $head['meta'][] = array('name' => 'keywords', 'content' => str_replace(':', ',', $ID)); } } // load stylesheets $head['link'][] = array('rel' => 'stylesheet', 'media' => 'all', 'type' => 'text/css', 'href' => DOKU_BASE . 'lib/exe/css.php?s=all&t=' . $conf['template']); $head['link'][] = array('rel' => 'stylesheet', 'media' => 'screen', 'type' => 'text/css', 'href' => DOKU_BASE . 'lib/exe/css.php?t=' . $conf['template']); $head['link'][] = array('rel' => 'stylesheet', 'media' => 'print', 'type' => 'text/css', 'href' => DOKU_BASE . 'lib/exe/css.php?s=print&t=' . $conf['template']); // load javascript $js_edit = $ACT == 'edit' || $ACT == 'preview' || $ACT == 'recover' || $ACT == 'wordblock' ? 1 : 0; $js_write = $INFO['writable'] ? 1 : 0; if (defined('DOKU_MEDIAMANAGER')) { $js_edit = 1; $js_write = 0; } if ($js_edit && $js_write || defined('DOKU_MEDIAMANAGER')) { $script = "NS='" . $INFO['namespace'] . "';"; if ($conf['useacl'] && $_SERVER['REMOTE_USER']) { require_once DOKU_INC . 'inc/toolbar.php'; $script .= "SIG='" . toolbar_signature() . "';"; } $head['script'][] = array('type' => 'text/javascript', 'charset' => 'utf-8', '_data' => $script); } $head['script'][] = array('type' => 'text/javascript', 'charset' => 'utf-8', '_data' => '', 'src' => DOKU_BASE . 'lib/exe/js.php?edit=' . $js_edit . '&write=' . $js_write); // trigger event here trigger_event('TPL_METAHEADER_OUTPUT', $head, '_tpl_metaheaders_action', true); return true; }
function _highlight($type, $text, $language = null, $filename = null) { global $conf; global $ID; global $lang; if ($filename) { list($ext) = mimetype($filename, false); $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext); $class = 'mediafile mf_' . $class; $this->doc .= '<dl class="' . $type . '">' . DOKU_LF; $this->doc .= '<dt><a href="' . exportlink($ID, 'code', array('codeblock' => $this->_codeblock)) . '" title="' . $lang['download'] . '" class="' . $class . '">'; $this->doc .= hsc($filename); $this->doc .= '</a></dt>' . DOKU_LF . '<dd>'; } if ($text[0] == "\n") { $text = substr($text, 1); } if (substr($text, -1) == "\n") { $text = substr($text, 0, -1); } if (is_null($language)) { $this->preformatted($text, $type); } else { $class = 'code'; if ($type != 'code') { $class .= ' ' . $type; } $this->doc .= "<pre class=\"{$class} {$language}\" " . $this->_getID(1, 1) . ">" . p_xhtml_cached_geshi($text, $language, '') . $this->_getLink() . '</pre>' . DOKU_LF; } if ($filename) { $this->doc .= '</dd></dl>' . DOKU_LF; } $this->_codeblock++; }
<div class="pageId"><span><?php echo hsc($ID) ?></span></div> <div class="page group"> <?php tpl_flush() ?> <?php tpl_includeFile('pageheader.html') ?> <!-- wikipage start --> <?php tpl_content() ?> <!-- wikipage stop --> <?php tpl_includeFile('pagefooter.html') ?> </div> <div class="docInfo"> <a href="<?php echo exportlink($ID)?>"><img class="download" src="<?php echo DOKU_BASE?>lib/images/fileicons/txt.png" alt="Text Export"></a> <a href="<?php echo exportlink($ID, 'xhtmlbody')?>"><img class="download" src="<?php echo DOKU_BASE?>lib/images/fileicons/htm.png" alt="HTML Export"></a> <a href="<?php echo exportlink($ID, 'odt')?>"><img class="download" src="<?php echo DOKU_BASE?>lib/images/fileicons/odt.png" alt="ODT Export"></a><br /> <?php tpl_pageinfo() ?></div> <?php tpl_flush() ?> </div></div><!-- /content --> <hr class="a11y" /> <!-- PAGE ACTIONS --> <div id="dokuwiki__pagetools"> <h3 class="a11y"><?php echo $lang['page_tools']; ?></h3> <div class="tools"> <ul> <?php tpl_action('edit', 1, 'li', 0, '<span>', '</span>');
/** * Handles the actual output creation. * * @param string $format output format being rendered * @param Doku_Renderer $renderer the current renderer object * @param array $data data created by handler() * @return boolean rendered correctly? (however, returned value is not used at the moment) */ public function render($format, Doku_Renderer $renderer, $data) { global $ID, $REV; if (!$data) { // Export button if ($format != 'xhtml') { return false; } $renderer->doc .= '<a href="' . exportlink($ID, 'odt', $REV != '' ? 'rev=' . $REV : '') . '" title="' . $this->getLang('view') . '">'; $renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/odt/odt.png" align="right" alt="' . $this->getLang('view') . '" width="48" height="48" />'; $renderer->doc .= '</a>'; return true; } else { // Extended info list($info_type, $info_value) = $data; if ($info_type == "template") { // Template-based export if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $renderer->template = $info_value; } elseif ($format == 'metadata') { /** @var Doku_Renderer_metadata $renderer */ $renderer->meta['relation']['odt']['template'] = $info_value; } } if ($info_type == "toc") { // Insert TOC in exported ODT file if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $renderer->toc_settings = $info_value; $renderer->render_TOC(); } elseif ($format == 'metadata') { /** @var Doku_Renderer_metadata $renderer */ $renderer->meta['relation']['odt']['toc'] = $info_value; } } if ($info_type == "page") { // Set/change page format in exported ODT file if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $params = explode(',', $info_value); $format = trim($params[0]); $orientation = trim($params[1]); for ($index = 2; $index < 6; $index++) { if (empty($params[$index])) { $params[$index] = 2; } } $renderer->setPageFormat($format, $orientation, $params[2], $params[3], $params[4], $params[5]); } } } return false; }
function render($format, &$renderer, $data) { if ($format != 'xhtml') { return; } global $ID; $svg_wiki_page = trim(substr($data[1], 6, -2)); //name of wiki page containing SVG image //detect image size for stupid browsers (like firefox) - ugly (fails if svg does not contain information about it's size) $svg_dimensions = ''; preg_match('/width="[0-9]+" height="[0-9]+"/', $data[1] . rawWiki($svg_wiki_page), $_); if (isset($_[0])) { $svg_dimensions = $_[0]; } if ($data[0] === '<svg') { $svgenc = $this->svg_base64_encode($data[1]); $renderer->doc .= $this->svg_format_embed($svgenc, 'svg-image@' . $ID, $svg_dimensions); return true; } if ($data[0] === '{{sv') { $svglink = exportlink($svg_wiki_page, 'svg'); $renderer->doc .= $this->svg_format_embed($svglink, 'image:' . htmlspecialchars($svg_wiki_page), $svg_dimensions); $renderer->doc .= html_wikilink($svg_wiki_page, 'svg@' . $svg_wiki_page); return true; } if ($data[0] === '{{SV') { $svgenc = $this->svg_base64_encode(rawWiki($svg_wiki_page)); $renderer->doc .= $this->svg_format_embed($svgenc, 'image:' . htmlspecialchars($svg_wiki_page), $svg_dimensions); $renderer->doc .= html_wikilink($svg_wiki_page, 'SVG@' . $svg_wiki_page); return true; } }
/** * Handles the actual output creation. * * @param string $format output format being rendered * @param Doku_Renderer $renderer the current renderer object * @param array $data data created by handler() * @return boolean rendered correctly? (however, returned value is not used at the moment) */ public function render($format, Doku_Renderer $renderer, $data) { global $ID, $REV; if (!$data) { // Export button if ($format != 'xhtml') { return false; } $renderer->doc .= '<a href="' . exportlink($ID, 'odt', $REV != '' ? 'rev=' . $REV : '') . '" title="' . $this->getLang('view') . '">'; $renderer->doc .= '<img src="' . DOKU_BASE . 'lib/plugins/odt/odt.png" align="right" alt="' . $this->getLang('view') . '" width="48" height="48" />'; $renderer->doc .= '</a>'; return true; } else { // Extended info // Load config helper if not done yet if ($this->config == NULL) { $this->config = plugin_load('helper', 'odt_config'); } list($info_type, $info_value, $pos) = $data; // If it is a config option store it in the meta data // and set the config parameter in the renderer. if ($this->config->isParam($info_type)) { if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $renderer->setConfigParam($info_type, $info_value); } elseif ($format == 'metadata') { if ($this->config->addingToMetaIsAllowed($info_type, $pos)) { /** @var Doku_Renderer_metadata $renderer */ $renderer->meta['relation']['odt'][$info_type] = $info_value; } } } // Do some more work for the tags which are not just a config parameter setter switch ($info_type) { case 'toc': // Insert TOC in exported ODT file if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $renderer->toc_settings = $info_value; $renderer->render_TOC(); } elseif ($format == 'metadata') { /** @var Doku_Renderer_metadata $renderer */ $renderer->meta['relation']['odt']['toc'] = $info_value; } break; case 'disablelinks': // Disable creating links and only show the text instead if ($format == 'odt') { $renderer->disable_links(); } break; case 'enablelinks': // Re-enable creating links if ($format == 'odt') { $renderer->enable_links(); } break; case 'page': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $params = explode(',', $info_value); $format = trim($params[0]); $orientation = trim($params[1]); for ($index = 2; $index < 6; $index++) { if (empty($params[$index])) { $params[$index] = 2; } } $renderer->setPageFormat($format, $orientation, $params[2], $params[3], $params[4], $params[5]); } break; case 'format': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $format = trim($info_value); $renderer->setPageFormat($format); } break; case 'orientation': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $orientation = trim($info_value); $renderer->setPageFormat(NULL, $orientation); } break; case 'margin_top': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $margin = trim($info_value); $renderer->setPageFormat(NULL, NULL, $margin); } break; case 'margin_right': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $margin = trim($info_value); $renderer->setPageFormat(NULL, NULL, NULL, $margin); } break; case 'margin_bottom': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $margin = trim($info_value); $renderer->setPageFormat(NULL, NULL, NULL, NULL, $margin); } break; case 'margin_left': if ($format == 'odt') { /** @var renderer_plugin_odt_page $renderer */ $margin = trim($info_value); $renderer->setPageFormat(NULL, NULL, NULL, NULL, NULL, $margin); } break; } } return false; }
/** * Print the correct HTML meta headers * * This has to go into the head section of your template. * * @author Andreas Gohr <*****@*****.**> * @triggers TPL_METAHEADER_OUTPUT * @param bool $alt Should feeds and alternative format links be added? * @return bool */ function tpl_metaheaders($alt = true) { global $ID; global $REV; global $INFO; global $JSINFO; global $ACT; global $QUERY; global $lang; global $conf; // prepare the head array $head = array(); // prepare seed for js and css $tseed = 0; $depends = getConfigFiles('main'); foreach ($depends as $f) { $time = @filemtime($f); if ($time > $tseed) { $tseed = $time; } } // the usual stuff $head['meta'][] = array('name' => 'generator', 'content' => 'DokuWiki'); $head['link'][] = array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => DOKU_BASE . 'lib/exe/opensearch.php', 'title' => $conf['title']); $head['link'][] = array('rel' => 'start', 'href' => DOKU_BASE); if (actionOK('index')) { $head['link'][] = array('rel' => 'contents', 'href' => wl($ID, 'do=index', false, '&'), 'title' => $lang['btn_index']); } if ($alt) { $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Recent Changes', 'href' => DOKU_BASE . 'feed.php'); $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Current Namespace', 'href' => DOKU_BASE . 'feed.php?mode=list&ns=' . $INFO['namespace']); if (($ACT == 'show' || $ACT == 'search') && $INFO['writable']) { $head['link'][] = array('rel' => 'edit', 'title' => $lang['btn_edit'], 'href' => wl($ID, 'do=edit', false, '&')); } if ($ACT == 'search') { $head['link'][] = array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'Search Result', 'href' => DOKU_BASE . 'feed.php?mode=search&q=' . $QUERY); } if (actionOK('export_xhtml')) { $head['link'][] = array('rel' => 'alternate', 'type' => 'text/html', 'title' => 'Plain HTML', 'href' => exportlink($ID, 'xhtml', '', false, '&')); } if (actionOK('export_raw')) { $head['link'][] = array('rel' => 'alternate', 'type' => 'text/plain', 'title' => 'Wiki Markup', 'href' => exportlink($ID, 'raw', '', false, '&')); } } // setup robot tags apropriate for different modes if (($ACT == 'show' || $ACT == 'export_xhtml') && !$REV) { if ($INFO['exists']) { //delay indexing: if (time() - $INFO['lastmod'] >= $conf['indexdelay']) { $head['meta'][] = array('name' => 'robots', 'content' => 'index,follow'); } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,nofollow'); } $head['link'][] = array('rel' => 'canonical', 'href' => wl($ID, '', true, '&')); } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,follow'); } } elseif (defined('DOKU_MEDIADETAIL')) { $head['meta'][] = array('name' => 'robots', 'content' => 'index,follow'); } else { $head['meta'][] = array('name' => 'robots', 'content' => 'noindex,nofollow'); } // set metadata if ($ACT == 'show' || $ACT == 'export_xhtml') { // date of modification if ($REV) { $head['meta'][] = array('name' => 'date', 'content' => date('Y-m-d\\TH:i:sO', $REV)); } else { $head['meta'][] = array('name' => 'date', 'content' => date('Y-m-d\\TH:i:sO', $INFO['lastmod'])); } // keywords (explicit or implicit) if (!empty($INFO['meta']['subject'])) { $head['meta'][] = array('name' => 'keywords', 'content' => join(',', $INFO['meta']['subject'])); } else { $head['meta'][] = array('name' => 'keywords', 'content' => str_replace(':', ',', $ID)); } } // load stylesheets $head['link'][] = array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => DOKU_BASE . 'lib/exe/css.php?t=' . $conf['template'] . '&tseed=' . $tseed); // make $INFO and other vars available to JavaScripts $json = new JSON(); $script = "var NS='" . $INFO['namespace'] . "';"; if ($conf['useacl'] && $_SERVER['REMOTE_USER']) { $script .= "var SIG='" . toolbar_signature() . "';"; } $script .= 'var JSINFO = ' . $json->encode($JSINFO) . ';'; $head['script'][] = array('type' => 'text/javascript', '_data' => $script); // load external javascript $head['script'][] = array('type' => 'text/javascript', 'charset' => 'utf-8', '_data' => '', 'src' => DOKU_BASE . 'lib/exe/js.php' . '?tseed=' . $tseed); // trigger event here trigger_event('TPL_METAHEADER_OUTPUT', $head, '_tpl_metaheaders_action', true); return true; }
/** * Use GeSHi to highlight language syntax in code and file blocks * * @author Andreas Gohr <*****@*****.**> * @param string $type code|file * @param string $text text to show * @param string $language programming language to use for syntax highlighting * @param string $filename file path label */ function _highlight($type, $text, $language = null, $filename = null) { global $ID; global $lang; if ($filename) { // add icon list($ext) = mimetype($filename, false); $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext); $class = 'mediafile mf_' . $class; $this->doc .= '<dl class="' . $type . '">' . DOKU_LF; $this->doc .= '<dt><a href="' . exportlink($ID, 'code', array('codeblock' => $this->_codeblock)) . '" title="' . $lang['download'] . '" class="' . $class . '">'; $this->doc .= hsc($filename); $this->doc .= '</a></dt>' . DOKU_LF . '<dd>'; } if ($text[0] == "\n") { $text = substr($text, 1); } if (substr($text, -1) == "\n") { $text = substr($text, 0, -1); } if (is_null($language)) { $this->doc .= '<pre class="' . $type . '">' . $this->_xmlEntities($text) . '</pre>' . DOKU_LF; } else { $class = 'code'; //we always need the code class to make the syntax highlighting apply if ($type != 'code') { $class .= ' ' . $type; } $this->doc .= "<pre class=\"{$class} {$language}\">" . p_xhtml_cached_geshi($text, $language, '') . '</pre>' . DOKU_LF; } if ($filename) { $this->doc .= '</dd></dl>' . DOKU_LF; } $this->_codeblock++; }
/** * Don't use Geshi. Overwrite ths Geshi function. * @author Emmanuel Klinger * @author Andreas Gohr <*****@*****.**> * @param string $type code|file * @param string $text text to show * @param string $language programming language to use for syntax highlighting * @param string $filename file path label */ function _highlight($type, $text, $language = null, $filename = null) { global $ID; global $lang; if($filename) { // add icon list($ext) = mimetype($filename, false); $class = preg_replace('/[^_\-a-z0-9]+/i', '_', $ext); $class = 'mediafile mf_'.$class; $this->doc .= '<dl class="'.$type.'">'.DOKU_LF; $this->doc .= '<dt><a href="'.exportlink($ID, 'code', array('codeblock' => $this->_codeblock)).'" title="'.$lang['download'].'" class="'.$class.'">'; $this->doc .= hsc($filename); $this->doc .= '</a></dt>'.DOKU_LF.'<dd>'; } if($text{0} == "\n") { $text = substr($text, 1); } if(substr($text, -1) == "\n") { $text = substr($text, 0, -1); } if(is_null($language)) { //@author Emmanuel: This line is changed from the original $this->doc .= '<pre><code>'.$this->_xmlEntities($text).'</code></pre>'.DOKU_LF; } else { //@author Emmanuel: This line is changed from the original $this->doc .= '<pre><code class="'.$language.'">'.$this->_xmlEntities($text).'</code></pre>'.DOKU_LF; } if($filename) { $this->doc .= '</dd></dl>'.DOKU_LF; } $this->_codeblock++; }