Source for file Code.php
Documentation is available at Code.php
class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
'css' => null , // class for <pre>
'css_code' => null , // class for generic <code>
'css_php' => null , // class for PHP <code>
'css_html' => null // class for HTML <code>
* Renders a token into text matching the requested format.
* @param array $options The "options" portion of the token (second
* @return string The text rendered from the token options.
$text = $options['text'];
$attr = $options['attr'];
$css = $this->formatConf (' class="%s"', 'css');
$css_code = $this->formatConf (' class="%s"', 'css_code');
$css_php = $this->formatConf (' class="%s"', 'css_php');
$css_html = $this->formatConf (' class="%s"', 'css_html');
$text = "<?php\n" . $options['text'] . "\n?>"; // <?php
// convert tabs to four spaces
// colorize the code block (also converts HTML entities and adds
// <code>...</code> tags)
// replace <br /> tags with simple newlines.
// replace non-breaking space with simple spaces.
// translate HTML <font> and color to XHTML <span> and style.
// courtesy of research by A. Kalin :-).
'color="' => 'style="color:'
$text = strtr($text, $map);
// get rid of the last newline inside the code block
// (becuase higlight_string puts one there)
if (substr($text, -8 ) == "\n</code>") {
$text = substr($text, 0 , -8 ) . "</code>";
// replace all <code> tags with classed tags
$text = str_replace('<code>', " <code$css_php>" , $text);
$text = " <pre$css>$text</pre>";
} elseif ($type == 'html' || $type == 'xhtml') {
// add <html> opening and closing tags,
// convert tabs to four spaces,
$text = " <html>\n$text\n</html>";
$text = " <pre$css><code$css_html>$text</code></pre>";
// convert tabs to four spaces,
$text = " <pre$css><code$css_code>$text</code></pre>";
Documentation generated on Mon, 11 Mar 2019 14:22:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|