package.xml 0000644 0001750 0001750 00000072760 11461243356 014000 0 ustar clockwerx clockwerx
\n"; //print_r($wiki); //print "\n"; // when rendering XHTML, make sure wiki links point to a // specific base URL //$wiki->setRenderConf('xhtml', 'wikilink', 'view_url', // 'http://example.com/view.php?page='); // set an array of pages that exist in the wiki // and tell the XHTML renderer about them //$pages = array('HomePage', 'AnotherPage', 'SomeOtherPage'); $wiki->setRenderConf('xhtml', 'code', 'css_filename', 'codefilename'); // transform the wiki text into given rendering $result = $wiki->transform($source, $render); // display the transformed text if ($html) { echo bldHtml($result, $plist, $rlist, $elist); } else { if (PEAR::isError($result)) { var_dump($result); } else { echo $result; } } function bldOpt($name, $list) { $ret = ''; foreach($list as $opt) { $ret .= "\n"; } return $ret; } function bldHtml($result, $plist, $rlist, $elist) { $optparser = bldOpt('parser', $plist); $optrender = bldOpt('render', $rlist); $optexample = bldOpt('exchoice', $elist); if (PEAR::isError($result)) { $hresult = '' . nl2br(htmlentities($result->toString ())) . ''; $result = ''; } else { $hresult = nl2br(htmlentities($result)); } if ($_REQUEST['render'] != 'Xhtml') { $result = ''; } $_REQUEST['source'] = htmlspecialchars($_REQUEST['source']); return <<
tags.
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token number to be used as a placeholder in
* the source text.
*
*/
function process(&$matches) {
$name = $matches[2];
$text = $matches[3];
$start = $this->wiki->addToken(
$this->rule,
array('type' => 'start', 'name' => $name)
);
$end = $this->wiki->addToken(
$this->rule,
array('type' => 'end', 'name' => $name)
);
// done, place the script output directly in the source
return $start . trim($text) . $end;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Parse/Default/Blockquote.php 0000600 0001750 0001750 00000011315 11461243356 023312 0 ustar clockwerx clockwerx
*
* @license LGPL
*
* @version $Id: Blockquote.php 222150 2006-10-21 05:56:28Z justinpatrin $
*
*/
/**
*
* Parse for block-quoted text.
*
* Find source text marked as a blockquote, identified by any number of
* greater-than signs '>' at the start of the line, followed by a space,
* and then the quote text; each '>' indicates an additional level of
* quoting.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones on a line by itself,
* followed by the inline code example, and terminated with the string
*
on a line by itself. The code example is run through the
* native PHP highlight_string() function to colorize it, then surrounded
* with ...tags when rendered as XHTML. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones
)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/
var $regex = ';^]*)?>((?:(?R)|.*?)*)\n
(\s|$);msi';
/**
*
* Generates a token entry for the matched text. Token options are:
*
* 'text' => The full matched text, not including the
tags.
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token number to be used as a placeholder in
* the source text.
*
*/
function process(&$matches)
{
// are there additional attribute arguments?
$args = trim($matches[1]);
if ($args == '') {
$options = array(
'text' => $matches[2],
'attr' => array('type' => '')
);
} else {
// get the attributes...
$attr = $this->getAttrs($args);
// ... and make sure we have a 'type'
if (! isset($attr['type'])) {
$attr['type'] = '';
}
// retain the options
$options = array(
'text' => $matches[2],
'attr' => $attr
);
}
return $this->wiki->addToken($this->rule, $options) . $matches[3];
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Parse/Default/Colortext.php 0000600 0001750 0001750 00000003311 11461243356 023162 0 ustar clockwerx clockwerx
*
* @license LGPL
*
* @version $Id: Colortext.php 180591 2005-02-23 17:38:29Z pmjones $
*
*/
/**
*
* Parses for colorized text.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones
*
*/
class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
/**
*
* The regular expression used to parse the source text and find
* matches conforming to this rule. Used by the parse() method.
*
* @access public
*
* @var string
*
* @see parse()
*
*/
var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
/**
*
* Generates a replacement for the matched text. Token options are:
*
* 'type' => ['start'|'end'] The starting or ending point of the
* emphasized text. The text itself is left in the source.
*
* 'color' => the color indicator
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return string A pair of delimited tokens to be used as a
* placeholder in the source text surrounding the text to be
* emphasized.
*
*/
function process(&$matches)
{
$start = $this->wiki->addToken(
$this->rule,
array(
'type' => 'start',
'color' => $matches[1]
)
);
$end = $this->wiki->addToken(
$this->rule,
array(
'type' => 'end',
'color' => $matches[1]
)
);
return $start . $matches[2] . $end;
}
}
?> Text_Wiki-1.2.1/Text/Wiki/Parse/Default/Deflist.php 0000600 0001750 0001750 00000006474 11461243356 022606 0 ustar clockwerx clockwerx
*
* @license LGPL
*
* @version $Id: Deflist.php 180591 2005-02-23 17:38:29Z pmjones $
*
*/
/**
*
* Parses for definition lists.
*
* This class implements a Text_Wiki_Parse to find source text marked as a
* definition list. In short, if a line starts with ':' then it is a
* definition list item; another ':' on the same line indicates the end
* of the definition term and the beginning of the definition narrative.
* The list items must be on sequential lines (no blank lines between
* them) -- a blank line indicates the beginning of a new list.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones
*
*/
class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
/**
*
* The regular expression used to parse the source text and find
* matches conforming to this rule. Used by the parse() method.
*
* @access public
*
* @var string
*
* @see parse()
*
*/
var $regex = '/\n((: ).*\n)(?!(: |\n))/Us';
/**
*
* Generates a replacement for the matched text. Token options are:
*
* 'type' =>
* 'list_start' : the start of a definition list
* 'list_end' : the end of a definition list
* 'term_start' : the start of a definition term
* 'term_end' : the end of a definition term
* 'narr_start' : the start of definition narrative
* 'narr_end' : the end of definition narrative
* 'unknown' : unknown type of definition portion
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A series of text and delimited tokens marking the different
* list text and list elements.
*
*/
function process(&$matches)
{
// the replacement text we will return to parse()
$return = '';
// the list of post-processing matches
$list = array();
// start the deflist
$options = array('type' => 'list_start');
$return .= $this->wiki->addToken($this->rule, $options);
// $matches[1] is the text matched as a list set by parse();
// create an array called $list that contains a new set of
// matches for the various definition-list elements.
preg_match_all(
'/^(: )(.*)?( : )(.*)?$/Ums',
$matches[1],
$list,
PREG_SET_ORDER
);
// add each term and narrative
foreach ($list as $key => $val) {
$return .= (
$this->wiki->addToken($this->rule, array('type' => 'term_start')) .
trim($val[2]) .
$this->wiki->addToken($this->rule, array('type' => 'term_end')) .
$this->wiki->addToken($this->rule, array('type' => 'narr_start')) .
trim($val[4]) .
$this->wiki->addToken($this->rule, array('type' => 'narr_end'))
);
}
// end the deflist
$options = array('type' => 'list_end');
$return .= $this->wiki->addToken($this->rule, $options);
// done!
return "\n" . $return . "\n\n";
}
}
?> Text_Wiki-1.2.1/Text/Wiki/Parse/Default/Delimiter.php 0000600 0001750 0001750 00000003425 11461243356 023123 0 ustar clockwerx clockwerx
*
* @license LGPL
*
* @version $Id: Delimiter.php 180591 2005-02-23 17:38:29Z pmjones $
*
*/
/**
*
* Parses for Text_Wiki delimiter characters already in the source text.
*
* This class implements a Text_Wiki_Parse to find instances of the delimiter
* character already embedded in the source text; it extracts them and replaces
* them with a delimited token, then renders them as the delimiter itself
* when the target format is XHTML.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones
*
*/
class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
/**
*
* Constructor. Overrides the Text_Wiki_Parse constructor so that we
* can set the $regex property dynamically (we need to include the
* Text_Wiki $delim character.
*
* @param object &$obj The calling "parent" Text_Wiki object.
*
* @param string $name The token name to use for this rule.
*
*/
function Text_Wiki_Parse_delimiter(&$obj)
{
parent::Text_Wiki_Parse($obj);
$this->regex = '/' . $this->wiki->delim . '/';
}
/**
*
* Generates a token entry for the matched text. Token options are:
*
* 'text' => The full matched text.
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token number to be used as a placeholder in
* the source text.
*
*/
function process(&$matches)
{
return $this->wiki->addToken(
$this->rule,
array('text' => $this->wiki->delim)
);
}
}
?> Text_Wiki-1.2.1/Text/Wiki/Parse/Default/Embed.php 0000600 0001750 0001750 00000004504 11461243356 022220 0 ustar clockwerx clockwerx
*
* @license LGPL
*
* @version $Id: Embed.php 180591 2005-02-23 17:38:29Z pmjones $
*
*/
/**
*
* Embeds the results of a PHP script at render-time.
*
* This class implements a Text_Wiki_Parse to embed the contents of a URL
* inside the page at render-time. Typically used to get script output.
* This differs from the 'include' rule, which incorporates results at
* parse-time; 'embed' output does not get parsed by Text_Wiki, while
* 'include' ouput does.
*
* This rule is inherently not secure; it allows cross-site scripting to
* occur if the embedded output has
';
}
} else {
$js = '';
}
return $js.'
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
$css = $this->formatConf(' class="%s"', 'css');
return "
\n";
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Html.php 0000600 0001750 0001750 00000002223 11461243356 021761 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Html.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders preformated html in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
return $options['text'];
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Image.php 0000600 0001750 0001750 00000013654 11461243356 022111 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Image.php 231923 2007-03-15 15:04:50Z justinpatrin $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class inserts an image in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
var $conf = array(
'base' => '/',
'url_base' => null,
'css' => null,
'css_link' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// note the image source
$src = $options['src'];
// is the source a local file or URL?
if (strpos($src, '://') === false) {
// the source refers to a local file.
// add the URL base to it.
$src = $this->getConf('base', '/') . $src;
}
// stephane@metacites.net
// is the image clickable?
if (isset($options['attr']['link'])) {
// yes, the image is clickable.
// are we linked to a URL or a wiki page?
if (strpos($options['attr']['link'], '://')) {
// it's a URL, prefix the URL base
$href = $this->getConf('url_base') . $options['attr']['link'];
} else {
// it's a WikiPage; assume it exists.
/** @todo This needs to honor sprintf wikilinks (pmjones) */
/** @todo This needs to honor interwiki (pmjones) */
/** @todo This needs to honor freelinks (pmjones) */
$href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') .
$options['attr']['link'];
}
} else {
// image is not clickable.
$href = null;
}
// unset so it won't show up as an attribute
unset($options['attr']['link']);
// stephane@metacites.net -- 25/07/2004
// use CSS for all alignment
if (isset($options['attr']['align'])) {
// make sure we have a style attribute
if (!isset($options['attr']['style'])) {
// no style, set up a blank one
$options['attr']['style'] = '';
} else {
// style exists, add a space
$options['attr']['style'] .= ' ';
}
if ($options['attr']['align'] == 'center') {
// add a "center" style to the existing style.
$options['attr']['style'] .=
'display: block; margin-left: auto; margin-right: auto;';
} else {
// add a float style to the existing style
$options['attr']['style'] .=
'float: '.$options['attr']['align'];
}
// unset so it won't show up as an attribute
unset($options['attr']['align']);
}
// stephane@metacites.net -- 25/07/2004
// try to guess width and height
if (! isset($options['attr']['width']) &&
! isset($options['attr']['height'])) {
// does the source refer to a local file or a URL?
if (strpos($src,'://')) {
// is a URL link
$imageFile = $src;
} elseif ($src[0] == '.') {
// reg at dav-muz dot net -- 2005-03-07
// is a local file on relative path.
$imageFile = $src; # ...don't do anything because it's perfect!
} else {
// is a local file on absolute path.
$imageFile = $_SERVER['DOCUMENT_ROOT'] . $src;
}
// attempt to get the image size
$imageSize = @getimagesize($imageFile);
if (is_array($imageSize)) {
$options['attr']['width'] = $imageSize[0];
$options['attr']['height'] = $imageSize[1];
}
}
// start the HTML output
$output = '
formatConf(' class="%s"', 'css');
// add the attributes to the output, and be sure to
// track whether or not we find an "alt" attribute
$alt = false;
foreach ($options['attr'] as $key => $val) {
// track the 'alt' attribute
if (strtolower($key) == 'alt') {
$alt = true;
}
// the 'class' attribute overrides the CSS class conf
if (strtolower($key) == 'class') {
$css = null;
}
$key = $this->textEncode($key);
$val = $this->textEncode($val);
$output .= " $key=\"$val\"";
}
// always add an "alt" attribute per Stephane Solliec
if (! $alt) {
$alt = $this->textEncode(basename($options['src']));
$output .= " alt=\"$alt\"";
}
// end the image tag with the automatic CSS class (if any)
$output .= "$css />";
// was the image clickable?
if ($href) {
// yes, add the href and return
$href = $this->textEncode($href);
$css = $this->formatConf(' class="%s"', 'css_link');
$output = "$output";
}
return $output;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Include.php 0000600 0001750 0001750 00000001563 11461243356 022446 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Include.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders included maekup in XHTML. (empty)
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render {
function token()
{
return '';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Interwiki.php 0000600 0001750 0001750 00000006062 11461243356 023027 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Interwiki.php 231896 2007-03-15 00:08:47Z justinpatrin $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders inter wikis links in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
var $conf = array(
'sites' => array(
'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
'Advogato' => 'http://advogato.org/%s',
'Wiki' => 'http://c2.com/cgi/wiki?%s'
),
'target' => '_blank',
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
$text = $options['text'];
if (isset($options['url'])) {
// calculated by the parser (e.g. Mediawiki)
$href = $options['url'];
} else {
$site = $options['site'];
// toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces)
$page = $this->urlEncode($options['page']);
if (isset($this->conf['sites'][$site])) {
$href = $this->conf['sites'][$site];
} else {
return $text;
}
// old form where page is at end,
// or new form with %s placeholder for sprintf()?
if (strpos($href, '%s') === false) {
// use the old form
$href = $href . $page;
} else {
// use the new form
$href = sprintf($href, $page);
}
}
// allow for alternative targets
$target = $this->getConf('target');
// build base link
$css = $this->formatConf(' class="%s"', 'css');
$text = $this->textEncode($text);
$output = "textEncode($target);
$output .= " onclick=\"window.open(this.href, '$target');";
$output .= " return false;\"";
}
$output .= ">$text";
return $output;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Italic.php 0000600 0001750 0001750 00000002605 11461243356 022266 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Italic.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders italic text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/List.php 0000600 0001750 0001750 00000011172 11461243356 021773 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: List.php 200073 2005-11-06 10:38:25Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders bullet and ordered lists in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
var $conf = array(
'css_ol' => null,
'css_ol_li' => null,
'css_ul' => null,
'css_ul_li' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* This rendering method is syntactically and semantically compliant
* with XHTML 1.1 in that sub-lists are part of the previous list item.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// make nice variables (type, level, count)
extract($options);
// set up indenting so that the results look nice; we do this
// in two steps to avoid str_pad mathematics. ;-)
$pad = str_pad('', $level, "\t");
$pad = str_replace("\t", ' ', $pad);
switch ($type) {
case 'bullet_list_start':
// build the base HTML
$css = $this->formatConf(' class="%s"', 'css_ul');
$html = "";
/*
// if this is the opening block for the list,
// put an extra newline in front of it so the
// output looks nice.
if ($level == 0) {
$html = "\n$html";
}
*/
// done!
return $html;
break;
case 'bullet_list_end':
// build the base HTML
$html = "\n$pad
";
// if this is the closing block for the list,
// put extra newlines after it so the output
// looks nice.
if ($level == 0) {
$html .= "\n\n";
}
// done!
return $html;
break;
case 'number_list_start':
if (isset($format)) {
$format = ' type="' . $format . '"';
} else {
$format = '';
}
// build the base HTML
$css = $this->formatConf(' class="%s"', 'css_ol');
$html = "";
/*
// if this is the opening block for the list,
// put an extra newline in front of it so the
// output looks nice.
if ($level == 0) {
$html = "\n$html";
}
*/
// done!
return $html;
break;
case 'number_list_end':
// build the base HTML
$html = "\n$pad
";
// if this is the closing block for the list,
// put extra newlines after it so the output
// looks nice.
if ($level == 0) {
$html .= "\n\n";
}
// done!
return $html;
break;
case 'bullet_item_start':
case 'number_item_start':
// pick the proper CSS class
if ($type == 'bullet_item_start') {
$css = $this->formatConf(' class="%s"', 'css_ul_li');
} else {
$css = $this->formatConf(' class="%s"', 'css_ol_li');
}
// build the base HTML
$html = "\n$pad";
// for the very first item in the list, do nothing.
// but for additional items, be sure to close the
// previous item.
if ($count > 0) {
$html = " $html";
}
// done!
return $html;
break;
case 'bullet_item_end':
case 'number_item_end':
default:
// ignore item endings and all other types.
// item endings are taken care of by the other types
// depending on their place in the list.
return '';
break;
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Newline.php 0000600 0001750 0001750 00000001570 11461243356 022462 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Newline.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders new lines in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render {
function token($options)
{
return "
\n";
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Page.php 0000600 0001750 0001750 00000002250 11461243356 021731 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Page.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders page markers in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Paragraph.php 0000600 0001750 0001750 00000002636 11461243356 022772 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Paragraph.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders paragraphs in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
extract($options); //type
if ($type == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($type == 'end') {
return "
\n\n";
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Phplookup.php 0000600 0001750 0001750 00000004433 11461243356 023043 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Phplookup.php 231896 2007-03-15 00:08:47Z justinpatrin $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders a link to php functions description in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
var $conf = array(
'target' => '_blank',
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
$text = trim($options['text']);
$css = $this->formatConf(' class="%s"', 'css');
// start the html
$output = "getConf('target', '');
if ($target && $target != '_self') {
// use a "popup" window. this is XHTML compliant, suggested by
// Aaron Kalin. uses the $target as the new window name.
$target = $this->textEncode($target);
$output .= " onclick=\"window.open(this.href, '$target');";
$output .= " return false;\"";
}
// take off the final parens for functions
if (substr($text, -2) == '()') {
$q = substr($text, 0, -2);
} else {
$q = $text;
}
// toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces)
$q = $this->urlEncode($q);
$text = $this->textEncode($text);
// finish and return
$output .= " href=\"http://php.net/$q\">$text";
return $output;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Plugin.php 0000600 0001750 0001750 00000002340 11461243356 022313 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Plugin.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders wiki plugins in XHTML. (empty)
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
* Plugins produce wiki markup so are processed by parsing, no tokens produced
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
return '';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Prefilter.php 0000600 0001750 0001750 00000002044 11461243356 023012 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Prefilter.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so
* that line endings are consistently \n, lines ending in a backslash \
* are concatenated with the next line, and tabs are converted to spaces.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render {
function token()
{
return '';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Preformatted.php 0000600 0001750 0001750 00000002343 11461243356 023514 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Preformatted.php 229275 2007-02-07 13:40:44Z mic $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders preformated text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
$text = $this->textEncode($options['text']);
return ''.$text.'
';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Raw.php 0000600 0001750 0001750 00000002255 11461243356 021613 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Raw.php 214538 2006-06-09 21:32:24Z justinpatrin $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders not processed blocks in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
return $this->textEncode($options['text']);
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Revise.php 0000600 0001750 0001750 00000003247 11461243356 022321 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Revise.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders revision marks in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
var $conf = array(
'css_ins' => null,
'css_del' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'del_start') {
$css = $this->formatConf(' class="%s"', 'css_del');
return "";
}
if ($options['type'] == 'del_end') {
return "";
}
if ($options['type'] == 'ins_start') {
$css = $this->formatConf(' class="%s"', 'css_ins');
return "";
}
if ($options['type'] == 'ins_end') {
return "";
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Smiley.php 0000600 0001750 0001750 00000005070 11461243356 022322 0 ustar clockwerx clockwerx
* @copyright 2005 bertrand Gugger
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Smiley.php 206940 2006-02-10 23:07:03Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* Smiley rule Xhtml render class
*
* @category Text
* @package Text_Wiki
* @author Bertrand Gugger
* @copyright 2005 bertrand Gugger
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
* @see Text_Wiki::Text_Wiki_Render()
*/
class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
/**
* Configuration keys for this rule
* 'prefix' => the path to smileys images inclusive file name prefix,
* starts with '/' ==> abolute reference
* if no file names prefix but some folder, terminates with '/'
* 'extension' => the file extension (inclusive '.'), e.g. :
* if prefix 'smileys/icon_' and extension '.gif'
* ':)' whose name is 'smile' will give relative file 'smileys/icon_smile.gif'
* if prefix '/image/smileys/' and extension '.png': absolute '/image/smileys/smile.gif'
* 'css' => optional style applied to smileys
*
* @access public
* @var array 'config-key' => mixed config-value
*/
var $conf = array(
'prefix' => 'images/smiles/icon_',
'extension' => '.gif',
'css' => null
);
/**
* Renders a token into text matching the requested format.
* process the Smileys
*
* @access public
* @param array $options The "options" portion of the token (second element).
* @return string The text rendered from the token options.
*/
function token($options)
{
$imageFile = $this->getConf('prefix') . $options['name'] . $this->getConf('extension');
// attempt to get the image size
$imageSize = @getimagesize($imageFile);
// return the HTML output
return '
formatConf(' class="%s"', 'css') . ' />';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Specialchar.php 0000600 0001750 0001750 00000003165 11461243356 023301 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Specialchar.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders special characters in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render {
var $types = array('~bs~' => '\',
'~hs~' => ' ',
'~amp~' => '&',
'~ldq~' => '“',
'~rdq~' => '”',
'~lsq~' => '‘',
'~rsq~' => '’',
'~c~' => '©',
'~--~' => '—',
'" -- "' => '—',
'" -- "' => '—',
'~lt~' => '<',
'~gt~' => '>');
function token($options)
{
if (isset($this->types[$options['char']])) {
return $this->types[$options['char']];
} else {
return ''.substr($options['char'], 1, -1).';';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Strong.php 0000600 0001750 0001750 00000002632 11461243356 022335 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Strong.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders text marked as strong in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Subscript.php 0000600 0001750 0001750 00000002625 11461243356 023041 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Subscript.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders subscript text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Superscript.php 0000600 0001750 0001750 00000002635 11461243356 023407 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Superscript.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders superscript text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Table.php 0000600 0001750 0001750 00000006641 11461243356 022114 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Table.php 202250 2005-12-06 15:29:29Z ritzmo $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders tables in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
var $conf = array(
'css_table' => null,
'css_caption' => null,
'css_tr' => null,
'css_th' => null,
'css_td' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// make nice variable names (type, attr, span)
$span = $rowspan = 1;
extract($options);
// free format
$format = isset($format) ? ' '. $format : '';
$pad = ' ';
switch ($type) {
case 'table_start':
$css = $this->formatConf(' class="%s"', 'css_table');
return "\n\n\n";
break;
case 'table_end':
return "
\n\n";
break;
case 'caption_start':
$css = $this->formatConf(' class="%s"', 'css_caption');
return "\n";
break;
case 'caption_end':
return " \n";
break;
case 'row_start':
$css = $this->formatConf(' class="%s"', 'css_tr');
return "$pad\n";
break;
case 'row_end':
return "$pad \n";
break;
case 'cell_start':
// base html
$html = $pad . $pad;
// is this a TH or TD cell?
if ($attr == 'header') {
// start a header cell
$css = $this->formatConf(' class="%s"', 'css_th');
$html .= "formatConf(' class="%s"', 'css_td');
$html .= " 1) {
$html .= " colspan=\"$span\"";
}
// add the row span
if ($rowspan > 1) {
$html .= " rowspan=\"$rowspan\"";
}
// add alignment
if ($attr != 'header' && $attr != '') {
$html .= " style=\"text-align: $attr;\"";
}
// done!
$html .= "$format>";
return $html;
break;
case 'cell_end':
if ($attr == 'header') {
return "\n";
} else {
return " \n";
}
break;
default:
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Tighten.php 0000600 0001750 0001750 00000001562 11461243356 022464 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Tighten.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class makes the tightening in XHTML. (empty)
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render {
function token()
{
return '';
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Titlebar.php 0000600 0001750 0001750 00000002625 11461243356 022631 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Titlebar.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders a title bar in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render {
var $conf = array(
'css' => 'titlebar'
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Toc.php 0000600 0001750 0001750 00000005521 11461243356 021606 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Toc.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class inserts a table of content in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
var $conf = array(
'css_list' => null,
'css_item' => null,
'title' => 'Table of Contents',
'div_id' => 'toc',
'collapse' => true
);
var $min = 2;
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// type, id, level, count, attr
extract($options);
switch ($type) {
case 'list_start':
$css = $this->getConf('css_list');
$html = '';
// collapse div within a table?
if ($this->getConf('collapse')) {
$html .= '';
$html .= "\n";
}
// add the div, class, and id
$html .= 'getConf('div_id');
if ($div_id) {
$html .= " id=\"$div_id\"";
}
// add the title, and done
$html .= '>';
$html .= $this->getConf('title');
return $html;
break;
case 'list_end':
if ($this->getConf('collapse')) {
return "\n\n
\n\n";
} else {
return "\n\n\n";
}
break;
case 'item_start':
$html = "\n\tgetConf('css_item');
if ($css) {
$html .= " class=\"$css\"";
}
$pad = ($level - $this->min);
$html .= " style=\"margin-left: {$pad}em;\">";
$html .= "";
return $html;
break;
case 'item_end':
return "";
break;
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Tt.php 0000600 0001750 0001750 00000002600 11461243356 021443 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Tt.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders monospaced text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Underline.php 0000600 0001750 0001750 00000002622 11461243356 023005 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Underline.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders underlined text in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render {
var $conf = array(
'css' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
if ($options['type'] == 'start') {
$css = $this->formatConf(' class="%s"', 'css');
return "";
}
if ($options['type'] == 'end') {
return '';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Url.php 0000600 0001750 0001750 00000007740 11461243356 021630 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Url.php 236400 2007-05-26 17:15:41Z mic $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders URL links in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
var $conf = array(
'target' => '_blank',
'images' => true,
'img_ext' => array('jpg', 'jpeg', 'gif', 'png'),
'css_inline' => null,
'css_footnote' => null,
'css_descr' => null,
'css_img' => null
);
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// create local variables from the options array (text,
// href, type)
extract($options);
// find the rightmost dot and determine the filename
// extension.
$pos = strrpos($href, '.');
$ext = strtolower(substr($href, $pos + 1));
$href = $this->textEncode($href);
// does the filename extension indicate an image file?
if ($this->getConf('images') &&
in_array($ext, $this->getConf('img_ext', array()))) {
// create alt text for the image
if (! isset($text) || $text == '') {
$text = basename($href);
$text = $this->textEncode($text);
}
// generate an image tag
$css = $this->formatConf(' class="%s"', 'css_img');
$start = "
";
} else {
// should we build a target clause?
if ($href{0} == '#' ||
strtolower(substr($href, 0, 7)) == 'mailto:') {
// targets not allowed for on-page anchors
// and mailto: links.
$target = '';
} else {
// allow targets on non-anchor non-mailto links
$target = $this->getConf('target');
}
// generate a regular link (not an image)
$text = $this->textEncode($text);
$css = $this->formatConf(' class="%s"', "css_$type");
$start = "textEncode($target);
$start .= " onclick=\"window.open(this.href, '$target');";
$start .= " return false;\"";
}
if (isset($name)) {
$start .= " id=\"$name\"";
}
// finish up output
$start .= ">";
$end = "";
// make numbered references look like footnotes when no
// CSS class specified, make them superscript by default
if ($type == 'footnote' && ! $css) {
$start = '' . $start;
$end = $end . '';
}
}
if ($options['type'] == 'start') {
$output = $start;
} else if ($options['type'] == 'end') {
$output = $end;
} else {
$output = $start . $text . $end;
}
return $output;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Wikilink.php 0000600 0001750 0001750 00000013512 11461243356 022641 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Wikilink.php 224670 2006-12-08 21:25:24Z justinpatrin $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders wiki links in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version Release: @package_version@
* @link http://pear.php.net/package/Text_Wiki
*/
class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
var $conf = array(
'pages' => array(), // set to null or false to turn off page checks
'view_url' => 'http://example.com/index.php?page=%s',
'new_url' => 'http://example.com/new.php?page=%s',
'new_text' => '?',
'new_text_pos' => 'after', // 'before', 'after', or null/false
'css' => null,
'css_new' => null,
'exists_callback' => null // call_user_func() callback
);
/**
*
* Renders a token into XHTML.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// make nice variable names (page, anchor, text)
extract($options);
// is there a "page existence" callback?
// we need to access it directly instead of through
// getConf() because we'll need a reference (for
// object instance method callbacks).
if (isset($this->conf['exists_callback'])) {
$callback =& $this->conf['exists_callback'];
} else {
$callback = false;
}
if ($callback) {
// use the callback function
$exists = call_user_func($callback, $page);
} else {
// no callback, go to the naive page array.
$list = $this->getConf('pages');
if (is_array($list)) {
// yes, check against the page list
$exists = in_array($page, $list);
} else {
// no, assume it exists
$exists = true;
}
}
$anchor = '#'.$this->urlEncode(substr($anchor, 1));
// does the page exist?
if ($exists) {
// PAGE EXISTS.
// link to the page view, but we have to build
// the HREF. we support both the old form where
// the page always comes at the end, and the new
// form that uses %s for sprintf()
$href = $this->getConf('view_url');
if (strpos($href, '%s') === false) {
// use the old form (page-at-end)
$href = $href . $this->urlEncode($page) . $anchor;
} else {
// use the new form (sprintf format string)
$href = sprintf($href, $this->urlEncode($page)) . $anchor;
}
// get the CSS class and generate output
$css = ' class="'.$this->textEncode($this->getConf('css')).'"';
$start = '';
$end = '';
} else {
// PAGE DOES NOT EXIST.
// link to a create-page url, but only if new_url is set
$href = $this->getConf('new_url', null);
// set the proper HREF
if (! $href || trim($href) == '') {
// no useful href, return the text as it is
//TODO: This is no longer used, need to look closer into this branch
$output = $text;
} else {
// yes, link to the new-page href, but we have to build
// it. we support both the old form where
// the page always comes at the end, and the new
// form that uses sprintf()
if (strpos($href, '%s') === false) {
// use the old form
$href = $href . $this->urlEncode($page);
} else {
// use the new form
$href = sprintf($href, $this->urlEncode($page));
}
}
// get the appropriate CSS class and new-link text
$css = ' class="'.$this->textEncode($this->getConf('css_new')).'"';
$new = $this->getConf('new_text');
// what kind of linking are we doing?
$pos = $this->getConf('new_text_pos');
if (! $pos || ! $new) {
// no position (or no new_text), use css only on the page name
$start = '';
$end = '';
} elseif ($pos == 'before') {
// use the new_text BEFORE the page name
$start = ''.$this->textEncode($new).'';
$end = '';
} else {
// default, use the new_text link AFTER the page name
$start = '';
$end = ''.$this->textEncode($new).'';
}
}
if (!strlen($text)) {
$start .= $this->textEncode($page);
}
if (isset($type)) {
switch ($type) {
case 'start':
$output = $start;
break;
case 'end':
$output = $end;
break;
}
} else {
$output = $start.$this->textEncode($text).$end;
}
return $output;
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Latex.php 0000600 0001750 0001750 00000004576 11461243356 021053 0 ustar clockwerx clockwerx
*
* @package Text_Wiki
*
* @todo [http://google.com] becomes 1 with a LaTeX footnote in subscript.
* This should be a normal LaTeX footnote associated with the
* previous word?
*
* @todo parse "..." to be ``...''
*
* @todo parse '...' to be `...'
*
* @todo move escape_latex to a static function, move escaping to the
* individual .php files they are associated with
*
* @todo allow the user to add conf items to do things like
* + A custom document header
* + Custom page headings
* + Include packages
* + Set Title, Author, Date
* + Include a title page
* + Not output Document Head/Foot (maybe combinding many pages?)
*
*/
class Text_Wiki_Render_Latex extends Text_Wiki_Render {
function escape_latex ($txt) {
$txt = str_replace("\\", "\\\\", $txt);
$txt = str_replace('#', '\#', $txt);
$txt = str_replace('$', '\$', $txt);
$txt = str_replace('%', '\%', $txt);
$txt = str_replace('^', '\^', $txt);
$txt = str_replace('&', '\&', $txt);
$txt = str_replace('_', '\_', $txt);
$txt = str_replace('{', '\{', $txt);
$txt = str_replace('}', '\}', $txt);
// Typeset things a bit prettier than normas
$txt = str_replace('~', '$\sim$', $txt);
$txt = str_replace('...', '\ldots', $txt);
return $txt;
}
function escape($tok, $ele) {
if (isset($tok[$ele])) {
$tok[$ele] = $this->escape_latex($tok[$ele]);
}
return $tok;
}
function pre()
{
foreach ($this->wiki->tokens as $k => $tok) {
if ($tok[0] == 'Code') {
continue;
}
$tok[1] = $this->escape($tok[1], 'text');
$tok[1] = $this->escape($tok[1], 'page');
$tok[1] = $this->escape($tok[1], 'href');
$this->wiki->tokens[$k] = $tok;
}
$this->wiki->source = $this->escape_latex($this->wiki->source);
return
"\\documentclass{article}\n".
"\\usepackage{ulem}\n".
"\\pagestyle{headings}\n".
"\\begin{document}\n";
}
function post()
{
return "\\end{document}\n";
}
}
?> Text_Wiki-1.2.1/Text/Wiki/Render/Plain.php 0000600 0001750 0001750 00000000261 11461243356 021024 0 ustar clockwerx clockwerx
';
}
}
}
?>
Text_Wiki-1.2.1/Text/Wiki/Render/Xhtml/Horiz.php 0000600 0001750 0001750 00000002401 11461243356 022146 0 ustar clockwerx clockwerx
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: Horiz.php 191862 2005-07-30 08:03:29Z toggg $
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* This class renders an horizontal bar in XHTML.
*
* @category Text
* @package Text_Wiki
* @author Paul M. Jones