summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-14 19:48:44 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-14 19:48:44 +0100
commitd637a023b8cbe98792dee9e1c79ba830958de594 (patch)
tree9f41fe8589d45e56a7aba6e61f579b1cdfad3739
parent3672db5d25accc0ddd05b05232e7680f32384f50 (diff)
downloadutil-d637a023b8cbe98792dee9e1c79ba830958de594.tar.gz
util-d637a023b8cbe98792dee9e1c79ba830958de594.tar.bz2
util-d637a023b8cbe98792dee9e1c79ba830958de594.zip
Tidy pear library down to used components so it can be maintained in later versions of PHP
-rwxr-xr-x[-rw-r--r--]includes/pear/Console/Getopt.php109
-rwxr-xr-x[-rw-r--r--]includes/pear/Image/GraphViz.php398
-rw-r--r--includes/pear/PEAR.php92
-rwxr-xr-xincludes/pear/System.php142
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Diff.php71
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Diff/Engine/native.php66
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Diff/Renderer.php36
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Diff/Renderer/unified.php14
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki.php1463
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Default.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse.php24
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Blockquote.php91
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Bold.php63
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Code.php63
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Colortext.php92
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Font.php87
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Image.php102
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Italic.php62
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/List.php187
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Subscript.php85
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Superscript.php84
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Underline.php63
-rwxr-xr-xincludes/pear/Text/Wiki/Parse/BBCode/Url.php185
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Anchor.php9
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Blockquote.php137
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Bold.php9
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Break.php7
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Center.php11
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Code.php26
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Colortext.php13
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Deflist.php23
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Delimiter.php34
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Embed.php15
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Emphasis.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Freelink.php46
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Function.php88
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Heading.php24
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Horiz.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Html.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Image.php58
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Include.php14
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Interwiki.php26
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Italic.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/List.php46
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Newline.php8
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Paragraph.php32
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Phplookup.php8
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Prefilter.php6
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Raw.php8
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Revise.php24
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Smiley.php114
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Strong.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Subscript.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Superscript.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Table.php52
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Tighten.php8
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Toc.php36
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Tt.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Underline.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Url.php71
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Parse/Default/Wikilink.php79
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render.php25
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml.php14
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Address.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Anchor.php22
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Blockquote.php34
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Bold.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Box.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Break.php6
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Center.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Code.php50
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Colortext.php49
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Deflist.php30
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Delimiter.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Embed.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Emphasis.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Font.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Freelink.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Function.php48
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Heading.php42
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Horiz.php6
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Html.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Image.php74
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Include.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Interwiki.php36
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Italic.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/List.php44
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Newline.php2
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Page.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Paragraph.php10
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Phplookup.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Plugin.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Prefilter.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Preformatted.php6
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Raw.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Revise.php18
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Smiley.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Specialchar.php34
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Strong.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Subscript.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Superscript.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Table.php50
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Tighten.php4
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Titlebar.php12
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Toc.php41
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Tt.php16
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Underline.php18
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Url.php110
-rwxr-xr-x[-rw-r--r--]includes/pear/Text/Wiki/Render/Xhtml/Wikilink.php66
109 files changed, 3460 insertions, 2318 deletions
diff --git a/includes/pear/Console/Getopt.php b/includes/pear/Console/Getopt.php
index eb65df2..90fd0bf 100644..100755
--- a/includes/pear/Console/Getopt.php
+++ b/includes/pear/Console/Getopt.php
@@ -3,25 +3,22 @@
/**
* PHP Version 5
*
- * Copyright (c) 1997-2004 The PHP Group
+ * Copyright (c) 2001-2015, The PEAR developers
*
- * This source file is subject to version 3.0 of the PHP license,
+ * This source file is subject to the BSD-2-Clause license,
* that is bundled with this package in the file LICENSE, and is
* available through the world-wide-web at the following url:
- * http://www.php.net/license/3_0.txt.
- * If you did not receive a copy of the PHP license and are unable to
- * obtain it through the world-wide-web, please send a note to
- * license@php.net so we can mail you a copy immediately.
+ * http://opensource.org/licenses/bsd-license.php.
*
* @category Console
* @package Console_Getopt
* @author Andrei Zmievski <andrei@php.net>
- * @license http://www.php.net/license/3_0.txt PHP 3.0
- * @version CVS: $Id: Getopt.php 306067 2010-12-08 00:13:31Z dufuz $
+ * @license http://opensource.org/licenses/bsd-license.php BSD-2-Clause
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Console_Getopt
*/
-require_once 'PEAR.php';
+require_once "PEAR.php";
/**
* Command-line options parsing class.
@@ -29,7 +26,7 @@ require_once 'PEAR.php';
* @category Console
* @package Console_Getopt
* @author Andrei Zmievski <andrei@php.net>
- * @license http://www.php.net/license/3_0.txt PHP 3.0
+ * @license http://opensource.org/licenses/bsd-license.php BSD-2-Clause
* @link http://pear.php.net/package/Console_Getopt
*/
class Console_Getopt
@@ -63,7 +60,7 @@ class Console_Getopt
*
* @param array $args an array of command-line arguments
* @param string $short_options specifies the list of allowed short options
- * @param array $long_options specifies the list of allowed long options
+ * @param string $long_options specifies the list of allowed long options
* @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option
*
* @return array two-element array containing the list of parsed options and
@@ -115,7 +112,7 @@ class Console_Getopt
$non_opts = $opts = array();
- settype($args, 'array');
+ settype($args, "array");
if ($long_options) {
sort($long_options);
@@ -126,34 +123,35 @@ class Console_Getopt
* erroneous POSIX fix.
*/
if ($version < 2) {
- if (isset($args[0]{0}) && $args[0]{0} != '-') {
+ if (isset($args[0][0]) && $args[0][0] != "-") {
array_shift($args);
}
}
- reset($args);
- while (list($i, $arg) = each($args)) {
+ for ($i = 0; $i < count($args); $i++) {
+ $arg = $args[$i];
/* The special element '--' means explicit end of
options. Treat the rest of the arguments as non-options
and end the loop. */
- if ($arg == '--') {
+ if ($arg == "--") {
$non_opts = array_merge($non_opts, array_slice($args, $i + 1));
break;
}
- if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
+ if ($arg[0] != "-" || (strlen($arg) > 1 && $arg[1] == "-" && !$long_options)) {
$non_opts = array_merge($non_opts, array_slice($args, $i));
break;
- } elseif (strlen($arg) > 1 && $arg{1} == '-') {
+ } elseif (strlen($arg) > 1 && $arg[1] == "-") {
$error = Console_Getopt::_parseLongOption(substr($arg, 2),
$long_options,
$opts,
+ $i,
$args,
$skip_unknown);
if (PEAR::isError($error)) {
return $error;
}
- } elseif ($arg == '-') {
+ } elseif ($arg == "-") {
// - is stdin
$non_opts = array_merge($non_opts, array_slice($args, $i));
break;
@@ -161,6 +159,7 @@ class Console_Getopt
$error = Console_Getopt::_parseShortOption(substr($arg, 1),
$short_options,
$opts,
+ $i,
$args,
$skip_unknown);
if (PEAR::isError($error)) {
@@ -178,19 +177,20 @@ class Console_Getopt
* @param string $arg Argument
* @param string[] $short_options Available short options
* @param string[][] &$opts
- * @param string[] &$args
+ * @param int &$argIdx
+ * @param string[] $args
* @param boolean $skip_unknown suppresses Console_Getopt: unrecognized option
*
* @return void
*/
- public static function _parseShortOption($arg, $short_options, &$opts, &$args, $skip_unknown)
+ protected static function _parseShortOption($arg, $short_options, &$opts, &$argIdx, $args, $skip_unknown)
{
for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
+ $opt = $arg[$i];
$opt_arg = null;
/* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':') {
+ if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ":") {
if ($skip_unknown === true) {
break;
}
@@ -199,8 +199,8 @@ class Console_Getopt
return PEAR::raiseError($msg);
}
- if (strlen($spec) > 1 && $spec{1} == ':') {
- if (strlen($spec) > 2 && $spec{2} == ':') {
+ if (strlen($spec) > 1 && $spec[1] == ":") {
+ if (strlen($spec) > 2 && $spec[2] == ":") {
if ($i + 1 < strlen($arg)) {
/* Option takes an optional argument. Use the remainder of
the arg string if there is anything left. */
@@ -213,16 +213,17 @@ class Console_Getopt
if ($i + 1 < strlen($arg)) {
$opts[] = array($opt, substr($arg, $i + 1));
break;
- } else if (list(, $opt_arg) = each($args)) {
+ } else if (isset($args[++$argIdx])) {
+ $opt_arg = $args[$argIdx];
/* Else use the next argument. */;
if (Console_Getopt::_isShortOpt($opt_arg)
|| Console_Getopt::_isLongOpt($opt_arg)) {
$msg = "option requires an argument --$opt";
- return PEAR::raiseError("Console_Getopt:" . $msg);
+ return PEAR::raiseError("Console_Getopt: " . $msg);
}
} else {
$msg = "option requires an argument --$opt";
- return PEAR::raiseError("Console_Getopt:" . $msg);
+ return PEAR::raiseError("Console_Getopt: " . $msg);
}
}
}
@@ -238,10 +239,10 @@ class Console_Getopt
*
* @return bool
*/
- private static function _isShortOpt($arg)
+ protected static function _isShortOpt($arg)
{
- return strlen($arg) == 2 && $arg[0] == '-'
- && preg_match('/[a-zA-Z]/', $arg[1]);
+ return strlen($arg) == 2 && $arg[0] == "-"
+ && preg_match("/[a-zA-Z]/", $arg[1]);
}
/**
@@ -251,10 +252,10 @@ class Console_Getopt
*
* @return bool
*/
- private static function _isLongOpt($arg)
+ protected static function _isLongOpt($arg)
{
- return strlen($arg) > 2 && $arg[0] == '-' && $arg[1] == '-' &&
- preg_match('/[a-zA-Z]+$/', substr($arg, 2));
+ return strlen($arg) > 2 && $arg[0] == "-" && $arg[1] == "-" &&
+ preg_match("/[a-zA-Z]+$/", substr($arg, 2));
}
/**
@@ -263,13 +264,14 @@ class Console_Getopt
* @param string $arg Argument
* @param string[] $long_options Available long options
* @param string[][] &$opts
- * @param string[] &$args
+ * @param int &$argIdx
+ * @param string[] $args
*
* @return void|PEAR_Error
*/
- private static function _parseLongOption($arg, $long_options, &$opts, &$args, $skip_unknown)
+ protected static function _parseLongOption($arg, $long_options, &$opts, &$argIdx, $args, $skip_unknown)
{
- @list($opt, $opt_arg) = explode('=', $arg, 2);
+ @list($opt, $opt_arg) = explode("=", $arg, 2);
$opt_len = strlen($opt);
@@ -277,7 +279,7 @@ class Console_Getopt
$long_opt = $long_options[$i];
$opt_start = substr($long_opt, 0, $opt_len);
- $long_opt_name = str_replace('=', '', $long_opt);
+ $long_opt_name = str_replace("=", "", $long_opt);
/* Option doesn't match. Go on to the next one. */
if ($long_opt_name != $opt) {
@@ -291,26 +293,29 @@ class Console_Getopt
if ($i + 1 < count($long_options)) {
$next_option_rest = substr($long_options[$i + 1], $opt_len);
} else {
- $next_option_rest = '';
+ $next_option_rest = "";
}
- if ($opt_rest != '' && $opt{0} != '=' &&
+ if ($opt_rest != "" && $opt[0] != "=" &&
$i + 1 < count($long_options) &&
$opt == substr($long_options[$i+1], 0, $opt_len) &&
- $next_option_rest != '' &&
- $next_option_rest{0} != '=') {
+ $next_option_rest != "" &&
+ $next_option_rest[0] != "=") {
$msg = "Console_Getopt: option --$opt is ambiguous";
return PEAR::raiseError($msg);
}
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
+ if (substr($long_opt, -1) == "=") {
+ if (substr($long_opt, -2) != "==") {
/* Long option requires an argument.
Take the next argument if one wasn't specified. */;
- if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
- $msg = "Console_Getopt: option requires an argument --$opt";
- return PEAR::raiseError($msg);
+ if (!strlen($opt_arg)) {
+ if (!isset($args[++$argIdx])) {
+ $msg = "Console_Getopt: option requires an argument --$opt";
+ return PEAR::raiseError($msg);
+ }
+ $opt_arg = $args[$argIdx];
}
if (Console_Getopt::_isShortOpt($opt_arg)
@@ -324,7 +329,7 @@ class Console_Getopt
return PEAR::raiseError($msg);
}
- $opts[] = array('--' . $opt, $opt_arg);
+ $opts[] = array("--" . $opt, $opt_arg);
return;
}
@@ -345,14 +350,14 @@ class Console_Getopt
{
global $argv;
if (!is_array($argv)) {
- if (!@is_array($_SERVER['argv'])) {
- if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
+ if (!@is_array($_SERVER["argv"])) {
+ if (!@is_array($GLOBALS["HTTP_SERVER_VARS"]["argv"])) {
$msg = "Could not read cmd args (register_argc_argv=Off?)";
return PEAR::raiseError("Console_Getopt: " . $msg);
}
- return $GLOBALS['HTTP_SERVER_VARS']['argv'];
+ return $GLOBALS["HTTP_SERVER_VARS"]["argv"];
}
- return $_SERVER['argv'];
+ return $_SERVER["argv"];
}
return $argv;
}
diff --git a/includes/pear/Image/GraphViz.php b/includes/pear/Image/GraphViz.php
index d7de7c5..f7b85cb 100644..100755
--- a/includes/pear/Image/GraphViz.php
+++ b/includes/pear/Image/GraphViz.php
@@ -7,7 +7,7 @@
*
* PHP version 4 and 5
*
- * Copyright (c) 2001-2007, Dr. Volker Göbbels <vmg@arachnion.de> and
+ * Copyright (c) 2001-2007, Dr. Volker G�bbels <vmg@arachnion.de> and
* Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved.
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
@@ -18,12 +18,12 @@
*
* @category Image
* @package Image_GraphViz
- * @author Dr. Volker Göbbels <vmg@arachnion.de>
+ * @author Dr. Volker G�bbels <vmg@arachnion.de>
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @author Karsten Dambekalns <k.dambekalns@fishfarm.de>
* @author Michael Lively Jr. <mlively@ft11.net>
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
- * @copyright 2001-2007 Dr. Volker Göbbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2001-2007 Dr. Volker G�bbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: GraphViz.php 304688 2010-10-24 05:21:17Z clockwerx $
* @link http://pear.php.net/package/Image_GraphViz
@@ -34,7 +34,7 @@
/**
* Required PEAR classes
*/
-require_once 'System.php';
+require_once "System.php";
/**
* Interface to AT&T's GraphViz tools.
@@ -98,11 +98,11 @@ require_once 'System.php';
* @category Image
* @package Image_GraphViz
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
- * @author Dr. Volker Göbbels <vmg@arachnion.de>
+ * @author Dr. Volker G�bbels <vmg@arachnion.de>
* @author Karsten Dambekalns <k.dambekalns@fishfarm.de>
* @author Michael Lively Jr. <mlively@ft11.net>
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
- * @copyright 2001-2007 Dr. Volker Göbbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2001-2007 Dr. Volker G�bbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_GraphViz
@@ -116,39 +116,39 @@ class Image_GraphViz
*
* @var string
*/
- var $binPath = '';
+ var $binPath = "";
/**
* Path to GraphViz/dot command
*
* @var string
*/
- var $dotCommand = 'dot';
+ var $dotCommand = "dot";
/**
* Path to GraphViz/neato command
*
* @var string
*/
- var $neatoCommand = 'neato';
+ var $neatoCommand = "neato";
/**
* Representation of the graph
*
* @var array
*/
- var $graph = array('edgesFrom' => array(),
- 'nodes' => array(),
- 'attributes' => array(),
- 'directed' => true,
- 'clusters' => array(),
- 'subgraphs' => array(),
- 'name' => 'G',
- 'strict' => true,
+ var $graph = array("edgesFrom" => array(),
+ "nodes" => array(),
+ "attributes" => array(),
+ "directed" => true,
+ "clusters" => array(),
+ "subgraphs" => array(),
+ "name" => "G",
+ "strict" => true,
);
/**
- * Whether to return PEAR_Error instance on failures instead of FALSE
+ * Whether to return PEAR_Error instance on failures instead of false
*
* @var boolean
*/
@@ -160,25 +160,25 @@ class Image_GraphViz
* Setting the name of the Graph is useful for including multiple image
* maps on one page. If not set, the graph will be named 'G'.
*
- * @param boolean $directed Directed (TRUE) or undirected (FALSE) graph.
+ * @param boolean $directed Directed (true) or undirected (false) graph.
* Note: You MUST pass a boolean, and not just
- * an expression that evaluates to TRUE or
- * FALSE (i.e. NULL, empty string, 0 will NOT
+ * an expression that evaluates to true or
+ * false (i.e. null, empty string, 0 will NOT
* work)
* @param array $attributes Attributes of the graph
* @param string $name Name of the Graph
* @param boolean $strict Whether to collapse multiple edges between
* same nodes
- * @param boolean $returnError Set to TRUE to return PEAR_Error instances
- * on failures instead of FALSE
+ * @param boolean $returnError Set to true to return PEAR_Error instances
+ * on failures instead of false
*/
public function Image_GraphViz($directed = true, $attributes = array(),
- $name = 'G', $strict = true, $returnError = false)
+ $name = "G", $strict = true, $returnError = false)
{
$this->setDirected($directed);
$this->setAttributes($attributes);
- $this->graph['name'] = $name;
- $this->graph['strict'] = (boolean)$strict;
+ $this->graph["name"] = $name;
+ $this->graph["strict"] = (boolean)$strict;
$this->_returnFalseOnError = !$returnError;
}
@@ -192,16 +192,16 @@ class Image_GraphViz
* of the formats supported by GraphViz.
* @param string $command "dot" or "neato"
*
- * @return boolean TRUE on success, FALSE or PEAR_Error otherwise
+ * @return boolean true on success, false or PEAR_Error otherwise
*/
- public function image($format = 'svg', $command = null)
+ public function image($format = "svg", $command = null)
{
$file = $this->saveParsedGraph();
if (!$file || PEAR::isError($file)) {
return $file;
}
- $outputfile = $file . '.' . $format;
+ $outputfile = $file . "." . $format;
$rendered = $this->renderDotFile($file, $outputfile, $format,
$command);
@@ -212,58 +212,58 @@ class Image_GraphViz
$sendContentLengthHeader = true;
switch (strtolower($format)) {
- case 'gif':
- case 'png':
- case 'bmp':
- case 'jpeg':
- case 'tiff':
- header('Content-Type: image/' . $format);
+ case "gif":
+ case "png":
+ case "bmp":
+ case "jpeg":
+ case "tiff":
+ header("Content-Type: image/" . $format);
break;
- case 'tif':
- header('Content-Type: image/tiff');
+ case "tif":
+ header("Content-Type: image/tiff");
break;
- case 'jpg':
- header('Content-Type: image/jpeg');
+ case "jpg":
+ header("Content-Type: image/jpeg");
break;
- case 'ico':
- header('Content-Type: image/x-icon');
+ case "ico":
+ header("Content-Type: image/x-icon");
break;
- case 'wbmp':
- header('Content-Type: image/vnd.wap.wbmp');
+ case "wbmp":
+ header("Content-Type: image/vnd.wap.wbmp");
break;
- case 'pdf':
- header('Content-Type: application/pdf');
+ case "pdf":
+ header("Content-Type: application/pdf");
break;
- case 'mif':
- header('Content-Type: application/vnd.mif');
+ case "mif":
+ header("Content-Type: application/vnd.mif");
break;
- case 'vrml':
- header('Content-Type: application/x-vrml');
+ case "vrml":
+ header("Content-Type: application/x-vrml");
break;
- case 'svg':
- header('Content-Type: image/svg+xml');
+ case "svg":
+ header("Content-Type: image/svg+xml");
break;
- case 'plain':
- case 'plain-ext':
- header('Content-Type: text/plain');
+ case "plain":
+ case "plain-ext":
+ header("Content-Type: text/plain");
break;
default:
- header('Content-Type: application/octet-stream');
+ header("Content-Type: application/octet-stream");
$sendContentLengthHeader = false;
}
if ($sendContentLengthHeader) {
- header('Content-Length: ' . filesize($outputfile));
+ header("Content-Length: " . filesize($outputfile));
}
$return = true;
@@ -282,18 +282,18 @@ class Image_GraphViz
* of the formats supported by GraphViz.
* @param string $command "dot" or "neato"
*
- * @return string The image (data) created by GraphViz, FALSE or PEAR_Error
+ * @return string The image (data) created by GraphViz, false or PEAR_Error
* on error
* @since Method available since Release 1.1.0
*/
- public function fetch($format = 'svg', $command = null)
+ public function fetch($format = "svg", $command = null)
{
$file = $this->saveParsedGraph();
if (!$file || PEAR::isError($file)) {
return $file;
}
- $outputfile = $file . '.' . $format;
+ $outputfile = $file . "." . $format;
$rendered = $this->renderDotFile($file, $outputfile, $format,
$command);
@@ -303,13 +303,13 @@ class Image_GraphViz
@unlink($file);
- $fp = fopen($outputfile, 'rb');
+ $fp = fopen($outputfile, "rb");
if (!$fp) {
if ($this->_returnFalseOnError) {
return false;
}
- $error = PEAR::raiseError('Could not read rendered file');
+ $error = PEAR::raiseError("Could not read rendered file");
return $error;
}
@@ -329,38 +329,38 @@ class Image_GraphViz
* of the formats supported by GraphViz.
* @param string $command "dot" or "neato"
*
- * @return boolean TRUE if the file was saved, FALSE or PEAR_Error
+ * @return boolean true if the file was saved, false or PEAR_Error
* otherwise.
*/
- public function renderDotFile($dotfile, $outputfile, $format = 'svg',
+ public function renderDotFile($dotfile, $outputfile, $format = "svg",
$command = null)
{
if (!file_exists($dotfile)) {
if ($this->_returnFalseOnError) {
return false;
}
- $error = PEAR::raiseError('Could not find dot file');
+ $error = PEAR::raiseError("Could not find dot file");
return $error;
}
$oldmtime = file_exists($outputfile) ? filemtime($outputfile) : 0;
switch ($command) {
- case 'dot':
- case 'neato':
+ case "dot":
+ case "neato":
break;
default:
- $command = $this->graph['directed'] ? 'dot' : 'neato';
+ $command = $this->graph["directed"] ? "dot" : "neato";
}
$command_orig = $command;
- $command = $this->binPath.(($command == 'dot') ? $this->dotCommand
+ $command = $this->binPath.(($command == "dot") ? $this->dotCommand
: $this->neatoCommand);
- $command .= ' -T'.escapeshellarg($format)
- .' -o'.escapeshellarg($outputfile)
- .' '.escapeshellarg($dotfile)
- .' 2>&1';
+ $command .= " -T".escapeshellarg($format)
+ ." -o".escapeshellarg($outputfile)
+ ." ".escapeshellarg($dotfile)
+ ." 2>&1";
exec($command, $msg, $return_val);
clearstatcache();
@@ -370,7 +370,7 @@ class Image_GraphViz
} elseif ($this->_returnFalseOnError) {
return false;
}
- $error = PEAR::raiseError($command_orig.' command failed: '
+ $error = PEAR::raiseError($command_orig." command failed: "
.implode("\n", $msg));
return $error;
}
@@ -388,11 +388,11 @@ class Image_GraphViz
* @return void
* @see addSubgraph()
*/
- public function addCluster($id, $title, $attributes = array(), $group = 'default')
+ public function addCluster($id, $title, $attributes = array(), $group = "default")
{
- $this->graph['clusters'][$id]['title'] = $title;
- $this->graph['clusters'][$id]['attributes'] = $attributes;
- $this->graph['clusters'][$id]['embedIn'] = $group;
+ $this->graph["clusters"][$id]["title"] = $title;
+ $this->graph["clusters"][$id]["attributes"] = $attributes;
+ $this->graph["clusters"][$id]["embedIn"] = $group;
}
/**
@@ -405,11 +405,11 @@ class Image_GraphViz
*
* @return void
*/
- public function addSubgraph($id, $title, $attributes = array(), $group = 'default')
+ public function addSubgraph($id, $title, $attributes = array(), $group = "default")
{
- $this->graph['subgraphs'][$id]['title'] = $title;
- $this->graph['subgraphs'][$id]['attributes'] = $attributes;
- $this->graph['subgraphs'][$id]['embedIn'] = $group;
+ $this->graph["subgraphs"][$id]["title"] = $title;
+ $this->graph["subgraphs"][$id]["attributes"] = $attributes;
+ $this->graph["subgraphs"][$id]["embedIn"] = $group;
}
/**
@@ -421,9 +421,9 @@ class Image_GraphViz
*
* @return void
*/
- public function addNode($name, $attributes = array(), $group = 'default')
+ public function addNode($name, $attributes = array(), $group = "default")
{
- $this->graph['nodes'][$group][$name] = $attributes;
+ $this->graph["nodes"][$group][$name] = $attributes;
}
/**
@@ -436,10 +436,10 @@ class Image_GraphViz
*
* @return void
*/
- public function removeNode($name, $group = 'default')
+ public function removeNode($name, $group = "default")
{
- if (isset($this->graph['nodes'][$group][$name])) {
- unset($this->graph['nodes'][$group][$name]);
+ if (isset($this->graph["nodes"][$group][$name])) {
+ unset($this->graph["nodes"][$group][$name]);
}
}
@@ -479,29 +479,29 @@ class Image_GraphViz
if (is_array($ports)) {
if (array_key_exists($from, $ports)) {
- $info['portFrom'] = $ports[$from];
+ $info["portFrom"] = $ports[$from];
}
if (array_key_exists($to, $ports)) {
- $info['portTo'] = $ports[$to];
+ $info["portTo"] = $ports[$to];
}
}
if (is_array($attributes)) {
- $info['attributes'] = $attributes;
+ $info["attributes"] = $attributes;
}
- if (!empty($this->graph['strict'])) {
- if (!isset($this->graph['edgesFrom'][$from][$to][0])) {
- $this->graph['edgesFrom'][$from][$to][0] = $info;
+ if (!empty($this->graph["strict"])) {
+ if (!isset($this->graph["edgesFrom"][$from][$to][0])) {
+ $this->graph["edgesFrom"][$from][$to][0] = $info;
} else {
- $this->graph['edgesFrom'][$from][$to][0] = array_merge($this->graph['edgesFrom'][$from][$to][0], $info);
+ $this->graph["edgesFrom"][$from][$to][0] = array_merge($this->graph["edgesFrom"][$from][$to][0], $info);
}
} else {
- $this->graph['edgesFrom'][$from][$to][] = $info;
+ $this->graph["edgesFrom"][$from][$to][] = $info;
}
- return count($this->graph['edgesFrom'][$from][$to]) - 1;
+ return count($this->graph["edgesFrom"][$from][$to]) - 1;
}
/**
@@ -523,15 +523,15 @@ class Image_GraphViz
$to = $edge[$from];
if (!is_null($id)) {
- if (isset($this->graph['edgesFrom'][$from][$to][$id])) {
- unset($this->graph['edgesFrom'][$from][$to][$id]);
+ if (isset($this->graph["edgesFrom"][$from][$to][$id])) {
+ unset($this->graph["edgesFrom"][$from][$to][$id]);
- if (count($this->graph['edgesFrom'][$from][$to]) == 0) {
- unset($this->graph['edgesFrom'][$from][$to]);
+ if (count($this->graph["edgesFrom"][$from][$to]) == 0) {
+ unset($this->graph["edgesFrom"][$from][$to]);
}
}
- } elseif (isset($this->graph['edgesFrom'][$from][$to])) {
- unset($this->graph['edgesFrom'][$from][$to]);
+ } elseif (isset($this->graph["edgesFrom"][$from][$to])) {
+ unset($this->graph["edgesFrom"][$from][$to]);
}
}
@@ -545,7 +545,7 @@ class Image_GraphViz
public function addAttributes($attributes)
{
if (is_array($attributes)) {
- $this->graph['attributes'] = array_merge($this->graph['attributes'], $attributes);
+ $this->graph["attributes"] = array_merge($this->graph["attributes"], $attributes);
}
}
@@ -559,7 +559,7 @@ class Image_GraphViz
public function setAttributes($attributes)
{
if (is_array($attributes)) {
- $this->graph['attributes'] = $attributes;
+ $this->graph["attributes"] = $attributes;
}
}
@@ -578,9 +578,9 @@ class Image_GraphViz
foreach ((array)$input as $k => $v) {
switch ($k) {
- case 'label':
- case 'headlabel':
- case 'taillabel':
+ case "label":
+ case "headlabel":
+ case "taillabel":
$v = $this->_escape($v, true);
break;
default:
@@ -605,22 +605,22 @@ class Image_GraphViz
protected function _escape($input, $html = false)
{
switch (strtolower($input)) {
- case 'node':
- case 'edge':
- case 'graph':
- case 'digraph':
- case 'subgraph':
- case 'strict':
+ case "node":
+ case "edge":
+ case "graph":
+ case "digraph":
+ case "subgraph":
+ case "strict":
return '"'.$input.'"';
}
if (is_bool($input)) {
- return ($input) ? 'true' : 'false';
+ return ($input) ? "true" : "false";
}
- if ($html && (strpos($input, '</') !== false
- || strpos($input, '/>') !== false)) {
- return '<'.$input.'>';
+ if ($html && (strpos($input, "</") !== false
+ || strpos($input, "/>") !== false)) {
+ return "<".$input.">";
}
if (preg_match('/^([a-z_][a-z_0-9]*|-?(\.[0-9]+|[0-9]+(\.[0-9]*)?))$/i',
@@ -636,16 +636,16 @@ class Image_GraphViz
* Sets directed/undirected flag for the graph.
*
* Note: You MUST pass a boolean, and not just an expression that evaluates
- * to TRUE or FALSE (i.e. NULL, empty string, 0 will not work)
+ * to true or false (i.e. null, empty string, 0 will not work)
*
- * @param boolean $directed Directed (TRUE) or undirected (FALSE) graph.
+ * @param boolean $directed Directed (true) or undirected (false) graph.
*
* @return void
*/
public function setDirected($directed)
{
if (is_bool($directed)) {
- $this->graph['directed'] = $directed;
+ $this->graph["directed"] = $directed;
}
}
@@ -658,7 +658,7 @@ class Image_GraphViz
*/
public function load($file)
{
- if ($serializedGraph = implode('', @file($file))) {
+ if ($serializedGraph = implode("", @file($file))) {
$g = unserialize($serializedGraph);
if (!is_array($g)) {
@@ -666,29 +666,29 @@ class Image_GraphViz
}
// Convert old storage format to new one
- $defaults = array('edgesFrom' => array(),
- 'nodes' => array(),
- 'attributes' => array(),
- 'directed' => true,
- 'clusters' => array(),
- 'subgraphs' => array(),
- 'name' => 'G',
- 'strict' => true,
+ $defaults = array("edgesFrom" => array(),
+ "nodes" => array(),
+ "attributes" => array(),
+ "directed" => true,
+ "clusters" => array(),
+ "subgraphs" => array(),
+ "name" => "G",
+ "strict" => true,
);
$this->graph = array_merge($defaults, $g);
- if (isset($this->graph['edges'])) {
- foreach ($this->graph['edges'] as $id => $nodes) {
- $attr = (isset($this->graph['edgeAttributes'][$id]))
- ? $this->graph['edgeAttributes'][$id]
+ if (isset($this->graph["edges"])) {
+ foreach ($this->graph["edges"] as $id => $nodes) {
+ $attr = (isset($this->graph["edgeAttributes"][$id]))
+ ? $this->graph["edgeAttributes"][$id]
: array();
$this->addEdge($nodes, $attr);
}
- unset($this->graph['edges']);
- unset($this->graph['edgeAttributes']);
+ unset($this->graph["edges"]);
+ unset($this->graph["edgeAttributes"]);
}
}
}
@@ -701,18 +701,18 @@ class Image_GraphViz
*
* @param string $file File to save the graph to.
*
- * @return string File the graph was saved to, FALSE or PEAR_Error on
+ * @return string File the graph was saved to, false or PEAR_Error on
* failure.
*/
- public function save($file = '')
+ public function save($file = "")
{
$serializedGraph = serialize($this->graph);
if (empty($file)) {
- $file = System::mktemp('graph_');
+ $file = System::mktemp("graph_");
}
- if ($fp = @fopen($file, 'wb')) {
+ if ($fp = @fopen($file, "wb")) {
@fputs($fp, $serializedGraph);
@fclose($fp);
@@ -722,7 +722,7 @@ class Image_GraphViz
if ($this->_returnFalseOnError) {
return false;
}
- $error = PEAR::raiseError('Could not save serialized graph instance');
+ $error = PEAR::raiseError("Could not save serialized graph instance");
return $error;
}
@@ -736,13 +736,13 @@ class Image_GraphViz
protected function _getSubgraphs($parent)
{
$subgraphs = array();
- foreach ($this->graph['clusters'] as $id => $info) {
- if ($info['embedIn'] === $parent) {
+ foreach ($this->graph["clusters"] as $id => $info) {
+ if ($info["embedIn"] === $parent) {
$subgraphs[] = $id;
}
}
- foreach ($this->graph['subgraphs'] as $id => $info) {
- if ($info['embedIn'] === $parent) {
+ foreach ($this->graph["subgraphs"] as $id => $info) {
+ if ($info["embedIn"] === $parent) {
$subgraphs[] = $id;
}
}
@@ -756,8 +756,8 @@ class Image_GraphViz
*/
protected function _getGroups()
{
- $groups = array_merge(array_keys($this->graph['clusters']),
- array_keys($this->graph['subgraphs']));
+ $groups = array_merge(array_keys($this->graph["clusters"]),
+ array_keys($this->graph["subgraphs"]));
return array_unique($groups);
}
@@ -772,13 +772,13 @@ class Image_GraphViz
$groups = $this->_getGroups();
foreach ($groups as $id) {
- $isTop = ($id === 'default');
- if (isset($this->graph['clusters'][$id])
- && $this->graph['clusters'][$id]['embedIn'] === 'default') {
+ $isTop = ($id === "default");
+ if (isset($this->graph["clusters"][$id])
+ && $this->graph["clusters"][$id]["embedIn"] === "default") {
$isTop = true;
}
- if (isset($this->graph['subgraphs'][$id])
- && $this->graph['subgraphs'][$id]['embedIn'] === 'default') {
+ if (isset($this->graph["subgraphs"][$id])
+ && $this->graph["subgraphs"][$id]["embedIn"] === "default") {
$isTop = true;
}
if ($isTop) {
@@ -796,20 +796,20 @@ class Image_GraphViz
*/
public function parse()
{
- $parsedGraph = (empty($this->graph['strict'])) ? '' : 'strict ';
- $parsedGraph .= (empty($this->graph['directed'])) ? 'graph ' : 'digraph ';
- $parsedGraph .= $this->_escape($this->graph['name'])." {\n";
+ $parsedGraph = (empty($this->graph["strict"])) ? "" : "strict ";
+ $parsedGraph .= (empty($this->graph["directed"])) ? "graph " : "digraph ";
+ $parsedGraph .= $this->_escape($this->graph["name"])." {\n";
- $indent = ' ';
+ $indent = " ";
- $attr = $this->_escapeArray($this->graph['attributes']);
+ $attr = $this->_escapeArray($this->graph["attributes"]);
foreach ($attr as $key => $value) {
- $parsedGraph .= $indent.$key.'='.$value.";\n";
+ $parsedGraph .= $indent.$key."=".$value.";\n";
}
$groups = $this->_getGroups();
- foreach ($this->graph['nodes'] as $group => $nodes) {
+ foreach ($this->graph["nodes"] as $group => $nodes) {
if (!in_array($group, $groups)) {
$parsedGraph .= $this->_nodes($nodes, $indent);
}
@@ -819,13 +819,13 @@ class Image_GraphViz
$parsedGraph .= $this->_subgraph($group, $indent);
}
- if (!empty($this->graph['directed'])) {
- $separator = ' -> ';
+ if (!empty($this->graph["directed"])) {
+ $separator = " -> ";
} else {
- $separator = ' -- ';
+ $separator = " -- ";
}
- foreach ($this->graph['edgesFrom'] as $from => $toNodes) {
+ foreach ($this->graph["edgesFrom"] as $from => $toNodes) {
$from = $this->_escape($from);
foreach ($toNodes as $to => $edges) {
@@ -835,32 +835,32 @@ class Image_GraphViz
$f = $from;
$t = $to;
- if (array_key_exists('portFrom', $info)) {
- $f .= ':'.$this->_escape($info['portFrom']);
+ if (array_key_exists("portFrom", $info)) {
+ $f .= ":".$this->_escape($info["portFrom"]);
}
- if (array_key_exists('portTo', $info)) {
- $t .= ':'.$this->_escape($info['portTo']);
+ if (array_key_exists("portTo", $info)) {
+ $t .= ":".$this->_escape($info["portTo"]);
}
$parsedGraph .= $indent.$f.$separator.$t;
- if (!empty($info['attributes'])) {
+ if (!empty($info["attributes"])) {
$attributeList = array();
- foreach ($this->_escapeArray($info['attributes']) as $key => $value) {
+ foreach ($this->_escapeArray($info["attributes"]) as $key => $value) {
switch ($key) {
- case 'lhead':
- case 'ltail':
- if (strncasecmp($value, 'cluster', 7)) {
- $value = 'cluster_'.$value;
+ case "lhead":
+ case "ltail":
+ if (strncasecmp($value, "cluster", 7)) {
+ $value = "cluster_".$value;
}
break;
}
- $attributeList[] = $key.'='.$value;
+ $attributeList[] = $key."=".$value;
}
- $parsedGraph .= ' [ '.implode(',', $attributeList).' ]';
+ $parsedGraph .= " [ ".implode(",", $attributeList)." ]";
}
$parsedGraph .= ";\n";
@@ -881,18 +881,18 @@ class Image_GraphViz
*/
protected function _nodes($nodes, $indent)
{
- $parsedGraph = '';
+ $parsedGraph = "";
foreach ($nodes as $node => $attributes) {
$parsedGraph .= $indent.$this->_escape($node);
$attributeList = array();
foreach ($this->_escapeArray($attributes) as $key => $value) {
- $attributeList[] = $key.'='.$value;
+ $attributeList[] = $key."=".$value;
}
if (!empty($attributeList)) {
- $parsedGraph .= ' [ '.implode(',', $attributeList).' ]';
+ $parsedGraph .= " [ ".implode(",", $attributeList)." ]";
}
$parsedGraph .= ";\n";
@@ -907,41 +907,41 @@ class Image_GraphViz
*/
protected function _subgraph($group, &$indent)
{
- $parsedGraph = '';
- $nodes = $this->graph['nodes'][$group];
+ $parsedGraph = "";
+ $nodes = $this->graph["nodes"][$group];
- if ($group !== 'default') {
+ if ($group !== "default") {
$type = null;
$_group = $this->_escape($group);
- if (isset($this->graph['clusters'][$group])) {
- $type = 'clusters';
- if (strncasecmp($group, 'cluster', 7)) {
- $_group = $this->_escape('cluster_'.$group);
+ if (isset($this->graph["clusters"][$group])) {
+ $type = "clusters";
+ if (strncasecmp($group, "cluster", 7)) {
+ $_group = $this->_escape("cluster_".$group);
}
- } elseif (isset($this->graph['subgraphs'][$group])) {
- $type = 'subgraphs';
+ } elseif (isset($this->graph["subgraphs"][$group])) {
+ $type = "subgraphs";
}
- $parsedGraph .= $indent.'subgraph '.$_group." {\n";
+ $parsedGraph .= $indent."subgraph ".$_group." {\n";
- $indent .= ' ';
+ $indent .= " ";
if ($type !== null && isset($this->graph[$type][$group])) {
$cluster = $this->graph[$type][$group];
- $_attr = $this->_escapeArray($cluster['attributes']);
+ $_attr = $this->_escapeArray($cluster["attributes"]);
$attr = array();
foreach ($_attr as $key => $value) {
- $attr[] = $key.'='.$value;
+ $attr[] = $key."=".$value;
}
- if (strlen($cluster['title'])) {
- $attr[] = 'label='
- .$this->_escape($cluster['title'], true);
+ if (strlen($cluster["title"])) {
+ $attr[] = "label="
+ .$this->_escape($cluster["title"], true);
}
if ($attr) {
- $parsedGraph .= $indent.'graph [ '.implode(',', $attr)
+ $parsedGraph .= $indent."graph [ ".implode(",", $attr)
." ];\n";
}
}
@@ -953,7 +953,7 @@ class Image_GraphViz
$parsedGraph .= $this->_subgraph($_group, $indent);
}
- if ($group !== 'default') {
+ if ($group !== "default") {
$indent = substr($indent, 0, -4);
$parsedGraph .= $indent."}\n";
@@ -967,19 +967,19 @@ class Image_GraphViz
*
* @param string $file File to write the GraphViz markup to.
*
- * @return string File to which the GraphViz markup was written, FALSE or
+ * @return string File to which the GraphViz markup was written, false or
* or PEAR_Error on failure.
*/
- public function saveParsedGraph($file = '')
+ public function saveParsedGraph($file = "")
{
$parsedGraph = $this->parse();
if (!empty($parsedGraph)) {
if (empty($file)) {
- $file = System::mktemp('graph_');
+ $file = System::mktemp("graph_");
}
- if ($fp = @fopen($file, 'wb')) {
+ if ($fp = @fopen($file, "wb")) {
@fputs($fp, $parsedGraph);
@fclose($fp);
@@ -990,7 +990,7 @@ class Image_GraphViz
if ($this->_returnFalseOnError) {
return false;
}
- $error = PEAR::raiseError('Could not save graph');
+ $error = PEAR::raiseError("Could not save graph");
return $error;
}
}
diff --git a/includes/pear/PEAR.php b/includes/pear/PEAR.php
index 48830fd..cecad01 100644
--- a/includes/pear/PEAR.php
+++ b/includes/pear/PEAR.php
@@ -458,7 +458,7 @@ class PEAR
* @see PEAR::setErrorHandling
* @since PHP 4.0.5
*/
- public function &raiseError($message = null,
+ static public function &raiseError($message = null,
$code = null,
$mode = null,
$options = null,
@@ -475,7 +475,7 @@ class PEAR
$message = $message->getMessage();
}
- if (
+/* if (
isset($this) &&
isset($this->_expected_errors) &&
count($this->_expected_errors) > 0 &&
@@ -488,15 +488,16 @@ class PEAR
$mode = PEAR_ERROR_RETURN;
}
}
-
+*/
// No mode given, try global ones
if ($mode === null) {
// Class error handler
- if (isset($this) && isset($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
+// if (isset($this) && isset($this->_default_error_mode)) {
+// $mode = $this->_default_error_mode;
+// $options = $this->_default_error_options;
// Global error handler
- } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
+// } else
+ if (isset($GLOBALS['_PEAR_default_error_mode'])) {
$mode = $GLOBALS['_PEAR_default_error_mode'];
$options = $GLOBALS['_PEAR_default_error_options'];
}
@@ -504,23 +505,20 @@ class PEAR
if ($error_class !== null) {
$ec = $error_class;
- } elseif (isset($this) && isset($this->_error_class)) {
- $ec = $this->_error_class;
+// } elseif ( isset($this) && isset($this->_error_class) ) {
+// $ec = $this->_error_class;
} else {
$ec = 'PEAR_Error';
}
- if (intval(PHP_VERSION) < 5) {
+//PHP5 is long gone ...
+/* if (intval(PHP_VERSION) < 5) {
// little non-eval hack to fix bug #12147
include 'PEAR/FixPHP5PEARWarnings.php';
return $a;
}
-
- if ($skipmsg) {
- $a = new $ec($code, $mode, $options, $userinfo);
- } else {
- $a = new $ec($message, $code, $mode, $options, $userinfo);
- }
+*/
+ $a = ( $skipmsg ) ? new $ec( $code, $mode, $options, $userinfo ) : new $ec( $message, $code, $mode, $options, $userinfo );
return $a;
}
@@ -725,11 +723,9 @@ function _PEAR_call_destructors()
sizeof($_PEAR_destructor_object_list))
{
reset($_PEAR_destructor_object_list);
- if (PEAR_ZE2) {
- $destructLifoExists = PEAR5::getStaticProperty('PEAR', 'destructlifo');
- } else {
- $destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
- }
+ $destructLifoExists = ( PEAR_ZE2 )
+ ? PEAR5::getStaticProperty( 'PEAR', 'destructlifo' )
+ : PEAR::getStaticProperty( 'PEAR', 'destructlifo' );
if ($destructLifoExists) {
$_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
@@ -783,13 +779,14 @@ function _PEAR_call_destructors()
*/
class PEAR_Error
{
- var $error_message_prefix = '';
- var $mode = PEAR_ERROR_RETURN;
- var $level = E_USER_NOTICE;
- var $code = -1;
- var $message = '';
- var $userinfo = '';
- var $backtrace = null;
+ public $error_message_prefix = '';
+ public $mode = PEAR_ERROR_RETURN;
+ public $level = E_USER_NOTICE;
+ public $code = -1;
+ public $message = '';
+ public $userinfo = '';
+ public $backtrace = null;
+ public $callback;
/**
* PEAR_Error constructor
@@ -820,11 +817,9 @@ class PEAR_Error
$this->mode = $mode;
$this->userinfo = $userinfo;
- if (PEAR_ZE2) {
- $skiptrace = PEAR5::getStaticProperty('PEAR_Error', 'skiptrace');
- } else {
- $skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
- }
+ $skiptrace = ( PEAR_ZE2 )
+ ? PEAR5::getStaticProperty( 'PEAR_Error', 'skiptrace' )
+ : PEAR::getStaticProperty( 'PEAR_Error', 'skiptrace' );
if (!$skiptrace) {
$this->backtrace = debug_backtrace();
@@ -846,11 +841,7 @@ class PEAR_Error
}
if ($this->mode & PEAR_ERROR_PRINT) {
- if (is_null($options) || is_int($options)) {
- $format = "%s";
- } else {
- $format = $options;
- }
+ $format = ( $options === null || is_int( $options ) ) ? "%s" : $options;
printf($format, $this->getMessage());
}
@@ -957,7 +948,7 @@ class PEAR_Error
* Supported with PHP 4.3.0 or newer.
*
* @param int $frame (optional) what frame to fetch
- * @return array Backtrace, or NULL if not available.
+ * @return array|null Backtrace, or NULL if not available.
*/
public function getBacktrace($frame = null)
{
@@ -991,19 +982,18 @@ class PEAR_Error
*/
public function toString()
{
- $modes = array();
- $levels = array(E_USER_NOTICE => 'notice',
- E_USER_WARNING => 'warning',
- E_USER_ERROR => 'error');
+ $modes = [];
+ $levels = [
+ E_USER_NOTICE => 'notice',
+ E_USER_WARNING => 'warning',
+ E_USER_ERROR => 'error',
+ ];
if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_array($this->callback)) {
- $callback = (is_object($this->callback[0]) ?
- strtolower(get_class($this->callback[0])) :
- $this->callback[0]) . '::' .
- $this->callback[1];
- } else {
- $callback = $this->callback;
- }
+ $callback = ( is_array( $this->callback ) )
+ ? ( is_object( $this->callback[0] )
+ ? Strtolower( get_class( $this->callback[0] ) )
+ : $this->callback[0] ) . '::' . $this->callback[1]
+ : $this->callback;
return sprintf('[%s: message="%s" code=%d mode=callback '.
'callback=%s prefix="%s" info="%s"]',
strtolower(get_class($this)), $this->message, $this->code,
diff --git a/includes/pear/System.php b/includes/pear/System.php
index ee4525e..939e1dd 100755
--- a/includes/pear/System.php
+++ b/includes/pear/System.php
@@ -16,10 +16,10 @@
/**
* base class
*/
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
+require_once "PEAR.php";
+require_once "Console/Getopt.php";
-$GLOBALS['_System_temp_files'] = array();
+$GLOBALS["_System_temp_files"] = array();
/**
* System offers cross platform compatible system functions
@@ -60,7 +60,7 @@ class System
/**
* returns the commandline arguments of a function
*
- * @param string $argv the commandline
+ * @param array $argv the commandline
* @param string $short_options the allowed option short-tags
* @param string $long_options the allowed option long-tags
* @return array the given options and there values
@@ -140,7 +140,7 @@ class System
*/
protected static function _dirToStruct($sPath, $maxinst, $aktinst = 0, $silent = false)
{
- $struct = array('dirs' => array(), 'files' => array());
+ $struct = array("dirs" => array(), "files" => array());
if (($dir = @opendir($sPath)) === false) {
if (!$silent) {
System::raiseError("Could not open dir $sPath");
@@ -148,10 +148,10 @@ class System
return $struct; // XXX could not open error
}
- $struct['dirs'][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ?
+ $struct["dirs"][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ?
$list = array();
while (false !== ($file = readdir($dir))) {
- if ($file != '.' && $file != '..') {
+ if ($file != "." && $file != "..") {
$list[] = $file;
}
}
@@ -165,7 +165,7 @@ class System
$tmp = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent);
$struct = array_merge_recursive($struct, $tmp);
} else {
- $struct['files'][] = $path;
+ $struct["files"][] = $path;
}
}
}
@@ -183,15 +183,15 @@ class System
*/
protected static function _multipleToStruct($files)
{
- $struct = array('dirs' => array(), 'files' => array());
- settype($files, 'array');
+ $struct = array("dirs" => array(), "files" => array());
+ settype($files, "array");
foreach ($files as $file) {
if (is_dir($file) && !is_link($file)) {
$tmp = System::_dirToStruct($file, 0);
$struct = array_merge_recursive($tmp, $struct);
} else {
- if (!in_array($file, $struct['files'])) {
- $struct['files'][] = $file;
+ if (!in_array($file, $struct["files"])) {
+ $struct["files"][] = $file;
}
}
}
@@ -202,40 +202,40 @@ class System
* The rm command for removing files.
* Supports multiple files and dirs and also recursive deletes
*
- * @param string $args the arguments for rm
+ * @param array $args the arguments for rm
* @return mixed PEAR_Error or true for success
* @static
* @access public
*/
public static function rm($args)
{
- $opts = System::_parseArgs($args, 'rf'); // "f" does nothing but I like it :-)
+ $opts = System::_parseArgs($args, "rf"); // "f" does nothing but I like it :-)
if (PEAR::isError($opts)) {
return System::raiseError($opts);
}
foreach ($opts[0] as $opt) {
- if ($opt[0] == 'r') {
+ if ($opt[0] == "r") {
$do_recursive = true;
}
}
$ret = true;
if (isset($do_recursive)) {
$struct = System::_multipleToStruct($opts[1]);
- foreach ($struct['files'] as $file) {
- if (!@unlink($file)) {
+ foreach ($struct["files"] as $file) {
+ if ( file_exists($file) && !unlink($file) ) {
$ret = false;
}
}
- rsort($struct['dirs']);
- foreach ($struct['dirs'] as $dir) {
+ rsort($struct["dirs"]);
+ foreach ($struct["dirs"] as $dir) {
if (!@rmdir($dir)) {
$ret = false;
}
}
} else {
foreach ($opts[1] as $file) {
- $delete = (is_dir($file)) ? 'rmdir' : 'unlink';
+ $delete = (is_dir($file)) ? "rmdir" : "unlink";
if (!@$delete($file)) {
$ret = false;
}
@@ -248,24 +248,24 @@ class System
* Make directories.
*
* The -p option will create parent directories
- * @param string $args the name of the director(y|ies) to create
+ * @param array $args the name of the director(y|ies) to create
* @return bool True for success
*/
public static function mkDir($args)
{
- $opts = System::_parseArgs($args, 'pm:');
+ $opts = System::_parseArgs($args, "pm:");
if (PEAR::isError($opts)) {
return System::raiseError($opts);
}
$mode = 0777; // default mode
foreach ($opts[0] as $opt) {
- if ($opt[0] == 'p') {
+ if ($opt[0] == "p") {
$create_parents = true;
- } elseif ($opt[0] == 'm') {
+ } elseif ($opt[0] == "m") {
// if the mode is clearly an octal number (starts with 0)
// convert it to decimal
- if (strlen($opt[1]) && $opt[1][0] == '0') {
+ if (strlen($opt[1]) && $opt[1][0] == "0") {
$opt[1] = octdec($opt[1]);
} else {
// convert to int
@@ -330,12 +330,12 @@ class System
$count_args = count($args);
for ($i = 0; $i < $count_args; $i++) {
- if ($args[$i] == '>') {
- $mode = 'wb';
+ if ($args[$i] == ">") {
+ $mode = "wb";
$outputfile = $args[$i+1];
break;
- } elseif ($args[$i] == '>>') {
- $mode = 'ab+';
+ } elseif ($args[$i] == ">>") {
+ $mode = "ab+";
$outputfile = $args[$i+1];
break;
} else {
@@ -351,7 +351,7 @@ class System
$ret = true;
}
foreach ($files as $file) {
- if (!$fd = fopen($file, 'r')) {
+ if (!$fd = fopen($file, "r")) {
System::raiseError("Could not open $file");
continue;
}
@@ -388,32 +388,32 @@ class System
* TMPDIR in Unix will be used. If these vars are also missing
* c:\windows\temp or /tmp will be used.
*
- * @param string $args The arguments
+ * @param array $args The arguments
* @return mixed the full path of the created (file|dir) or false
* @see System::tmpdir()
*/
public static function mktemp($args = null)
{
static $first_time = true;
- $opts = System::_parseArgs($args, 't:d');
+ $opts = System::_parseArgs($args, "t:d");
if (PEAR::isError($opts)) {
return System::raiseError($opts);
}
foreach ($opts[0] as $opt) {
- if ($opt[0] == 'd') {
+ if ($opt[0] == "d") {
$tmp_is_dir = true;
- } elseif ($opt[0] == 't') {
+ } elseif ($opt[0] == "t") {
$tmpdir = $opt[1];
}
}
- $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
+ $prefix = (isset($opts[1][0])) ? $opts[1][0] : "tmp";
if (!isset($tmpdir)) {
$tmpdir = System::tmpdir();
}
- if (!System::mkDir(array('-p', $tmpdir))) {
+ if (!System::mkDir(array("-p", $tmpdir))) {
return false;
}
@@ -425,13 +425,13 @@ class System
}
}
- $GLOBALS['_System_temp_files'][] = $tmp;
+ $GLOBALS["_System_temp_files"][] = $tmp;
if (isset($tmp_is_dir)) {
//$GLOBALS['_System_temp_files'][] = dirname($tmp);
}
if ($first_time) {
- PEAR::registerShutdownFunc(array('System', '_removeTmpFiles'));
+ PEAR::registerShutdownFunc(array("System", "_removeTmpFiles"));
$first_time = false;
}
@@ -444,11 +444,11 @@ class System
*/
public static function _removeTmpFiles()
{
- if (count($GLOBALS['_System_temp_files'])) {
- $delete = $GLOBALS['_System_temp_files'];
- array_unshift($delete, '-r');
+ if (count($GLOBALS["_System_temp_files"])) {
+ $delete = $GLOBALS["_System_temp_files"];
+ array_unshift($delete, "-r");
System::rm($delete);
- $GLOBALS['_System_temp_files'] = array();
+ $GLOBALS["_System_temp_files"] = array();
}
}
@@ -463,24 +463,24 @@ class System
public static function tmpdir()
{
if (OS_WINDOWS) {
- if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
+ if ($var = isset($_ENV["TMP"]) ? $_ENV["TMP"] : getenv("TMP")) {
return $var;
}
- if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
+ if ($var = isset($_ENV["TEMP"]) ? $_ENV["TEMP"] : getenv("TEMP")) {
return $var;
}
- if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
+ if ($var = isset($_ENV["USERPROFILE"]) ? $_ENV["USERPROFILE"] : getenv("USERPROFILE")) {
return $var;
}
- if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
+ if ($var = isset($_ENV["windir"]) ? $_ENV["windir"] : getenv("windir")) {
return $var;
}
- return getenv('SystemRoot') . '\temp';
+ return getenv("SystemRoot") . '\temp';
}
- if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
+ if ($var = isset($_ENV["TMPDIR"]) ? $_ENV["TMPDIR"] : getenv("TMPDIR")) {
return $var;
}
- return realpath(function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp');
+ return realpath(function_exists("sys_get_temp_dir") ? sys_get_temp_dir() : "/tmp");
}
/**
@@ -495,7 +495,7 @@ class System
public static function which($program, $fallback = false)
{
// enforce API
- if (!is_string($program) || '' == $program) {
+ if (!is_string($program) || "" == $program) {
return $fallback;
}
@@ -504,24 +504,24 @@ class System
$path_elements[] = dirname($program);
$program = basename($program);
} else {
- $path = getenv('PATH');
+ $path = getenv("PATH");
if (!$path) {
- $path = getenv('Path'); // some OSes are just stupid enough to do this
+ $path = getenv("Path"); // some OSes are just stupid enough to do this
}
$path_elements = explode(PATH_SEPARATOR, $path);
}
if (OS_WINDOWS) {
- $exe_suffixes = getenv('PATHEXT')
- ? explode(PATH_SEPARATOR, getenv('PATHEXT'))
- : array('.exe','.bat','.cmd','.com');
+ $exe_suffixes = getenv("PATHEXT")
+ ? explode(PATH_SEPARATOR, getenv("PATHEXT"))
+ : array(".exe",".bat",".cmd",".com");
// allow passing a command.exe param
- if (strpos($program, '.') !== false) {
- array_unshift($exe_suffixes, '');
+ if (strpos($program, ".") !== false) {
+ array_unshift($exe_suffixes, "");
}
} else {
- $exe_suffixes = array('');
+ $exe_suffixes = array("");
}
foreach ($exe_suffixes as $suff) {
@@ -580,9 +580,9 @@ class System
$args_count = count($args);
for ($i = 0; $i < $args_count; $i++) {
switch ($args[$i]) {
- case '-type':
- if (in_array($args[$i+1], array('d', 'f'))) {
- if ($args[$i+1] == 'd') {
+ case "-type":
+ if (in_array($args[$i+1], array("d", "f"))) {
+ if ($args[$i+1] == "d") {
$do_files = false;
} else {
$do_dirs = false;
@@ -590,30 +590,30 @@ class System
}
$i++;
break;
- case '-name':
- $name = preg_quote($args[$i+1], '#');
+ case "-name":
+ $name = preg_quote($args[$i+1], "#");
// our magic characters ? and * have just been escaped,
// so now we change the escaped versions to PCRE operators
- $name = strtr($name, array('\?' => '.', '\*' => '.*'));
- $patterns[] = '('.$name.')';
+ $name = strtr($name, array('\?' => ".", '\*' => ".*"));
+ $patterns[] = "(".$name.")";
$i++;
break;
- case '-maxdepth':
+ case "-maxdepth":
$depth = $args[$i+1];
break;
}
}
$path = System::_dirToStruct($dir, $depth, 0, true);
if ($do_files && $do_dirs) {
- $files = array_merge($path['files'], $path['dirs']);
+ $files = array_merge($path["files"], $path["dirs"]);
} elseif ($do_dirs) {
- $files = $path['dirs'];
+ $files = $path["dirs"];
} else {
- $files = $path['files'];
+ $files = $path["files"];
}
if (count($patterns)) {
- $dsq = preg_quote(DIRECTORY_SEPARATOR, '#');
- $pattern = '#(^|'.$dsq.')'.implode('|', $patterns).'($|'.$dsq.')#';
+ $dsq = preg_quote(DIRECTORY_SEPARATOR, "#");
+ $pattern = "#(^|".$dsq.")".implode("|", $patterns)."($|".$dsq.")#";
$ret = array();
$files_count = count($files);
for ($i = 0; $i < $files_count; $i++) {
diff --git a/includes/pear/Text/Diff.php b/includes/pear/Text/Diff.php
index 4b3de1b..3b8d883 100644..100755
--- a/includes/pear/Text/Diff.php
+++ b/includes/pear/Text/Diff.php
@@ -35,25 +35,28 @@ class Text_Diff {
* Normally an array of two arrays, each
* containing the lines from a file.
*/
- function Text_Diff($engine, $params)
+ function __construct($engine, $params)
{
// Backward compatibility workaround.
if (!is_string($engine)) {
$params = array($engine, $params);
- $engine = 'auto';
+ $engine = "auto";
}
- if ($engine == 'auto') {
- $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
+ if ($engine == "auto") {
+ $engine = extension_loaded("xdiff") ? "xdiff" : "native";
} else {
$engine = basename($engine);
}
- require_once 'Text/Diff/Engine/' . $engine . '.php';
- $class = 'Text_Diff_Engine_' . $engine;
+ $class = "Text_Diff_Engine_" . $engine;
+ if (!class_exists($class)) {
+ require_once "Text/Diff/Engine/" . $engine . ".php";
+ }
+
$diff_engine = new $class();
- $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
+ $this->_edits = call_user_func_array(array($diff_engine, "diff"), $params);
}
/**
@@ -63,7 +66,7 @@ class Text_Diff {
{
return $this->_edits;
}
-
+
/**
* returns the number of new (added) lines in a given diff.
*
@@ -76,14 +79,14 @@ class Text_Diff {
{
$count = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_add') ||
- is_a($edit, 'Text_Diff_Op_change')) {
+ if (is_a($edit, "Text_Diff_Op_add") ||
+ is_a($edit, "Text_Diff_Op_change")) {
$count += $edit->nfinal();
}
}
return $count;
}
-
+
/**
* Returns the number of deleted (removed) lines in a given diff.
*
@@ -96,8 +99,8 @@ class Text_Diff {
{
$count = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_delete') ||
- is_a($edit, 'Text_Diff_Op_change')) {
+ if (is_a($edit, "Text_Diff_Op_delete") ||
+ is_a($edit, "Text_Diff_Op_change")) {
$count += $edit->norig();
}
}
@@ -120,7 +123,7 @@ class Text_Diff {
*/
function reverse()
{
- if (version_compare(zend_version(), '2', '>')) {
+ if (version_compare(zend_version(), "2", ">")) {
$rev = clone($this);
} else {
$rev = $this;
@@ -140,7 +143,7 @@ class Text_Diff {
function isEmpty()
{
foreach ($this->_edits as $edit) {
- if (!is_a($edit, 'Text_Diff_Op_copy')) {
+ if (!is_a($edit, "Text_Diff_Op_copy")) {
return false;
}
}
@@ -158,7 +161,7 @@ class Text_Diff {
{
$lcs = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_copy')) {
+ if (is_a($edit, "Text_Diff_Op_copy")) {
$lcs += count($edit->orig);
}
}
@@ -208,32 +211,30 @@ class Text_Diff {
* @param string $line The line to trim.
* @param integer $key The index of the line in the array. Not used.
*/
- function trimNewlines(&$line, $key)
+ static function trimNewlines(&$line, $key)
{
- $line = str_replace(array("\n", "\r"), '', $line);
+ $line = str_replace(array("\n", "\r"), "", $line);
}
/**
* Determines the location of the system temporary directory.
*
- * @static
- *
* @access protected
*
* @return string A directory name which can be used for temp files.
* Returns false if one could not be found.
*/
- function _getTempDir()
+ static function _getTempDir()
{
- $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
+ $tmp_locations = array("/tmp", "/var/tmp", 'c:\WUTemp', 'c:\temp',
'c:\windows\temp', 'c:\winnt\temp');
/* Try PHP's upload_tmp_dir directive. */
- $tmp = ini_get('upload_tmp_dir');
+ $tmp = ini_get("upload_tmp_dir");
/* Otherwise, try to determine the TMPDIR environment variable. */
if (!strlen($tmp)) {
- $tmp = getenv('TMPDIR');
+ $tmp = getenv("TMPDIR");
}
/* If we still cannot determine a value, then cycle through a list of
@@ -307,13 +308,13 @@ class Text_MappedDiff extends Text_Diff {
* @param array $mapped_to_lines This array should have the same number
* of elements as $to_lines.
*/
- function Text_MappedDiff($from_lines, $to_lines,
+ function __construct($from_lines, $to_lines,
$mapped_from_lines, $mapped_to_lines)
{
assert(count($from_lines) == count($mapped_from_lines));
assert(count($to_lines) == count($mapped_to_lines));
- parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
+ parent::__construct($mapped_from_lines, $mapped_to_lines);
$xi = $yi = 0;
for ($i = 0; $i < count($this->_edits); $i++) {
@@ -346,7 +347,7 @@ class Text_Diff_Op {
function &reverse()
{
- trigger_error('Abstract method', E_USER_ERROR);
+ trigger_error("Abstract method", E_USER_ERROR);
}
function norig()
@@ -369,7 +370,7 @@ class Text_Diff_Op {
*/
class Text_Diff_Op_copy extends Text_Diff_Op {
- function Text_Diff_Op_copy($orig, $final = false)
+ function __construct($orig, $final = false)
{
if (!is_array($final)) {
$final = $orig;
@@ -380,7 +381,7 @@ class Text_Diff_Op_copy extends Text_Diff_Op {
function &reverse()
{
- $reverse = &new Text_Diff_Op_copy($this->final, $this->orig);
+ $reverse = new Text_Diff_Op_copy($this->final, $this->orig);
return $reverse;
}
@@ -394,7 +395,7 @@ class Text_Diff_Op_copy extends Text_Diff_Op {
*/
class Text_Diff_Op_delete extends Text_Diff_Op {
- function Text_Diff_Op_delete($lines)
+ function __construct($lines)
{
$this->orig = $lines;
$this->final = false;
@@ -402,7 +403,7 @@ class Text_Diff_Op_delete extends Text_Diff_Op {
function &reverse()
{
- $reverse = &new Text_Diff_Op_add($this->orig);
+ $reverse = new Text_Diff_Op_add($this->orig);
return $reverse;
}
@@ -416,7 +417,7 @@ class Text_Diff_Op_delete extends Text_Diff_Op {
*/
class Text_Diff_Op_add extends Text_Diff_Op {
- function Text_Diff_Op_add($lines)
+ function __construct($lines)
{
$this->final = $lines;
$this->orig = false;
@@ -424,7 +425,7 @@ class Text_Diff_Op_add extends Text_Diff_Op {
function &reverse()
{
- $reverse = &new Text_Diff_Op_delete($this->final);
+ $reverse = new Text_Diff_Op_delete($this->final);
return $reverse;
}
@@ -438,7 +439,7 @@ class Text_Diff_Op_add extends Text_Diff_Op {
*/
class Text_Diff_Op_change extends Text_Diff_Op {
- function Text_Diff_Op_change($orig, $final)
+ function __construct($orig, $final)
{
$this->orig = $orig;
$this->final = $final;
@@ -446,7 +447,7 @@ class Text_Diff_Op_change extends Text_Diff_Op {
function &reverse()
{
- $reverse = &new Text_Diff_Op_change($this->final, $this->orig);
+ $reverse = new Text_Diff_Op_change($this->final, $this->orig);
return $reverse;
}
diff --git a/includes/pear/Text/Diff/Engine/native.php b/includes/pear/Text/Diff/Engine/native.php
index 84168c0..132ea29 100644..100755
--- a/includes/pear/Text/Diff/Engine/native.php
+++ b/includes/pear/Text/Diff/Engine/native.php
@@ -6,9 +6,9 @@
*
* The algorithm used here is mostly lifted from the perl module
* Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
- * http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
+ * https://cpan.metacpan.org/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
*
- * More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html
+ * More ideas are taken from: https://www.ics.uci.edu/~eppstein/161/960229.html
*
* Some ideas (and a bit of code) are taken from analyze.c, of GNU
* diffutils-2.7, which can be found at:
@@ -20,20 +20,31 @@
*
* $Horde: framework/Text_Diff/Diff/Engine/native.php,v 1.7.2.5 2009/01/06 15:23:41 jan Exp $
*
- * Copyright 2004-2009 The Horde Project (http://www.horde.org/)
+ * Copyright 2004-2009 The Horde Project (https://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you did
- * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ * not receive this file, see https://opensource.org/license/lgpl-3-0/ .
*
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
* @package Text_Diff
*/
-class Text_Diff_Engine_native {
+class Text_Diff_Engine_native
+{
+
+ public $xchanged;
+ public $ychanged;
+ public $xv;
+ public $yv;
+ public $xind;
+ public $yind;
+ public $seq;
+ public $in_seq;
+ public $lcs;
function diff($from_lines, $to_lines)
{
- array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
- array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
+ array_walk($from_lines, array("Text_Diff", "trimNewlines"));
+ array_walk($to_lines, array("Text_Diff", "trimNewlines"));
$n_from = count($from_lines);
$n_to = count($to_lines);
@@ -63,9 +74,11 @@ class Text_Diff_Engine_native {
}
// Ignore lines which do not exist in both files.
+ $xhash = [];
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
$xhash[$from_lines[$xi]] = 1;
}
+ $yhash = [];
for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
$line = $to_lines[$yi];
if (($this->ychanged[$yi] = empty($xhash[$line]))) {
@@ -106,7 +119,7 @@ class Text_Diff_Engine_native {
++$yi;
}
if ($copy) {
- $edits[] = &new Text_Diff_Op_copy($copy);
+ $edits[] = new Text_Diff_Op_copy($copy);
}
// Find deletes & adds.
@@ -121,11 +134,11 @@ class Text_Diff_Engine_native {
}
if ($delete && $add) {
- $edits[] = &new Text_Diff_Op_change($delete, $add);
+ $edits[] = new Text_Diff_Op_change($delete, $add);
} elseif ($delete) {
- $edits[] = &new Text_Diff_Op_delete($delete);
+ $edits[] = new Text_Diff_Op_delete($delete);
} elseif ($add) {
- $edits[] = &new Text_Diff_Op_add($add);
+ $edits[] = new Text_Diff_Op_add($add);
}
}
@@ -148,7 +161,7 @@ class Text_Diff_Engine_native {
* match. The caller must trim matching lines from the beginning and end
* of the portions it is going to specify.
*/
- function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
+ function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
{
$flip = false;
@@ -160,6 +173,7 @@ class Text_Diff_Engine_native {
= array($yoff, $ylim, $xoff, $xlim);
}
+ $ymatches = array();
if ($flip) {
for ($i = $ylim - 1; $i >= $yoff; $i--) {
$ymatches[$this->xv[$i]][] = $i;
@@ -173,7 +187,7 @@ class Text_Diff_Engine_native {
$this->lcs = 0;
$this->seq[0]= $yoff - 1;
$this->in_seq = array();
- $ymids[0] = array();
+ $ymids = array(array());
$numer = $xlim - $xoff + $nchunks - 1;
$x = $xoff;
@@ -192,15 +206,16 @@ class Text_Diff_Engine_native {
}
$matches = $ymatches[$line];
reset($matches);
- while (list(, $y) = each($matches)) {
+ while ($y = current($matches)) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcsPos($y);
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
break;
}
+ next($matches);
}
- while (list(, $y) = each($matches)) {
+ while ($y = current($matches)) {
if ($y > $this->seq[$k - 1]) {
assert($y <= $this->seq[$k]);
/* Optimization: this is a common case: next match is
@@ -213,11 +228,12 @@ class Text_Diff_Engine_native {
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
}
+ next($matches);
}
}
}
- $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
+ $seps = array($flip ? array($yoff, $xoff) : array($xoff, $yoff));
$ymid = $ymids[$this->lcs];
for ($n = 0; $n < $nchunks - 1; $n++) {
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
@@ -268,7 +284,7 @@ class Text_Diff_Engine_native {
* Note that XLIM, YLIM are exclusive bounds. All line numbers are
* origin-0 and discarded lines are not counted.
*/
- function _compareseq ($xoff, $xlim, $yoff, $ylim)
+ function _compareseq($xoff, $xlim, $yoff, $ylim)
{
/* Slide down the bottom initial diagonal. */
while ($xoff < $xlim && $yoff < $ylim
@@ -309,7 +325,7 @@ class Text_Diff_Engine_native {
reset($seps);
$pt1 = $seps[0];
while ($pt2 = next($seps)) {
- $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
+ $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
$pt1 = $pt2;
}
}
@@ -332,7 +348,7 @@ class Text_Diff_Engine_native {
$i = 0;
$j = 0;
- assert('count($lines) == count($changed)');
+ assert(count($lines) == count($changed));
$len = count($lines);
$other_len = count($other_changed);
@@ -353,7 +369,7 @@ class Text_Diff_Engine_native {
}
while ($i < $len && ! $changed[$i]) {
- assert('$j < $other_len && ! $other_changed[$j]');
+ assert($j < $other_len && ! $other_changed[$j]);
$i++; $j++;
while ($j < $other_len && $other_changed[$j]) {
$j++;
@@ -385,11 +401,11 @@ class Text_Diff_Engine_native {
while ($start > 0 && $changed[$start - 1]) {
$start--;
}
- assert('$j > 0');
+ assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
- assert('$j >= 0 && !$other_changed[$j]');
+ assert($j >= 0 && !$other_changed[$j]);
}
/* Set CORRESPONDING to the end of the changed run, at the
@@ -410,7 +426,7 @@ class Text_Diff_Engine_native {
$i++;
}
- assert('$j < $other_len && ! $other_changed[$j]');
+ assert($j < $other_len && ! $other_changed[$j]);
$j++;
if ($j < $other_len && $other_changed[$j]) {
$corresponding = $i;
@@ -426,11 +442,11 @@ class Text_Diff_Engine_native {
while ($corresponding < $i) {
$changed[--$start] = 1;
$changed[--$i] = 0;
- assert('$j > 0');
+ assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
- assert('$j >= 0 && !$other_changed[$j]');
+ assert($j >= 0 && !$other_changed[$j]);
}
}
}
diff --git a/includes/pear/Text/Diff/Renderer.php b/includes/pear/Text/Diff/Renderer.php
index 3a51650..d5598ab 100644..100755
--- a/includes/pear/Text/Diff/Renderer.php
+++ b/includes/pear/Text/Diff/Renderer.php
@@ -35,10 +35,10 @@ class Text_Diff_Renderer {
/**
* Constructor.
*/
- function Text_Diff_Renderer($params = array())
+ function __construct($params = array())
{
foreach ($params as $param => $value) {
- $v = '_' . $param;
+ $v = "_" . $param;
if (isset($this->$v)) {
$this->$v = $value;
}
@@ -54,7 +54,7 @@ class Text_Diff_Renderer {
{
$params = array();
foreach (get_object_vars($this) as $k => $v) {
- if ($k[0] == '_') {
+ if ($k[0] == "_") {
$params[substr($k, 1)] = $v;
}
}
@@ -85,7 +85,7 @@ class Text_Diff_Renderer {
/* If these are unchanged (copied) lines, and we want to keep
* leading or trailing context lines, extract them from the copy
* block. */
- if (is_a($edit, 'Text_Diff_Op_copy')) {
+ if (is_a($edit, "Text_Diff_Op_copy")) {
/* Do we have any diff blocks yet? */
if (is_array($block)) {
/* How many lines to keep as context from the copy
@@ -149,19 +149,19 @@ class Text_Diff_Renderer {
foreach ($edits as $edit) {
switch (strtolower(get_class($edit))) {
- case 'text_diff_op_copy':
+ case "text_diff_op_copy":
$output .= $this->_context($edit->orig);
break;
- case 'text_diff_op_add':
+ case "text_diff_op_add":
$output .= $this->_added($edit->final);
break;
- case 'text_diff_op_delete':
+ case "text_diff_op_delete":
$output .= $this->_deleted($edit->orig);
break;
- case 'text_diff_op_change':
+ case "text_diff_op_change":
$output .= $this->_changed($edit->orig, $edit->final);
break;
}
@@ -172,21 +172,21 @@ class Text_Diff_Renderer {
function _startDiff()
{
- return '';
+ return "";
}
function _endDiff()
{
- return '';
+ return "";
}
function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
{
if ($xlen > 1) {
- $xbeg .= ',' . ($xbeg + $xlen - 1);
+ $xbeg .= "," . ($xbeg + $xlen - 1);
}
if ($ylen > 1) {
- $ybeg .= ',' . ($ybeg + $ylen - 1);
+ $ybeg .= "," . ($ybeg + $ylen - 1);
}
// this matches the GNU Diff behaviour
@@ -196,7 +196,7 @@ class Text_Diff_Renderer {
$xbeg--;
}
- return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
+ return $xbeg . ($xlen ? ($ylen ? "c" : "d") : "a") . $ybeg;
}
function _startBlock($header)
@@ -206,27 +206,27 @@ class Text_Diff_Renderer {
function _endBlock()
{
- return '';
+ return "";
}
- function _lines($lines, $prefix = ' ')
+ function _lines($lines, $prefix = " ")
{
return $prefix . implode("\n$prefix", $lines) . "\n";
}
function _context($lines)
{
- return $this->_lines($lines, ' ');
+ return $this->_lines($lines, " ");
}
function _added($lines)
{
- return $this->_lines($lines, '> ');
+ return $this->_lines($lines, "> ");
}
function _deleted($lines)
{
- return $this->_lines($lines, '< ');
+ return $this->_lines($lines, "< ");
}
function _changed($orig, $final)
diff --git a/includes/pear/Text/Diff/Renderer/unified.php b/includes/pear/Text/Diff/Renderer/unified.php
index f990f72..bda6d9b 100644..100755
--- a/includes/pear/Text/Diff/Renderer/unified.php
+++ b/includes/pear/Text/Diff/Renderer/unified.php
@@ -16,7 +16,9 @@
*/
/** Text_Diff_Renderer */
-require_once 'Text/Diff/Renderer.php';
+if (!class_exists("Text_Diff_Renderer")) {
+ require_once "Text/Diff/Renderer.php";
+}
/**
* @package Text_Diff
@@ -36,27 +38,27 @@ class Text_Diff_Renderer_unified extends Text_Diff_Renderer {
function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
{
if ($xlen != 1) {
- $xbeg .= ',' . $xlen;
+ $xbeg .= "," . $xlen;
}
if ($ylen != 1) {
- $ybeg .= ',' . $ylen;
+ $ybeg .= "," . $ylen;
}
return "@@ -$xbeg +$ybeg @@";
}
function _context($lines)
{
- return $this->_lines($lines, ' ');
+ return $this->_lines($lines, " ");
}
function _added($lines)
{
- return $this->_lines($lines, '+');
+ return $this->_lines($lines, "+");
}
function _deleted($lines)
{
- return $this->_lines($lines, '-');
+ return $this->_lines($lines, "-");
}
function _changed($orig, $final)
diff --git a/includes/pear/Text/Wiki.php b/includes/pear/Text/Wiki.php
index 27a9161..2127c37 100644..100755
--- a/includes/pear/Text/Wiki.php
+++ b/includes/pear/Text/Wiki.php
@@ -5,23 +5,23 @@
*
* PHP versions 4 and 5
*
- * @category Text
- * @package Text_Wiki
- * @author Paul M. Jones <pmjones@php.net>
- * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Wiki.php 248433 2007-12-17 16:03:48Z justinpatrin $
- * @link http://pear.php.net/package/Text_Wiki
+ * @category Text
+ * @package Text_Wiki
+ * @author Paul M. Jones <pmjones@php.net>
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/Text_Wiki
*/
/**
* The baseline abstract parser class.
*/
-require_once 'Text/Wiki/Parse.php';
+require_once "Text/Wiki/Parse.php";
/**
* The baseline abstract render class.
*/
-require_once 'Text/Wiki/Render.php';
+require_once "Text/Wiki/Render.php";
/**
* Parse structured wiki text and render into arbitrary formats such as XHTML.
@@ -29,316 +29,291 @@ require_once 'Text/Wiki/Render.php';
* This is the "master" class for handling the management and convenience
* functions to transform Wiki-formatted text.
*
- * @category Text
- * @package Text_Wiki
- * @author Paul M. Jones <pmjones@php.net>
- * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version Release: 1.2.1
- * @link http://pear.php.net/package/Text_Wiki
+ * @category Text
+ * @package Text_Wiki
+ * @author Paul M. Jones <pmjones@php.net>
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version Release: 1.2.3
+ * @link http://pear.php.net/package/Text_Wiki
*/
-class Text_Wiki {
+class Text_Wiki
+{
/**
- *
- * The default list of rules, in order, to apply to the source text.
- *
- * @access public
- *
- * @var array
- *
- */
+ * The default list of rules, in order, to apply to the source text.
+ *
+ * @access public
+ *
+ * @var array
+ */
var $rules = array(
- 'Prefilter',
- 'Delimiter',
- 'Code',
- 'Function',
- 'Html',
- 'Raw',
- 'Include',
- 'Embed',
- 'Anchor',
- 'Heading',
- 'Toc',
- 'Horiz',
- 'Break',
- 'Blockquote',
- 'List',
- 'Deflist',
- 'Table',
- 'Image',
- 'Phplookup',
- 'Center',
- 'Newline',
- 'Paragraph',
- 'Url',
- 'Freelink',
- 'Interwiki',
- 'Wikilink',
- 'Colortext',
- 'Strong',
- 'Bold',
- 'Emphasis',
- 'Italic',
- 'Underline',
- 'Tt',
- 'Superscript',
- 'Subscript',
- 'Revise',
- 'Tighten'
+ "Prefilter",
+ "Delimiter",
+ "Code",
+ "Function",
+ "Html",
+ "Raw",
+ "Include",
+ "Embed",
+ "Anchor",
+ "Heading",
+ "Toc",
+ "Horiz",
+ "Break",
+ "Blockquote",
+ "List",
+ "Deflist",
+ "Table",
+ "Image",
+ "Phplookup",
+ "Center",
+ "Newline",
+ "Paragraph",
+ "Url",
+ "Freelink",
+ "Interwiki",
+ "Wikilink",
+ "Colortext",
+ "Strong",
+ "Bold",
+ "Emphasis",
+ "Italic",
+ "Underline",
+ "Tt",
+ "Superscript",
+ "Subscript",
+ "Revise",
+ "Tighten"
);
/**
- *
- * The list of rules to not-apply to the source text.
- *
- * @access public
- *
- * @var array
- *
- */
+ * The list of rules to not-apply to the source text.
+ *
+ * @access public
+ *
+ * @var array
+ */
var $disable = array(
- 'Html',
- 'Include',
- 'Embed'
+ "Html",
+ "Include",
+ "Embed"
);
/**
- *
- * Custom configuration for rules at the parsing stage.
- *
- * In this array, the key is the parsing rule name, and the value is
- * an array of key-value configuration pairs corresponding to the $conf
- * property in the target parsing rule.
- *
- * For example:
- *
- * <code>
- * $parseConf = array(
- * 'Include' => array(
- * 'base' => '/path/to/scripts/'
- * )
- * );
- * </code>
- *
- * Note that most default rules do not need any parsing configuration.
- *
- * @access public
- *
- * @var array
- *
- */
+ * Custom configuration for rules at the parsing stage.
+ *
+ * In this array, the key is the parsing rule name, and the value is
+ * an array of key-value configuration pairs corresponding to the $conf
+ * property in the target parsing rule.
+ *
+ * For example:
+ *
+ * <code>
+ * $parseConf = array(
+ * 'Include' => array(
+ * 'base' => '/path/to/scripts/'
+ * )
+ * );
+ * </code>
+ *
+ * Note that most default rules do not need any parsing configuration.
+ *
+ * @access public
+ *
+ * @var array
+ */
var $parseConf = array();
/**
- *
- * Custom configuration for rules at the rendering stage.
- *
- * Because rendering may be different for each target format, the
- * first-level element in this array is always a format name (e.g.,
- * 'Xhtml').
- *
- * Within that first level element, the subsequent elements match the
- * $parseConf format. That is, the sub-key is the rendering rule name,
- * and the sub-value is an array of key-value configuration pairs
- * corresponding to the $conf property in the target rendering rule.
- *
- * @access public
- *
- * @var array
- *
- */
+ * Custom configuration for rules at the rendering stage.
+ *
+ * Because rendering may be different for each target format, the
+ * first-level element in this array is always a format name (e.g.,
+ * 'Xhtml').
+ *
+ * Within that first level element, the subsequent elements match the
+ * $parseConf format. That is, the sub-key is the rendering rule name,
+ * and the sub-value is an array of key-value configuration pairs
+ * corresponding to the $conf property in the target rendering rule.
+ *
+ * @access public
+ *
+ * @var array
+ */
var $renderConf = array(
- 'Docbook' => array(),
- 'Latex' => array(),
- 'Pdf' => array(),
- 'Plain' => array(),
- 'Rtf' => array(),
- 'Xhtml' => array()
+ "Docbook" => array(),
+ "Latex" => array(),
+ "Pdf" => array(),
+ "Plain" => array(),
+ "Rtf" => array(),
+ "Xhtml" => array()
);
/**
- *
- * Custom configuration for the output format itself.
- *
- * Even though Text_Wiki will render the tokens from parsed text,
- * the format itself may require some configuration. For example,
- * RTF needs to know font names and sizes, PDF requires page layout
- * information, and DocBook needs a section hierarchy. This array
- * matches the $conf property of the the format-level renderer
- * (e.g., Text_Wiki_Render_Xhtml).
- *
- * In this array, the key is the rendering format name, and the value is
- * an array of key-value configuration pairs corresponding to the $conf
- * property in the rendering format rule.
- *
- * @access public
- *
- * @var array
- *
- */
+ * Custom configuration for the output format itself.
+ *
+ * Even though Text_Wiki will render the tokens from parsed text,
+ * the format itself may require some configuration. For example,
+ * RTF needs to know font names and sizes, PDF requires page layout
+ * information, and DocBook needs a section hierarchy. This array
+ * matches the $conf property of the the format-level renderer
+ * (e.g., Text_Wiki_Render_Xhtml).
+ *
+ * In this array, the key is the rendering format name, and the value is
+ * an array of key-value configuration pairs corresponding to the $conf
+ * property in the rendering format rule.
+ *
+ * @access public
+ *
+ * @var array
+ */
var $formatConf = array(
- 'Docbook' => array(),
- 'Latex' => array(),
- 'Pdf' => array(),
- 'Plain' => array(),
- 'Rtf' => array(),
- 'Xhtml' => array()
+ "Docbook" => array(),
+ "Latex" => array(),
+ "Pdf" => array(),
+ "Plain" => array(),
+ "Rtf" => array(),
+ "Xhtml" => array()
);
/**
- *
- * The delimiter for token numbers of parsed elements in source text.
- *
- * @access public
- *
- * @var string
- *
- */
+ * The delimiter for token numbers of parsed elements in source text.
+ *
+ * @access public
+ *
+ * @var string
+ */
var $delim = "\31";
/**
- *
- * The tokens generated by rules as the source text is parsed.
- *
- * As Text_Wiki applies rule classes to the source text, it will
- * replace portions of the text with a delimited token number. This
- * is the array of those tokens, representing the replaced text and
- * any options set by the parser for that replaced text.
- *
- * The tokens array is sequential; each element is itself a sequential
- * array where element 0 is the name of the rule that generated the
- * token, and element 1 is an associative array where the key is an
- * option name and the value is an option value.
- *
- * @access private
- *
- * @var array
- *
- */
+ * The tokens generated by rules as the source text is parsed.
+ *
+ * As Text_Wiki applies rule classes to the source text, it will
+ * replace portions of the text with a delimited token number. This
+ * is the array of those tokens, representing the replaced text and
+ * any options set by the parser for that replaced text.
+ *
+ * The tokens array is sequential; each element is itself a sequential
+ * array where element 0 is the name of the rule that generated the
+ * token, and element 1 is an associative array where the key is an
+ * option name and the value is an option value.
+ *
+ * @access private
+ *
+ * @var array
+ */
var $tokens = array();
/**
- * How many tokens generated pro rules.
- *
- * Intended to load only necessary render objects
- *
- * @access private
- * @var array
- */
+ * How many tokens generated pro rules.
+ *
+ * Intended to load only necessary render objects
+ *
+ * @access private
+ * @var array
+ */
var $_countRulesTokens = array();
/**
- *
- * The source text to which rules will be applied.
- *
- * This text will be transformed in-place, which means that it will
- * change as the rules are applied.
- *
- * @access private
- *
- * @var string
- *
- */
+ * The source text to which rules will be applied.
+ *
+ * This text will be transformed in-place, which means that it will
+ * change as the rules are applied.
+ *
+ * @access private
+ *
+ * @var string
+ */
- var $source = '';
+ var $source = "";
/**
* The output text
*
* @var string
*/
- var $output = '';
+ var $output = "";
/**
- *
- * Array of rule parsers.
- *
- * Text_Wiki creates one instance of every rule that is applied to
- * the source text; this array holds those instances. The array key
- * is the rule name, and the array value is an instance of the rule
- * class.
- *
- * @access private
- *
- * @var array
- *
- */
+ * Array of rule parsers.
+ *
+ * Text_Wiki creates one instance of every rule that is applied to
+ * the source text; this array holds those instances. The array key
+ * is the rule name, and the array value is an instance of the rule
+ * class.
+ *
+ * @access private
+ *
+ * @var array
+ */
var $parseObj = array();
/**
- *
- * Array of rule renderers.
- *
- * Text_Wiki creates one instance of every rule that is applied to
- * the source text; this array holds those instances. The array key
- * is the rule name, and the array value is an instance of the rule
- * class.
- *
- * @access private
- *
- * @var array
- *
- */
+ * Array of rule renderers.
+ *
+ * Text_Wiki creates one instance of every rule that is applied to
+ * the source text; this array holds those instances. The array key
+ * is the rule name, and the array value is an instance of the rule
+ * class.
+ *
+ * @access private
+ *
+ * @var array
+ */
var $renderObj = array();
/**
- *
- * Array of format renderers.
- *
- * @access private
- *
- * @var array
- *
- */
+ * Array of format renderers.
+ *
+ * @access private
+ *
+ * @var array
+ */
var $formatObj = array();
/**
- *
- * Array of paths to search, in order, for parsing and rendering rules.
- *
- * @access private
- *
- * @var array
- *
- */
+ * Array of paths to search, in order, for parsing and rendering rules.
+ *
+ * @access private
+ *
+ * @var array
+ */
var $path = array(
- 'parse' => array(),
- 'render' => array()
+ "parse" => array(),
+ "render" => array()
);
/**
- *
- * The directory separator character.
- *
- * @access private
- *
- * @var string
- *
- */
+ * The directory separator character.
+ *
+ * @access private
+ *
+ * @var string
+ */
var $_dirSep = DIRECTORY_SEPARATOR;
@@ -347,7 +322,7 @@ class Text_Wiki {
*
* @var string
*/
- var $renderingType = 'normal';
+ var $renderingType = "normal";
/**
* Stack of rendering callbacks
@@ -371,19 +346,17 @@ class Text_Wiki {
var $_blocks;
/**
- *
- * Constructor.
- *
- * **DEPRECATED**
- * Please use the singleton() or factory() methods.
- *
- * @access public
- *
- * @param array $rules The set of rules to load for this object. Defaults
- * to null, which will load the default ruleset for this parser.
- */
-
- function Text_Wiki($rules = null)
+ * A fix for PHP5.
+ *
+ * **DEPRECATED**
+ * Please use the singleton() or factory() methods.
+ *
+ * @param mixed $rules null or an array.
+ *
+ * @return $this
+ * @uses self::Text_Wiki()
+ */
+ public function __construct($rules = null)
{
if (is_array($rules)) {
$this->rules = array();
@@ -393,63 +366,80 @@ class Text_Wiki {
}
$this->addPath(
- 'parse',
- $this->fixPath(dirname(__FILE__)) . 'Wiki/Parse/Default/'
+ "parse",
+ $this->fixPath(dirname(__FILE__)) . "Wiki/Parse/Default/"
);
$this->addPath(
- 'render',
- $this->fixPath(dirname(__FILE__)) . 'Wiki/Render/'
+ "render",
+ $this->fixPath(dirname(__FILE__)) . "Wiki/Render/"
);
+ }
+ /**
+ * Constructor.
+ *
+ * **DEPRECATED**
+ * Please use the singleton() or factory() methods.
+ *
+ * @param array $rules The set of rules to load for this object. Defaults to null
+ * which will load the default ruleset for this parser.
+ *
+ * @return $this
+ * @see self::__construct()
+ */
+ public function Text_Wiki($rules = null)
+ {
+ self::__construct($rules);
}
/**
- * Singleton.
- *
- * This avoids instantiating multiple Text_Wiki instances where a number
- * of objects are required in one call, e.g. to save memory in a
- * CMS invironment where several parsers are required in a single page.
- *
- * $single = & singleton();
- *
- * or
- *
- * $single = & singleton('Parser', array('Prefilter', 'Delimiter', 'Code', 'Function',
- * 'Html', 'Raw', 'Include', 'Embed', 'Anchor', 'Heading', 'Toc', 'Horiz',
- * 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image', 'Phplookup',
- * 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink',
- * 'Colortext', 'Strong', 'Bold', 'Emphasis', 'Italic', 'Underline', 'Tt',
- * 'Superscript', 'Subscript', 'Revise', 'Tighten'));
- *
- * Call using a subset of this list. The order of passing rulesets in the
- * $rules array is important!
- *
- * After calling this, call $single->setParseConf(), setRenderConf() or setFormatConf()
- * as usual for a constructed object of this class.
- *
- * The internal static array of singleton objects has no index on the parser
- * rules, the only index is on the parser name. So if you call this multiple
- * times with different rules but the same parser name, you will get the same
- * static parser object each time.
- *
- * @access public
- * @static
- * @since Method available since Release 1.1.0
- * @param string $parser The parser to be used (defaults to 'Default').
- * @param array $rules The set of rules to instantiate the object. This
- * will only be used when the first call to singleton is made, if included
- * in further calls it will be effectively ignored.
- * @return &object a reference to the Text_Wiki unique instantiation.
- */
- function &singleton($parser = 'Default', $rules = null)
+ * Singleton.
+ *
+ * This avoids instantiating multiple Text_Wiki instances where a number
+ * of objects are required in one call, e.g. to save memory in a
+ * CMS invironment where several parsers are required in a single page.
+ *
+ * $single = singleton();
+ *
+ * or
+ *
+ * $single = singleton('Parser', array('Prefilter', 'Delimiter', 'Code',
+ * 'Function', 'Html', 'Raw', 'Include', 'Embed', 'Anchor', 'Heading',
+ * 'Toc', 'Horiz', 'Break', 'Blockquote', 'List', 'Deflist', 'Table',
+ * 'Image', 'Phplookup', * 'Center', 'Newline', 'Paragraph', 'Url',
+ * 'Freelink', 'Interwiki', 'Wikilink', * 'Colortext', 'Strong', 'Bold',
+ * 'Emphasis', 'Italic', 'Underline', 'Tt', * 'Superscript', 'Subscript',
+ * 'Revise', 'Tighten'));
+ *
+ * Call using a subset of this list. The order of passing rulesets in the
+ * $rules array is important!
+ *
+ * After calling this, call $single->setParseConf(), setRenderConf(),
+ * or setFormatConf() as usual for a constructed object of this class.
+ *
+ * The internal static array of singleton objects has no index on the parser
+ * rules, the only index is on the parser name. So if you call this multiple
+ * times with different rules but the same parser name, you will get the same
+ * static parser object each time.
+ *
+ * @param string $parser The parser to be used (defaults to 'Default').
+ * @param array $rules The set of rules to instantiate the object. This
+ * will only be used when the first call to
+ * singleton is made, if included in further calls
+ * it will be effectively ignored.
+ *
+ * @since Method available since Release 1.1.0
+ * @return &object a reference to the Text_Wiki unique instantiation.
+ */
+ public static function singleton($parser = "Default", $rules = null)
{
static $only = array();
if (!isset($only[$parser])) {
- $ret = & Text_Wiki::factory($parser, $rules);
+ $ret = Text_Wiki::factory($parser, $rules);
if (Text_Wiki::isError($ret)) {
return $ret;
}
- $only[$parser] =& $ret;
+ $only[$parser] = $ret;
}
return $only[$parser];
}
@@ -457,49 +447,43 @@ class Text_Wiki {
/**
* Returns a Text_Wiki Parser class for the specified parser.
*
- * @access public
- * @static
* @param string $parser The name of the parse to instantiate
- * you need to have Text_Wiki_XXX installed to use $parser = 'XXX', it's E_FATAL
- * @param array $rules The rules to pass into the constructor
- * {@see Text_Wiki::singleton} for a list of rules
+ * you need to have Text_Wiki_XXX installed
+ * to use $parser = 'XXX', it's E_FATAL
+ * @param array $rules The rules to pass into the constructor
+ * {@see Text_Wiki::singleton} for a list
+ * of rules
+ *
* @return Text_Wiki a Parser object extended from Text_Wiki
*/
- function &factory($parser = 'Default', $rules = null)
+ public static function factory($parser = "Default", $rules = null)
{
- $class = 'Text_Wiki_' . $parser;
- $file = str_replace('_', '/', $class).'.php';
+ $class = "Text_Wiki_" . $parser;
+ $file = str_replace("_", "/", $class).".php";
if (!class_exists($class)) {
- require_once $file;
+ include_once $file;
if (!class_exists($class)) {
return Text_Wiki::error(
- 'Class ' . $class . ' does not exist after requiring '. $file .
- ', install package ' . $class . "\n");
+ "Class " . $class . " does not exist after requiring ". $file .
+ ", install package " . $class . "\n"
+ );
}
}
- $obj =& new $class($rules);
- return $obj;
+ return new $class($rules);
}
/**
- *
- * Set parser configuration for a specific rule and key.
- *
- * @access public
- *
- * @param string $rule The parse rule to set config for.
- *
- * @param array|string $arg1 The full config array to use for the
- * parse rule, or a conf key in that array.
- *
- * @param string $arg2 The config value for the key.
- *
- * @return void
- *
- */
-
- function setParseConf($rule, $arg1, $arg2 = null)
+ * Set parser configuration for a specific rule and key.
+ *
+ * @param string $rule The parse rule to set config for.
+ * @param array|string $arg1 The full config array to use for the
+ * parse rule, or a conf key in that array.
+ * @param string $arg2 The config value for the key.
+ *
+ * @return void
+ */
+ public function setParseConf($rule, $arg1, $arg2 = null)
{
$rule = ucwords(strtolower($rule));
@@ -519,22 +503,16 @@ class Text_Wiki {
/**
- *
- * Get parser configuration for a specific rule and key.
- *
- * @access public
- *
- * @param string $rule The parse rule to get config for.
- *
- * @param string $key A key in the conf array; if null,
- * returns the entire conf array.
- *
- * @return mixed The whole conf array if no key is specified,
- * or the specific conf key value.
- *
- */
-
- function getParseConf($rule, $key = null)
+ * Get parser configuration for a specific rule and key.
+ *
+ * @param string $rule The parse rule to get config for.
+ * @param string $key A key in the conf array; if null,
+ * returns the entire conf array.
+ *
+ * @return mixed The whole conf array if no key is specified,
+ * or the specific conf key value.
+ */
+ public function getParseConf($rule, $key = null)
{
$rule = ucwords(strtolower($rule));
@@ -560,25 +538,17 @@ class Text_Wiki {
/**
- *
- * Set renderer configuration for a specific format, rule, and key.
- *
- * @access public
- *
- * @param string $format The render format to set config for.
- *
- * @param string $rule The render rule to set config for in the format.
- *
- * @param array|string $arg1 The config array, or the config key
- * within the render rule.
- *
- * @param string $arg2 The config value for the key.
- *
- * @return void
- *
- */
-
- function setRenderConf($format, $rule, $arg1, $arg2 = null)
+ * Set renderer configuration for a specific format, rule, and key.
+ *
+ * @param string $format The render format to set config for.
+ * @param string $rule The render rule to set config for in the format.
+ * @param array|string $arg1 The config array, or the config key
+ * within the render rule.
+ * @param string $arg2 The config value for the key.
+ *
+ * @return void
+ */
+ public function setRenderConf($format, $rule, $arg1, $arg2 = null)
{
$format = ucwords(strtolower($format));
$rule = ucwords(strtolower($rule));
@@ -603,30 +573,24 @@ class Text_Wiki {
/**
- *
- * Get renderer configuration for a specific format, rule, and key.
- *
- * @access public
- *
- * @param string $format The render format to get config for.
- *
- * @param string $rule The render format rule to get config for.
- *
- * @param string $key A key in the conf array; if null,
- * returns the entire conf array.
- *
- * @return mixed The whole conf array if no key is specified,
- * or the specific conf key value.
- *
- */
-
- function getRenderConf($format, $rule, $key = null)
+ * Get renderer configuration for a specific format, rule, and key.
+ *
+ * @param string $format The render format to get config for.
+ * @param string $rule The render format rule to get config for.
+ * @param string $key A key in the conf array; if null,
+ * returns the entire conf array.
+ *
+ * @return mixed The whole conf array if no key is specified,
+ * or the specific conf key value.
+ */
+ public function getRenderConf($format, $rule, $key = null)
{
$format = ucwords(strtolower($format));
$rule = ucwords(strtolower($rule));
- if (! isset($this->renderConf[$format]) ||
- ! isset($this->renderConf[$format][$rule])) {
+ if (! isset($this->renderConf[$format])
+ || ! isset($this->renderConf[$format][$rule])
+ ) {
return null;
}
@@ -647,56 +611,45 @@ class Text_Wiki {
}
/**
- *
- * Set format configuration for a specific rule and key.
- *
- * @access public
- *
- * @param string $format The format to set config for.
- *
- * @param string $key The config key within the format.
- *
- * @param string $val The config value for the key.
- *
- * @return void
- *
- */
-
- function setFormatConf($format, $arg1, $arg2 = null)
+ * Set format configuration for a specific rule and key.
+ *
+ * @param string $format The format to set config for.
+ * @param string $key The config key within the format.
+ * @param string $val The config value for the key.
+ *
+ * @return void
+ */
+ public function setFormatConf($format, $key, $val = null)
{
- if (! is_array($this->formatConf[$format])) {
+ if (!isset($this->formatConf[$format])
+ || ! is_array($this->formatConf[$format])
+ ) {
$this->formatConf[$format] = array();
}
// if first arg is an array, use it as the entire
- // conf array for the format. otherwise, treat arg1
- // as a key and arg2 as a value for the format conf.
- if (is_array($arg1)) {
- $this->formatConf[$format] = $arg1;
+ // conf array for the format. otherwise, treat key
+ // as a key and val as a value for the format conf.
+ if (is_array($key)) {
+ $this->formatConf[$format] = $key;
} else {
- $this->formatConf[$format][$arg1] = $arg2;
+ $this->formatConf[$format][$key] = $val;
}
}
/**
- *
- * Get configuration for a specific format and key.
- *
- * @access public
- *
- * @param string $format The format to get config for.
- *
- * @param mixed $key A key in the conf array; if null,
- * returns the entire conf array.
- *
- * @return mixed The whole conf array if no key is specified,
- * or the specific conf key value.
- *
- */
-
- function getFormatConf($format, $key = null)
+ * Get configuration for a specific format and key.
+ *
+ * @param string $format The format to get config for.
+ * @param mixed $key A key in the conf array; if null,
+ * returns the entire conf array.
+ *
+ * @return mixed The whole conf array if no key is specified,
+ * or the specific conf key value.
+ */
+ public function getFormatConf($format, $key = null)
{
// the format does not exist
if (! isset($this->formatConf[$format])) {
@@ -720,23 +673,17 @@ class Text_Wiki {
/**
- *
- * Inserts a rule into to the rule set.
- *
- * @access public
- *
- * @param string $name The name of the rule. Should be different from
- * all other keys in the rule set.
- *
- * @param string $tgt The rule after which to insert this new rule. By
- * default (null) the rule is inserted at the end; if set to '', inserts
- * at the beginning.
- *
- * @return void
- *
- */
-
- function insertRule($name, $tgt = null)
+ * Inserts a rule into to the rule set.
+ *
+ * @param string $name The name of the rule. Should be different from
+ * all other keys in the rule set.
+ * @param string $tgt The rule after which to insert this new rule. By
+ * default (null) the rule is inserted at the end;
+ * if set to '', inserts at the beginning.
+ *
+ * @return void
+ */
+ public function insertRule($name, $tgt = null)
{
$name = ucwords(strtolower($name));
if (! is_null($tgt)) {
@@ -752,8 +699,9 @@ class Text_Wiki {
// the target name is not null, and not '', but does not exist
// in the list of rules. this means we're trying to insert after
// a target key, but the target key isn't there.
- if (! is_null($tgt) && $tgt != '' &&
- ! in_array($tgt, $this->rules)) {
+ if (! is_null($tgt) && $tgt != ""
+ && ! in_array($tgt, $this->rules)
+ ) {
return false;
}
@@ -768,7 +716,7 @@ class Text_Wiki {
// save a copy of the current rules, then reset the rule set
// so we can insert in the proper place later.
// where to insert the rule?
- if ($tgt == '') {
+ if ($tgt == "") {
// insert at the beginning
array_unshift($this->rules, $name);
return true;
@@ -791,18 +739,13 @@ class Text_Wiki {
/**
- *
- * Delete (remove or unset) a rule from the $rules property.
- *
- * @access public
- *
- * @param string $rule The name of the rule to remove.
- *
- * @return void
- *
- */
-
- function deleteRule($name)
+ * Delete (remove or unset) a rule from the $rules property.
+ *
+ * @param string $name The name of the rule to remove.
+ *
+ * @return void
+ */
+ public function deleteRule($name)
{
$name = ucwords(strtolower($name));
$key = array_search($name, $this->rules);
@@ -813,20 +756,14 @@ class Text_Wiki {
/**
- *
- * Change from one rule to another in-place.
- *
- * @access public
- *
- * @param string $old The name of the rule to change from.
- *
- * @param string $new The name of the rule to change to.
- *
- * @return void
- *
- */
-
- function changeRule($old, $new)
+ * Change from one rule to another in-place.
+ *
+ * @param string $old The name of the rule to change from.
+ * @param string $new The name of the rule to change to.
+ *
+ * @return void
+ */
+ public function changeRule($old, $new)
{
$old = ucwords(strtolower($old));
$new = ucwords(strtolower($new));
@@ -840,18 +777,13 @@ class Text_Wiki {
/**
- *
- * Enables a rule so that it is applied when parsing.
- *
- * @access public
- *
- * @param string $rule The name of the rule to enable.
- *
- * @return void
- *
- */
-
- function enableRule($name)
+ * Enables a rule so that it is applied when parsing.
+ *
+ * @param string $name The name of the rule to enable.
+ *
+ * @return void
+ */
+ public function enableRule($name)
{
$name = ucwords(strtolower($name));
$key = array_search($name, $this->disable);
@@ -860,20 +792,14 @@ class Text_Wiki {
}
}
-
/**
- *
- * Disables a rule so that it is not applied when parsing.
- *
- * @access public
- *
- * @param string $rule The name of the rule to disable.
- *
- * @return void
- *
- */
-
- function disableRule($name)
+ * Disables a rule so that it is not applied when parsing.
+ *
+ * @param string $name The name of the rule to disable.
+ *
+ * @return void
+ */
+ public function disableRule($name)
{
$name = ucwords(strtolower($name));
$key = array_search($name, $this->disable);
@@ -882,58 +808,45 @@ class Text_Wiki {
}
}
-
/**
- *
- * Parses and renders the text passed to it, and returns the results.
- *
- * First, the method parses the source text, applying rules to the
- * text as it goes. These rules will modify the source text
- * in-place, replacing some text with delimited tokens (and
- * populating the $this->tokens array as it goes).
- *
- * Next, the method renders the in-place tokens into the requested
- * output format.
- *
- * Finally, the method returns the transformed text. Note that the
- * source text is transformed in place; once it is transformed, it is
- * no longer the same as the original source text.
- *
- * @access public
- *
- * @param string $text The source text to which wiki rules should be
- * applied, both for parsing and for rendering.
- *
- * @param string $format The target output format, typically 'xhtml'.
- * If a rule does not support a given format, the output from that
- * rule is rule-specific.
- *
- * @return string The transformed wiki text.
- *
- */
-
- function transform($text, $format = 'Xhtml')
+ * Parses and renders the text passed to it, and returns the results.
+ *
+ * First, the method parses the source text, applying rules to the
+ * text as it goes. These rules will modify the source text
+ * in-place, replacing some text with delimited tokens (and
+ * populating the $this->tokens array as it goes).
+ *
+ * Next, the method renders the in-place tokens into the requested
+ * output format.
+ *
+ * Finally, the method returns the transformed text. Note that the
+ * source text is transformed in place; once it is transformed, it is
+ * no longer the same as the original source text.
+ *
+ * @param string $text The source text to which wiki rules should be
+ * applied, both for parsing and for rendering.
+ * @param string $format The target output format, typically 'xhtml'.
+ * If a rule does not support a given format, the
+ * output from that rule is rule-specific.
+ *
+ * @return string The transformed wiki text.
+ */
+ public function transform($text, $format = "Xhtml")
{
$this->parse($text);
return $this->render($format);
}
-
/**
- *
- * Sets the $_source text property, then parses it in place and
- * retains tokens in the $_tokens array property.
- *
- * @access public
- *
- * @param string $text The source text to which wiki rules should be
- * applied, both for parsing and for rendering.
- *
- * @return void
- *
- */
-
- function parse($text)
+ * Sets the $_source text property, then parses it in place and
+ * retains tokens in the $_tokens array property.
+ *
+ * @param string $text The source text to which wiki rules should be
+ * applied, both for parsing and for rendering.
+ *
+ * @return void
+ */
+ public function parse($text)
{
// set the object property for the source text
$this->source = $text;
@@ -943,7 +856,7 @@ class Text_Wiki {
$this->_countRulesTokens = array();
// apply the parse() method of each requested rule to the source
- // text.
+ // text
foreach ($this->rules as $name) {
// do not parse the rules listed in $disable
if (! in_array($name, $this->disable)) {
@@ -962,33 +875,28 @@ class Text_Wiki {
/**
- *
- * Renders tokens back into the source text, based on the requested format.
- *
- * @access public
- *
- * @param string $format The target output format, typically 'xhtml'.
- * If a rule does not support a given format, the output from that
- * rule is rule-specific.
- *
- * @return string The transformed wiki text.
- *
- */
-
- function render($format = 'Xhtml')
+ * Renders tokens back into the source text, based on the requested format.
+ *
+ * @param string $format The target output format, typically 'xhtml'.
+ * If a rule does not support a given format, the
+ * output from that rule is rule-specific.
+ *
+ * @return string The transformed wiki text.
+ */
+ public function render($format = "Xhtml")
{
// the rendering method we're going to use from each rule
$format = ucwords(strtolower($format));
// the eventual output text
- $this->output = '';
+ $this->output = "";
// when passing through the parsed source text, keep track of when
// we are in a delimited section
$in_delim = false;
// when in a delimited section, capture the token key number
- $key = '';
+ $key = "";
// load the format object, or crap out if we can't find it
$result = $this->loadFormatObj($format);
@@ -1006,13 +914,15 @@ class Text_Wiki {
$this->loadRenderObj($format, $rule);
}
- if ($this->renderingType == 'preg') {
- $this->output = preg_replace_callback('/'.$this->delim.'(\d+)'.$this->delim.'/',
- array(&$this, '_renderToken'),
- $this->source);
+ if ($this->renderingType == "preg") {
+ $this->output = preg_replace_callback(
+ "/".$this->delim.'(\d+)'.$this->delim."/",
+ array(&$this, "_renderToken"),
+ $this->source
+ );
/*
-//Damn strtok()! Why does it "skip" empty parts of the string. It's useless now!
- } elseif ($this->renderingType == 'strtok') {
+ //Damn strtok()! Why does it "skip" empty parts of the string. It's useless now!
+ } elseif ($this->renderingType == 'strtok') {
echo '<pre>'.htmlentities($this->source).'</pre>';
$t = strtok($this->source, $this->delim);
$inToken = true;
@@ -1031,13 +941,13 @@ class Text_Wiki {
*/
} else {
// pass through the parsed source text character by character
- $this->_block = '';
+ $this->_block = "";
$tokenStack = array();
$k = strlen($this->source);
for ($i = 0; $i < $k; $i++) {
// the current character
- $char = $this->source{$i};
+ $char = $this->source[$i];
// are alredy in a delimited section?
if ($in_delim) {
@@ -1047,14 +957,14 @@ class Text_Wiki {
if (count($this->_renderCallbacks) == 0) {
$this->output .= $this->_block;
- $this->_block = '';
+ $this->_block = "";
}
- if (isset($opts['type'])) {
- if ($opts['type'] == 'start') {
+ if (isset($opts["type"])) {
+ if ($opts["type"] == "start") {
array_push($tokenStack, $rule);
- } elseif ($opts['type'] == 'end') {
+ } elseif ($opts["type"] == "end") {
if ($tokenStack[count($tokenStack) - 1] != $rule) {
- return Text_Wiki::error('Unbalanced tokens, check your syntax');
+ return Text_Wiki::error("Unbalanced tokens, check your syntax");
} else {
array_pop($tokenStack);
}
@@ -1083,7 +993,7 @@ class Text_Wiki {
if ($char == $this->delim) {
// yes, reset the previous key and
// set the flag.
- $key = '';
+ $key = "";
$in_delim = true;
} else {
@@ -1095,7 +1005,9 @@ class Text_Wiki {
}
if (count($this->_renderCallbacks)) {
- return $this->error('Render callbacks left over after processing finished');
+ return $this->error(
+ "Render callbacks left over after processing finished"
+ );
}
/*
while (count($this->_renderCallbacks)) {
@@ -1104,7 +1016,7 @@ class Text_Wiki {
*/
if (strlen($this->_block)) {
$this->output .= $this->_block;
- $this->_block = '';
+ $this->_block = "";
}
// post-rendering activity
@@ -1119,23 +1031,43 @@ class Text_Wiki {
/**
* Renders a token, for use only as an internal callback
*
- * @param array Matches from preg_rpelace_callback, [1] is the token number
+ * @param array $matches Matches from preg_rpelace_callback, [1] is the
+ * token number
+ *
* @return string The rendered text for the token
- * @access private
*/
- function _renderToken($matches) {
- return $this->renderObj[$this->tokens[$matches[1]][0]]->token($this->tokens[$matches[1]][1]);
+ private function _renderToken($matches)
+ {
+ return $this->renderObj[$this->tokens[$matches[1]][0]]->token(
+ $this->tokens[$matches[1]][1]
+ );
}
- function registerRenderCallback($callback) {
+ /**
+ * Register render callback
+ *
+ * @param mixed $callback Callback
+ *
+ * @return void
+ */
+ public function registerRenderCallback($callback)
+ {
$this->_blocks[] = $this->_block;
- $this->_block = '';
+ $this->_block = "";
$this->_renderCallbacks[] = $callback;
}
- function popRenderCallback() {
+ /**
+ * Pop a render callback off the stack.
+ *
+ * @return void
+ */
+ public function popRenderCallback()
+ {
if (count($this->_renderCallbacks) == 0) {
- return Text_Wiki::error('Render callback popped when no render callbacks in stack');
+ return Text_Wiki::error(
+ "Render callback popped when no render callbacks in stack"
+ );
} else {
$callback = array_pop($this->_renderCallbacks);
$this->_block = call_user_func($callback, $this->_block);
@@ -1145,47 +1077,37 @@ class Text_Wiki {
}
if (count($this->_renderCallbacks) == 0) {
$this->output .= $this->_block;
- $this->_block = '';
+ $this->_block = "";
}
}
}
/**
- *
- * Returns the parsed source text with delimited token placeholders.
- *
- * @access public
- *
- * @return string The parsed source text.
- *
- */
-
- function getSource()
+ * Returns the parsed source text with delimited token placeholders.
+ *
+ * @return string The parsed source text.
+ */
+ public function getSource()
{
return $this->source;
}
/**
- *
- * Returns tokens that have been parsed out of the source text.
- *
- * @access public
- *
- * @param array $rules If an array of rule names is passed, only return
- * tokens matching these rule names. If no array is passed, return all
- * tokens.
- *
- * @return array An array of tokens.
- *
- */
-
- function getTokens($rules = null)
+ * Returns tokens that have been parsed out of the source text.
+ *
+ * @param array $rules If an array of rule names is passed, only return
+ * tokens matching these rule names. If no array is
+ * passed, return all tokens.
+ *
+ * @return array An array of tokens.
+ */
+ public function getTokens($rules = null)
{
if (is_null($rules)) {
return $this->tokens;
} else {
- settype($rules, 'array');
+ settype($rules, "array");
$result = array();
foreach ($this->tokens as $key => $val) {
if (in_array($val[0], $rules)) {
@@ -1198,28 +1120,25 @@ class Text_Wiki {
/**
- *
- * Add a token to the Text_Wiki tokens array, and return a delimited
- * token number.
- *
- * @access public
- *
- * @param array $options An associative array of options for the new
- * token array element. The keys and values are specific to the
- * rule, and may or may not be common to other rule options. Typical
- * options keys are 'text' and 'type' but may include others.
- *
- * @param boolean $id_only If true, return only the token number, not
- * a delimited token string.
- *
- * @return string|int By default, return the number of the
- * newly-created token array element with a delimiter prefix and
- * suffix; however, if $id_only is set to true, return only the token
- * number (no delimiters).
- *
- */
-
- function addToken($rule, $options = array(), $id_only = false)
+ * Add a token to the Text_Wiki tokens array, and return a delimited
+ * token number.
+ *
+ * @param string $rule Rule
+ * @param array $options An associative array of options for the new
+ * token array element. The keys and values
+ * are specific to the rule, and may or may
+ * not be common to other rule options.
+ * Typical options keys are 'text' and 'type'
+ * but may include others.
+ * @param boolean $id_only If true, return only the token number, not
+ * a delimited token string.
+ *
+ * @return string|int By default, return the number of the
+ * newly-created token array element with a delimiter prefix and
+ * suffix; however, if $id_only is set to true, return only the token
+ * number (no delimiters).
+ */
+ public function addToken($rule, $options = array(), $id_only = false)
{
// increment the token ID number. note that if you parse
// multiple times with the same Text_Wiki object, the ID number
@@ -1232,7 +1151,7 @@ class Text_Wiki {
}
// force the options to be an array
- settype($options, 'array');
+ settype($options, "array");
// add the token
$this->tokens[$id] = array(
@@ -1255,37 +1174,30 @@ class Text_Wiki {
}
}
-
/**
- *
- * Set or re-set a token with specific information, overwriting any
- * previous rule name and rule options.
- *
- * @access public
- *
- * @param int $id The token number to reset.
- *
- * @param int $rule The rule name to use.
- *
- * @param array $options An associative array of options for the
- * token array element. The keys and values are specific to the
- * rule, and may or may not be common to other rule options. Typical
- * options keys are 'text' and 'type' but may include others.
- *
- * @return void
- *
- */
-
- function setToken($id, $rule, $options = array())
+ * Set or re-set a token with specific information, overwriting any
+ * previous rule name and rule options.
+ *
+ * @param int $id The token number to reset.
+ * @param int $rule The rule name to use.
+ * @param array $options An associative array of options for the
+ * token array element. The keys and values are
+ * specific to the rule, and may or may not be common
+ * to other rule options. Typical options keys are
+ * 'text' and 'type' but may include others.
+ *
+ * @return void
+ */
+ public function setToken($id, $rule, $options = array())
{
- $oldRule = $this->tokens[$id][0];
+ $oldRule = isset($this->tokens[$id]) ? $this->tokens[$id][0] : null;
// reset the token
$this->tokens[$id] = array(
0 => $rule,
1 => $options
);
if ($rule != $oldRule) {
- if (!($this->_countRulesTokens[$oldRule]--)) {
+ if (isset($oldRule) && !($this->_countRulesTokens[$oldRule]--)) {
unset($this->_countRulesTokens[$oldRule]);
}
if (!isset($this->_countRulesTokens[$rule])) {
@@ -1296,54 +1208,62 @@ class Text_Wiki {
}
}
-
/**
- *
- * Load a rule parser class file.
- *
- * @access public
- *
- * @return bool True if loaded, false if not.
- *
- */
-
- function loadParseObj($rule)
+ * Load a rule parser class file.
+ *
+ * @param string $rule name of rule to load
+ *
+ * @return bool True if loaded, false if not.
+ */
+ public function loadParseObj($rule)
{
+ // Fix undefined offset error.
+ $name = "";
+ $exploded = explode("_", get_class($this));
+ if (isset($exploded[2])) {
+ $name = isset($exploded[2]);
+ }
+
$rule = ucwords(strtolower($rule));
- $file = $rule . '.php';
- $class = "Text_Wiki_Parse_$rule";
- if (! class_exists($class)) {
- $loc = $this->findFile('parse', $file);
- if ($loc) {
- // found the class
- include_once $loc;
- } else {
- // can't find the class
- $this->parseObj[$rule] = null;
- // can't find the class
- return $this->error(
- "Parse rule '$rule' not found"
- );
+ /* Attempt to load the correct class, or fall back on
+ * the 'default' implementation.
+ */
+ foreach (array($name, "Default") as $package_name) {
+ $class = "Text_Wiki_Parse_" . $package_name . "_" . $rule;
+
+ if (! class_exists($class)) {
+ $loc = $this->findFile("parse", $rule . ".php");
+ if ($loc) {
+ // found the class
+ include_once $loc;
+ }
}
- }
+ if (class_exists($class)) {
+ $this->parseObj[$rule] = new $class($this);
- $this->parseObj[$rule] =& new $class($this);
+ return;
+ }
+ }
+ // can't find the class
+ $this->parseObj[$rule] = null;
+ // can't find the class
+ return $this->error(
+ "Parse rule '$rule' not found"
+ );
}
/**
- *
- * Load a rule-render class file.
- *
- * @access public
- *
- * @return bool True if loaded, false if not.
- *
- */
-
- function loadRenderObj($format, $rule)
+ * Load a rule-render class file.
+ *
+ * @param string $format format
+ * @param string $rule rule
+ *
+ * @return bool True if loaded, false if not.
+ */
+ public function loadRenderObj($format, $rule)
{
$format = ucwords(strtolower($format));
$rule = ucwords(strtolower($rule));
@@ -1352,7 +1272,7 @@ class Text_Wiki {
if (! class_exists($class)) {
// load the class
- $loc = $this->findFile('render', $file);
+ $loc = $this->findFile("render", $file);
if ($loc) {
// found the class
include_once $loc;
@@ -1363,29 +1283,24 @@ class Text_Wiki {
);
}
}
-
- $this->renderObj[$rule] =& new $class($this);
+ $this->renderObj[$rule] = new $class($this);
}
-
/**
- *
- * Load a format-render class file.
- *
- * @access public
- *
- * @return bool True if loaded, false if not.
- *
- */
-
- function loadFormatObj($format)
+ * Load a format-render class file.
+ *
+ * @param string $format format
+ *
+ * @return bool True if loaded, false if not.
+ */
+ public function loadFormatObj($format)
{
$format = ucwords(strtolower($format));
- $file = $format . '.php';
+ $file = $format . ".php";
$class = "Text_Wiki_Render_$format";
if (! class_exists($class)) {
- $loc = $this->findFile('render', $file);
+ $loc = $this->findFile("render", $file);
if ($loc) {
// found the class
include_once $loc;
@@ -1397,25 +1312,19 @@ class Text_Wiki {
}
}
- $this->formatObj[$format] =& new $class($this);
+ $this->formatObj[$format] = new $class($this);
}
/**
- *
- * Add a path to a path array.
- *
- * @access public
- *
- * @param string $type The path-type to add (parse or render).
- *
- * @param string $dir The directory to add to the path-type.
- *
- * @return void
- *
- */
-
- function addPath($type, $dir)
+ * Add a path to a path array.
+ *
+ * @param string $type The path-type to add (parse or render).
+ * @param string $dir The directory to add to the path-type.
+ *
+ * @return void
+ */
+ public function addPath($type, $dir)
{
$dir = $this->fixPath($dir);
if (! isset($this->path[$type])) {
@@ -1427,19 +1336,14 @@ class Text_Wiki {
/**
- *
- * Get the current path array for a path-type.
- *
- * @access public
- *
- * @param string $type The path-type to look up (plugin, filter, or
- * template). If not set, returns all path types.
- *
- * @return array The array of paths for the requested type.
- *
- */
-
- function getPath($type = null)
+ * Get the current path array for a path-type.
+ *
+ * @param string $type The path-type to look up (plugin, filter, or
+ * template). If not set, returns all path types.
+ *
+ * @return array The array of paths for the requested type.
+ */
+ public function getPath($type = null)
{
if (is_null($type)) {
return $this->path;
@@ -1452,20 +1356,16 @@ class Text_Wiki {
/**
- *
- * Searches a series of paths for a given file.
- *
- * @param array $type The type of paths to search (template, plugin,
- * or filter).
- *
- * @param string $file The file name to look for.
- *
- * @return string|bool The full path and file name for the target file,
- * or boolean false if the file is not found in any of the paths.
- *
- */
-
- function findFile($type, $file)
+ * Searches a series of paths for a given file.
+ *
+ * @param array $type The type of paths to search (template, plugin,
+ * or filter).
+ * @param string $file The file name to look for.
+ *
+ * @return string|bool The full path and file name for the target file,
+ * or boolean false if the file is not found in any of the paths.
+ */
+ public function findFile($type, $file)
{
// get the set of paths
$set = $this->getPath($type);
@@ -1484,23 +1384,17 @@ class Text_Wiki {
/**
- *
- * Append a trailing '/' to paths, unless the path is empty.
- *
- * @access private
- *
- * @param string $path The file path to fix
- *
- * @return string The fixed file path
- *
- */
-
- function fixPath($path)
+ * Append a trailing '/' to paths, unless the path is empty.
+ *
+ * @param string $path The file path to fix
+ *
+ * @return string The fixed file path
+ */
+ public function fixPath($path)
{
$len = strlen($this->_dirSep);
- if (! empty($path) &&
- substr($path, -1 * $len, $len) != $this->_dirSep) {
+ if (!empty($path) && substr($path, -1 * $len, $len) != $this->_dirSep) {
return $path . $this->_dirSep;
} else {
return $path;
@@ -1509,42 +1403,31 @@ class Text_Wiki {
/**
- *
- * Simple error-object generator.
- *
- * @access public
- *
- * @param string $message The error message.
- *
- * @return object PEAR_Error
- *
- */
-
- function &error($message)
+ * Simple error-object generator.
+ *
+ * @param string $message The error message.
+ *
+ * @return object PEAR_Error
+ */
+ public function error($message)
{
- if (! class_exists('PEAR_Error')) {
- include_once 'PEAR.php';
+ if (! class_exists("PEAR_Error")) {
+ include_once "PEAR.php";
}
- return PEAR::throwError($message);
+ $pear = new PEAR();
+ return $pear->throwError($message);
}
/**
- *
- * Simple error checker.
- *
- * @access public
- *
- * @param mixed $obj Check if this is a PEAR_Error object or not.
- *
- * @return bool True if a PEAR_Error, false if not.
- *
- */
-
- function isError(&$obj)
+ * Simple error checker.
+ *
+ * @param mixed $obj Check if this is a PEAR_Error object or not.
+ *
+ * @return bool True if a PEAR_Error, false if not.
+ */
+ public static function isError(&$obj)
{
- return is_a($obj, 'PEAR_Error');
+ return is_a($obj, "PEAR_Error");
}
}
-
-?>
diff --git a/includes/pear/Text/Wiki/Default.php b/includes/pear/Text/Wiki/Default.php
index 379cf12..f065a04 100644..100755
--- a/includes/pear/Text/Wiki/Default.php
+++ b/includes/pear/Text/Wiki/Default.php
@@ -9,11 +9,11 @@
* @package Text_Wiki
* @author Justin Patrin <justinpatrin@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Default.php 208363 2006-03-01 16:58:17Z justinpatrin $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
-require_once('Text/Wiki.php');
+require_once("Text/Wiki.php");
/**
* This is the parser for the Default ruleset. For now, this simply extends Text_Wiki.
diff --git a/includes/pear/Text/Wiki/Parse.php b/includes/pear/Text/Wiki/Parse.php
index 1b14c89..5c07d3c 100644..100755
--- a/includes/pear/Text/Wiki/Parse.php
+++ b/includes/pear/Text/Wiki/Parse.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Parse.php 191781 2005-07-29 08:57:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -106,7 +106,7 @@ class Text_Wiki_Parse {
*
*/
- function Text_Wiki_Parse(&$obj)
+ function __construct(&$obj)
{
// set the reference to the calling Text_Wiki object;
// this allows us access to the shared source text, token
@@ -117,7 +117,7 @@ class Text_Wiki_Parse {
// to the tokens array. strip off the Text_Wiki_Parse_ portion.
// text_wiki_parse_
// 0123456789012345
- $tmp = substr(get_class($this), 16);
+ list(,,,,$tmp) = explode("_", get_class($this));
$this->rule = ucwords(strtolower($tmp));
// override config options for the rule if specified
@@ -135,6 +135,22 @@ class Text_Wiki_Parse {
/**
*
+ * Constructor for this parser rule.
+ *
+ * @access public
+ *
+ * @param object &$obj The calling "parent" Text_Wiki object.
+ *
+ */
+
+ function Text_Wiki_Parse(&$obj)
+ {
+ self::__construct($obj);
+ }
+
+
+ /**
+ *
* Abstrct method to parse source text for matches.
*
* Applies the rule's regular expression to the source text, passes
@@ -151,7 +167,7 @@ class Text_Wiki_Parse {
{
$this->wiki->source = preg_replace_callback(
$this->regex,
- array(&$this, 'process'),
+ array(&$this, "process"),
$this->wiki->source
);
}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Blockquote.php b/includes/pear/Text/Wiki/Parse/BBCode/Blockquote.php
new file mode 100755
index 0000000..3030e97
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Blockquote.php
@@ -0,0 +1,91 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for block-quoted text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text block-quoted
+ * as defined by text surrounded by [quote="author"] ... [/quote] (author optional)
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Blockquote.php,v 1.4 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Block-quoted text rule parser class (with nesting) for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Blockquote 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.
+ * We match [quote=..] ... [/quote] with nesting
+ *
+ * @access public
+ * @var string
+ * @see Text_Wiki_Parse::parse()
+ */
+ var $regex = '#\[quote(?:=\s*"(.*?)")?\s*]((?:((?R))|.)*?)\[/quote]#msi';
+
+ /**
+ * The current quote nesting depth, starts by zero
+ *
+ * @access private
+ * @var int
+ */
+ var $_level = 0;
+
+ /**
+ * Generates a replacement for the matched text. Token options are:
+ * - 'type' => ['start'|'end'] The starting or ending point of the block-quoted text.
+ * The text itself is left in the source but may content bested blocks
+ * - 'level' => the level of nesting (starting 0)
+ * - 'name' => the author indicator (optional)
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return string Delimited by start/end tokens to be used as
+ * placeholder in the source text surrounding the text to be quoted.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ // nested block ?
+ if (array_key_exists(3, $matches)) {
+ $this->_level++;
+ $expsub = preg_replace_callback(
+ $this->regex,
+ array(&$this, "process"),
+ $matches[2]
+ );
+ $this->_level--;
+ } else {
+ $expsub = $matches[2];
+ }
+
+ // builds the option array
+ $options = array("type" => "start", "level"=>$this->_level);
+ if (isset($matches[1])) {
+ $options["name"] = $matches[1];
+ }
+ $statok = $this->wiki->addToken($this->rule, $options);
+ $options["type"] = "end";
+ return $statok . $expsub . $this->wiki->addToken($this->rule, $options);
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Bold.php b/includes/pear/Text/Wiki/Parse/BBCode/Bold.php
new file mode 100755
index 0000000..b2391d2
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Bold.php
@@ -0,0 +1,63 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for bold text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked for
+ * strong emphasis (bold) as defined by text surrounded by [b] ... [/b]
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Bold.php,v 1.3 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Bold text rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Bold 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 = "#\[b](.*?)\[/b]#i";
+
+
+ /**
+ * 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.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A pair of delimited tokens to be used as a placeholder in
+ * the source text surrounding the text to be emphasized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
+ return $start . $matches[1] . $end;
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Code.php b/includes/pear/Text/Wiki/Parse/BBCode/Code.php
new file mode 100755
index 0000000..6513baf
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Code.php
@@ -0,0 +1,63 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for code blocks.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked as
+ * code blocks as defined by text surrounded by [code] ... [/code]
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens. (nested blocks ignored)
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Code.php,v 1.3 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Code block rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Code 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 = "#\[code]((?:(?R)|.)*?)\[/code]#msi";
+
+
+ /**
+ * Generates a replacement for the matched text. Token options are:
+ * - 'text' => the contained text
+ * - 'attr' => type empty
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A delimited token to be used as a placeholder in
+ * the source text and containing the original block of text
+ * @access public
+ */
+ function process(&$matches)
+ {
+ return $this->wiki->addToken($this->rule, array(
+ "text" => $matches[1],
+ "attr" => array("type" => "") ) );
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Colortext.php b/includes/pear/Text/Wiki/Parse/BBCode/Colortext.php
new file mode 100755
index 0000000..51cbdc6
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Colortext.php
@@ -0,0 +1,92 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for color text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text coloured
+ * as defined by text surrounded by [color=...] ... [/color]
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Colortext.php,v 1.5 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Colored text rule parser class (with nesting) for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+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.
+ * We match either [color..] ... [/color] nested
+ *
+ * @access public
+ * @var string
+ * @see Text_Wiki_Parse::parse()
+ */
+
+ var $regex = "'(?:\[color=(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|\#?[0-9a-f]{6})]((?:((?R))|.)*?)\[/color])'msi";
+
+ /**
+ * The current color nesting depth, starts by zero
+ *
+ * @access private
+ * @var int
+ */
+ var $_level = 0;
+
+ /**
+ * Generates a replacement for the matched text. Token options are:
+ * - 'type' => ['start'|'end'] The starting or ending point of the colored text.
+ * The text itself is left in the source but may content bested blocks
+ * - 'level' => the level of nesting (starting 0)
+ * - 'color' => the color indicator
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return string Delimited by start/end tokens to be used as
+ * placeholder in the source text surrounding the text to be colored.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ // nested block ?
+ if (array_key_exists(2, $matches)) {
+ $this->_level++;
+ $expsub = preg_replace_callback(
+ $this->regex,
+ array(&$this, "process"),
+ $matches[2]
+ );
+ $this->_level--;
+ } else {
+ $expsub = $matches[2];
+ }
+
+ // needs to withdraw leading # as renderer put it in
+ $color = $matches[1][0] == "#" ? substr($matches[1], 1) : $matches[1];
+
+ // builds the option array
+ $options = array("type" => "start", "level" => $this->_level, "color" => $color);
+ $statok = $this->wiki->addToken($this->rule, $options);
+ $options["type"] = "end";
+ return $statok . $expsub . $this->wiki->addToken($this->rule, $options);
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Font.php b/includes/pear/Text/Wiki/Parse/BBCode/Font.php
new file mode 100755
index 0000000..aa83403
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Font.php
@@ -0,0 +1,87 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for font size tag.
+ *
+ * This class implements a Text_Wiki_Rule to find source text with size
+ * as defined by text surrounded by [size=...] ... [/size] (nesting)
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Font.php,v 1.4 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Font rule parser class (with nesting) for BBCode. ([size=...]...[/size])
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Font 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 = "#\[size=(\d+)]((?:((?R))|.)*?)\[/size]#msi";
+
+ /**
+ * The current font nesting depth, starts by zero
+ *
+ * @access private
+ * @var int
+ */
+ var $_level = 0;
+
+ /**
+ * Generates a replacement for the matched text. Token options are:
+ * - 'type' => ['start'|'end'] The starting or ending point of the sized text.
+ * The text itself is left in the source but may content bested blocks
+ * - 'level' => the level of nesting (starting 0)
+ * - 'size' => the size indicator
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return string Delimited by start/end tokens to be used as
+ * placeholder in the source text surrounding the text to be sized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ // nested block ?
+ if (array_key_exists(3, $matches)) {
+ $this->_level++;
+ $expsub = preg_replace_callback(
+ $this->regex,
+ array(&$this, "process"),
+ $matches[2]
+ );
+ $this->_level--;
+ } else {
+ $expsub = $matches[2];
+ }
+
+ // builds the option array
+ $options = array("type" => "start", "level" => $this->_level, "size" => $matches[1]);
+ $statok = $this->wiki->addToken($this->rule, $options);
+ $options["type"] = "end";
+ return $statok . $expsub . $this->wiki->addToken($this->rule, $options);
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Image.php b/includes/pear/Text/Wiki/Parse/BBCode/Image.php
new file mode 100755
index 0000000..dc4ab0e
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Image.php
@@ -0,0 +1,102 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for image tags
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked as
+ * images as defined by text surrounded by [img] ... [/img]
+ * The tags and the text itself is replaced with a token.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Image.php,v 1.6 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Image rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
+
+ /**
+ * Configuration keys for this rule
+ * 'schemes' => URL scheme(s) (array) recognized by this rule, default is 'http|ftp|https|ftps'
+ * That is some (array of) regex string(s), must be safe with a pattern delim '#'
+ * 'extensions' => URL scheme(s) (array) recognized by this rule, default is 'jpg|jpeg|gif|png'
+ * That is some (array of) regex string(s), must be safe with a pattern delim '#'
+ * 'url_regexp' => the regexp used to match the url after 'scheme://' and before '.extension'
+ * 'path_regexp' => the regexp used to match the local images path before '.extension'
+ *
+ * @access public
+ * @var array 'config-key' => mixed config-value
+ */
+ var $conf = array(
+ "schemes" => "http|ftp|https|ftps", // can be also as array of regexps/strings
+ "extensions" => "jpg|jpeg|gif|png", // can be also as array of regexps/strings
+ "url_regexp" =>
+ '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?(?:/[^\s"<>\\\#delim#\ca-\cz]*)?',
+ "local_regexp" => '(?:/?[^/\s"<\\\#delim#\ca-\cz]+)*'
+ );
+
+ /**
+ * Constructor.
+ * We override the constructor to build up the regex from config
+ *
+ * @param object &$obj the base conversion handler
+ * @return The parser object
+ * @access public
+ */
+ function Text_Wiki_Parse_Image(&$obj)
+ {
+ $default = $this->conf;
+ parent::Text_Wiki_Parse($obj);
+
+ // convert the list of recognized schemes to a regex OR,
+ $schemes = $this->getConf("schemes", $default["schemes"]);
+ $this->regex = '#\[img]((?:(?:' . (is_array($schemes) ? implode("|", $schemes) : $schemes) . ")://" .
+ $this->getConf("url_regexp", $default["url_regexp"]);
+ if ($local = $this->getConf("local_regexp", $default["local_regexp"])) {
+ $this->regex .= "|" . ( is_array($local) ? implode("|", $local) : $local );
+ }
+ $this->regex .= ")";
+ // add the extensions if any
+ if ($extensions = $this->getConf("extensions", array())) {
+ if (is_array($extensions)) {
+ $extensions = implode("|", $extensions);
+ }
+ $this->regex .= '\.(?:' . $extensions . ")";
+ }
+ // replace delim in the regexps
+ $this->regex = str_replace( "#delim#", $this->wiki->delim, $this->regex);
+ $this->regex .= ')\[/img]#i';
+ }
+
+ /**
+ * Generates a replacement token for the matched text. Token options are:
+ * 'src' => the URL / path to the image
+ * 'attr' => empty for basic BBCode
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return string Delimited token representing the image
+ * @access public
+ */
+ function process(&$matches)
+ {
+ // tokenize
+ return $this->wiki->addToken($this->rule, array("src" => $matches[1], "attr" => array()));
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Italic.php b/includes/pear/Text/Wiki/Parse/BBCode/Italic.php
new file mode 100755
index 0000000..898fdbb
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Italic.php
@@ -0,0 +1,62 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for italic text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked for
+ * strong emphasis (italic) as defined by text surrounded by [i] ... [/i]
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Italic.php,v 1.3 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Italic text rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Italic 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 = "#\[i](.*?)\[/i]#i";
+
+ /**
+ * 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.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A pair of delimited tokens to be used as a placeholder in
+ * the source text surrounding the text to be emphasized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
+ return $start . $matches[1] . $end;
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/List.php b/includes/pear/Text/Wiki/Parse/BBCode/List.php
new file mode 100755
index 0000000..93cd539
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/List.php
@@ -0,0 +1,187 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for code blocks.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked as
+ * bulleted or numbered lists as defined by text surrounded by [list] [*] ... [/list]
+ * Numebering is obtained thru [list=1] or [list=a] defining the first item "number"
+ * On parsing, the text itself is left in place, but the starting, element and ending
+ * tags are replaced with tokens. (nested lists enabled)
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: List.php,v 1.6 2006/12/22 14:43:06 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * List rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_List 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 = "#\[list(?:=(.+?))?]\n?((?:((?R))|.)*?)\[/list]\n?#msi";
+
+ /**
+ * The regular expression used in second stage to find list's elements
+ * used by process() to call back processElement()
+ *
+ * @access public
+ * @var string
+ * @see process()
+ * @see processElement()
+ */
+ var $regexElement = '#\[\*](.*?)(?=\[\*]|$)\n?#msi';
+
+ /**
+ * The current list nesting depth, starts by zero
+ *
+ * @access private
+ * @var int
+ */
+ var $_level = 0;
+
+ /**
+ * The count of items for this level
+ *
+ * @access private
+ * @var int
+ */
+ var $_count = array();
+
+ /**
+ * The type of list for this level ('bullet' or 'number')
+ *
+ * @access private
+ * @var int
+ */
+ var $_type = array();
+
+ /**
+ * Generates a replacement for the matched text. Returned token options are:
+ * 'type' =>
+ * 'bullet_list_start' : the start of a bullet list
+ * 'bullet_list_end' : the end of a bullet list
+ * 'number_list_start' : the start of a number list
+ * 'number_list_end' : the end of a number list
+ * 'item_start' : the start of item text (bullet or number)
+ * 'item_end' : the end of item text (bullet or number)
+ * 'unknown' : unknown type of list or item
+ *
+ * 'level' => the indent level (0 for the first level, 1 for the
+ * second, etc)
+ *
+ * 'count' => the list item number at this level. not needed for
+ * xhtml, but very useful for PDF and RTF.
+ *
+ * 'format' => the optional enumerating type : A, a, I, i, or 1 (default)
+ * as HTML <ol> tag's type attribute (only for number_... type)
+ *
+ * 'key' => the optional starting number/letter (not for items)
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A delimited token to be used as a placeholder in
+ * the source text and containing the original block of text
+ * @access public
+ */
+ function process(&$matches)
+ {
+ if (!empty($matches[3])) {
+ $this->_level++;
+ $expsub = preg_replace_callback(
+ $this->regex,
+ array(&$this, "process"),
+ $matches[2]
+ );
+ $this->_level--;
+ } else {
+ $expsub = $matches[2];
+ }
+ if ($matches[1]) {
+ $this->_type[$this->_level] = "number";
+ if (is_numeric($matches[1])) {
+ $format = "1";
+ $key = $matches[1] + 0;
+ } elseif (($matches[1] == "i") || ($matches[1] == "I")) {
+ $format = $matches[1];
+ } else {
+ $format =
+ ($matches[1] >= "a") && ($matches[1] <="z") ? "a" : "A";
+ $key = $matches[1];
+ }
+ } else {
+ $this->_type[$this->_level] = "bullet";
+ }
+ $this->_count[$this->_level] = -1;
+ $sub = preg_replace_callback(
+ $this->regexElement,
+ array(&$this, "processElement"),
+ $expsub
+ );
+ $param = array(
+ "level" => $this->_level,
+ "count" => $this->_count[$this->_level] );
+ $param["type"] = $this->_type[$this->_level]."_list_start";
+ if (isset($format)) {
+ $param["format"] = $format;
+ }
+ if (isset($key)) {
+ $param["key"] = $key;
+ }
+ $ret = $this->wiki->addToken($this->rule, $param );
+ $param["type"] = $this->_type[$this->_level]."_list_end";
+ return $ret . $sub . $this->wiki->addToken($this->rule, $param );
+ }
+
+ /**
+ * Generates a replacement for the matched list elements. Token options are:
+ * 'type' =>
+ * '[listType]_item_start' : the start of item text (bullet or number)
+ * '[listType]_item_end' : the end of item text (bullet or number)
+ * where [listType] is bullet or number
+ *
+ * 'level' => the indent level (0 for the first level, 1 for the
+ * second, etc)
+ *
+ * 'count' => the item ordeer at this level.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A delimited token to be used as a placeholder in
+ * the source text and containing the original block of text
+ * @access public
+ */
+ function processElement(&$matches)
+ {
+ return $this->wiki->addToken($this->rule, array(
+ "type" => $this->_type[$this->_level] . "_item_start",
+ "level" => $this->_level,
+ "count" => ++$this->_count[$this->_level]) ) .
+ rtrim($matches[1]) .
+ $this->wiki->addToken($this->rule, array(
+ "type" => $this->_type[$this->_level] . "_item_end",
+ "level" => $this->_level,
+ "count" => $this->_count[$this->_level]) );
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Subscript.php b/includes/pear/Text/Wiki/Parse/BBCode/Subscript.php
new file mode 100755
index 0000000..c115d69
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Subscript.php
@@ -0,0 +1,85 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
+
+// {{{ Header
+
+/**
+ * BBCode: Parses for subscript text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked for
+ * strong emphasis (subscript) text as defined by text surrounded by
+ * [sub] ... [/sub] On parsing, the text itself is left in place, but
+ * the starting and ending tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Firman Wandayandi <firman@php.net>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lgpl.html
+ * GNU Lesser General Public License, version 2.1
+ * @version CVS: $Id: Subscript.php,v 1.2 2006/02/21 22:47:53 toggg Exp $
+ */
+
+// }}}
+// {{{ Class: Text_Wiki_Parse_Subscript
+
+/**
+ * Subscript text rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Firman Wandayandi <firman@php.net>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lgpl.html
+ * GNU Lesser General Public License, version 2.1
+ * @version Release: @package_version@
+ */
+class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse
+{
+ // {{{ Properties
+
+ /**
+ * 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 = "#\[sub](.*?)\[/sub]#i";
+
+ // }}}
+ // {{{ process()
+
+ /**
+ * 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.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A pair of delimited tokens to be used as a placeholder in
+ * the source text surrounding the text to be emphasized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
+ return $start . $matches[1] . $end;
+ }
+
+ // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Superscript.php b/includes/pear/Text/Wiki/Parse/BBCode/Superscript.php
new file mode 100755
index 0000000..334f7b0
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Superscript.php
@@ -0,0 +1,84 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
+
+// {{{ Header
+
+/**
+ * BBCode: Parses for superscript text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked for
+ * strong emphasis (superscript) text as defined by text surrounded by
+ * [sup] ... [/sup] On parsing, the text itself is left in place, but
+ * the starting and ending tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Firman Wandayandi <firman@php.net>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lgpl.html
+ * GNU Lesser General Public License, version 2.1
+ * @version CVS: $Id: Superscript.php,v 1.2 2006/02/21 22:47:53 toggg Exp $
+ */
+
+// }}}
+// {{{ Class: Text_Wiki_Parse_Superscript
+
+/**
+ * Superscript text rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Firman Wandayandi <firman@php.net>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lgpl.html
+ * GNU Lesser General Public License, version 2.1
+ * @version Release: @package_version@
+ */
+class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse
+{
+ // {{{ Properties
+
+ /**
+ * 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 = "#\[sup](.*?)\[/sup]#i";
+
+ // {{{ process()
+
+ /**
+ * 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.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A pair of delimited tokens to be used as a placeholder in
+ * the source text surrounding the text to be emphasized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
+ return $start . $matches[1] . $end;
+ }
+
+ // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Underline.php b/includes/pear/Text/Wiki/Parse/BBCode/Underline.php
new file mode 100755
index 0000000..ac291fd
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Underline.php
@@ -0,0 +1,63 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for underlined text.
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked for
+ * strong emphasis (underline) as defined by text surrounded by [u] ... [/u]
+ * On parsing, the text itself is left in place, but the starting and ending
+ * tags are replaced with tokens.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Underline.php,v 1.3 2006/02/21 22:47:53 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Underlined text rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Underline 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 = "#\[u](.*?)\[/u]#i";
+
+
+ /**
+ * 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.
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return A pair of delimited tokens to be used as a placeholder in
+ * the source text surrounding the text to be emphasized.
+ * @access public
+ */
+ function process(&$matches)
+ {
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
+ return $start . $matches[1] . $end;
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/BBCode/Url.php b/includes/pear/Text/Wiki/Parse/BBCode/Url.php
new file mode 100755
index 0000000..7b56c15
--- /dev/null
+++ b/includes/pear/Text/Wiki/Parse/BBCode/Url.php
@@ -0,0 +1,185 @@
+<?php
+// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/**
+ * BBCode: Parses for url and mail links
+ *
+ * This class implements a Text_Wiki_Rule to find source text marked as
+ * links as defined by text surrounded by [url] ... [/url], [mail] ... [/mail]
+ * described as [url=..., [mail= or direct in lines url or mails adresses
+ * The eventual tags and the text itself is replaced with a token.
+ *
+ * PHP versions 4 and 5
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @copyright 2005 bertrand Gugger
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
+ * @version CVS: $Id: Url.php,v 1.9 2006/12/22 09:16:24 toggg Exp $
+ * @link http://pear.php.net/package/Text_Wiki
+ */
+
+/**
+ * Url rule parser class for BBCode.
+ *
+ * @category Text
+ * @package Text_Wiki
+ * @author Bertrand Gugger <bertrand@toggg.com>
+ * @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_Parse::Text_Wiki_Parse()
+ */
+class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
+
+ /**
+ * Configuration keys for this rule
+ * 'schemes' => URL scheme(s) (array) recognized by this rule, default is the single rfc2396 pattern
+ * That is some (array of) regex string(s), must be safe with a pattern delim '#'
+ * 'refused' => which schemes are refused (usefull if 'schemes' is not an exhaustive list as by default
+ * 'prefixes' => which prefixes are usable for "lazy" url as www.xxxx.yyyy... (defaulted to http://...)
+ * 'host_regexp' => the regexp used to match the host part of url (after 'scheme://')
+ * 'path_regexp' => the regexp used to match the rest of url (starting with '/' included)
+ * 'user_regexp' => the regexp used to match user name in email
+ * 'inline_enable' => are inline urls and emails enabled (default true)
+ *
+ * @var array 'config-key' => mixed config-value
+ * @access public
+ */
+ var $conf = array(
+ "schemes" => "[a-z][-+.a-z0-9]*", // can be also as array('htpp', 'htpps', 'ftp')
+ "refused" => array("script", "about", "applet", "activex", "chrome"),
+ "prefixes" => array("www", "ftp"),
+ "host_regexp" => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?',
+ "path_regexp" => '(?:/[^][\'\s"<\\\#delim#\ca-\cz]*)?',
+ "user_regexp" => '[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+(?:\.[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+)*',
+ "inline_enable" => true,
+ "relative_enable" => false
+ );
+
+ /**
+ * The regular expressions 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 = array(
+ '#\[url(?:(=)|])(#url#)(?(1)](.*?))\[/url]#mi',
+ '#([\n\r\s#delim#])(#url#)#i',
+ '#\[(email)(?:(=)|])(#email#)(?(2)](.*?))\[/email]#mi',
+ '#([\n\r\s#delim#](mailto:)?)(#email#)#i',
+ );
+
+ /**
+ * Constructor.
+ * We override the constructor to build up the regex from config
+ *
+ * @param object &$obj the base conversion handler
+ * @return The parser object
+ * @access public
+ */
+ function Text_Wiki_Parse_Url(&$obj)
+ {
+ $default = $this->conf;
+ parent::Text_Wiki_Parse($obj);
+
+ // store the list of refused schemes
+ $this->refused = $this->getConf("refused", array());
+ if (is_string($this->refused)) {
+ $this->refused = array($this->refused);
+ }
+ // convert the list of recognized schemes to a regex OR,
+ $schemes = $this->getConf("schemes", $default["schemes"]);
+ $url = "(?:(" . (is_array($schemes) ? implode("|", $schemes) : $schemes) . ")://";
+ // add the "lazy" prefixes if any
+ $prefixes = $this->getConf("prefixes", array());
+ foreach ($prefixes as $val) {
+ $url .= "|" . preg_quote($val, "#") . '\.';
+ }
+ $host = $this->getConf("host_regexp", $default["host_regexp"]);
+ $path = $this->getConf("path_regexp", $default["path_regexp"]);
+ // the full url regexp
+ $url .= ")" . $host . $path;
+ // the full email regexp
+ $email = $this->getConf("user_regexp", $default["user_regexp"]) . "@" . $host;
+ // inline to disable ?
+ if (!$this->getConf("inline_enable", true)) {
+ unset($this->regex[1]);
+ unset($this->regex[3]);
+ }
+ // relative url to enable ?
+ if ($this->getConf("relative_enable", false)) {
+ $this->regex[5] = str_replace( "#url#", $path, $this->regex[0]);
+ }
+ // replace in the regexps
+ $this->regex = str_replace( "#url#", $url, $this->regex);
+ $this->regex = str_replace( "#email#", $email, $this->regex);
+ $this->regex = str_replace( "#delim#", $this->wiki->delim, $this->regex);
+ }
+
+ /**
+ * Generates a replacement for the matched text. Token options are:
+ * 'type' => ['inline'|'footnote'|'descr'] the type of URL
+ * 'href' => the URL link href portion
+ * 'text' => the displayed text of the URL link
+ *
+ * @param array &$matches The array of matches from parse().
+ * @return string Delimited token representing the url
+ * @access public
+ */
+ function process(&$matches)
+ {
+ if ($this->refused && isset($matches[3]) && in_array($matches[3], $this->refused)) {
+ return $matches[0];
+ }
+ $pre = "";
+ $type = "inline";
+ if (isset($matches[1])) {
+ if (strpos(strtolower($matches[1]), "mail")) {
+ if (isset($matches[2])) {
+ if ($matches[2] === "=") {
+ $type = "descr";
+ } elseif ($matches[2]) {
+ $pre = $matches[1][0];
+ }
+ }
+ $matches[2] = "mailto:" . $matches[3];
+ if (!isset($matches[4])) {
+ $matches[4] = $matches[3];
+ }
+ } elseif ($matches[1] === "=") {
+ $type = "descr";
+ } else {
+ $pre = $matches[1];
+ if (!$matches[2]) {
+ $matches[2] = "mailto:" . $matches[3];
+ $matches[4] = $matches[3];
+ }
+ }
+ }
+ // set options
+ $href = (isset($matches[3]) ? "" : "http://") . $matches[2];
+ $text = isset($matches[4]) ? $matches[4] : $matches[2];
+
+ // tokenize
+ if ($type == "inline") {
+ return $pre . $this->wiki->addToken($this->rule, array(
+ "type" => $type,
+ "href" => $href,
+ "text" => $text));
+ }
+ return $pre .
+ $this->wiki->addToken($this->rule, array(
+ "type" => "start",
+ "href" => $href,
+ "text" => "")) .
+ $text .
+ $this->wiki->addToken($this->rule, array(
+ "type" => "end",
+ "href" => $href,
+ "text" => ""));
+ }
+}
diff --git a/includes/pear/Text/Wiki/Parse/Default/Anchor.php b/includes/pear/Text/Wiki/Parse/Default/Anchor.php
index 83b57c6..6b2c833 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Anchor.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Anchor.php
@@ -14,7 +14,7 @@
*
* @license LGPL
*
-* @version $Id: Anchor.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -33,7 +33,7 @@
*
*/
-class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Anchor extends Text_Wiki_Parse {
/**
@@ -72,16 +72,15 @@ class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
$start = $this->wiki->addToken(
$this->rule,
- array('type' => 'start', 'name' => $name)
+ array("type" => "start", "name" => $name)
);
$end = $this->wiki->addToken(
$this->rule,
- array('type' => 'end', 'name' => $name)
+ array("type" => "end", "name" => $name)
);
// done, place the script output directly in the source
return $start . trim($text) . $end;
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Blockquote.php b/includes/pear/Text/Wiki/Parse/Default/Blockquote.php
index 61da770..e06b85e 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Blockquote.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Blockquote.php
@@ -1,69 +1,69 @@
<?php
/**
-*
+*
* Parse for block-quoted text.
-*
+*
* @category Text
-*
+*
* @package Text_Wiki
-*
+*
* @author Paul M. Jones <pmjones@php.net>
-*
+*
* @license LGPL
-*
-* @version $Id: Blockquote.php 222150 2006-10-21 05:56:28Z justinpatrin $
-*
+*
+* @version $Id$
+*
*/
/**
-*
+*
* 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 <pmjones@php.net>
-*
+*
*/
-class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
-
-
+class Text_Wiki_Parse_Default_Blockquote extends Text_Wiki_Parse {
+
+
/**
- *
+ *
* Regex for parsing the source text.
- *
+ *
* @access public
- *
+ *
* @var string
- *
+ *
* @see parse()
- *
+ *
*/
-
- var $regex = '/\n((\>).*\n)(?!(\>))/Us';
-
-
+
+ var $regex = '/\n(\>+ .*\n)(?!\>+ )/Us';
+
+
/**
- *
+ *
* Generates a replacement for the matched text.
- *
+ *
* Token options are:
- *
+ *
* 'type' =>
* 'start' : the start of a blockquote
* 'end' : the end of a blockquote
*
* 'level' => the indent level (0 for the first level, 1 for the
* second, etc)
- *
+ *
* @access public
*
* @param array &$matches The array of matches from parse().
@@ -72,109 +72,90 @@ class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
* list text and list elements.
*
*/
-
+
function process(&$matches)
{
// the replacement text we will return to parse()
$return = "\n";
-
+
// the list of post-processing matches
$list = array();
-
- // $matches[1] is the text matched as a list set by parse();
+
+ // $matches[1] is the text matched as a blockquote by parse();
// create an array called $list that contains a new set of
- // matches for the various list-item elements.
+ // matches for the various blockquote lines.
preg_match_all(
'=^(\>+) (.*\n)=Ums',
$matches[1],
$list,
PREG_SET_ORDER
);
-
+
$curLevel = 0;
- // loop through each list-item element.
+ // loop through each blockquote line.
foreach ($list as $key => $val) {
-
- // $val[0] is the full matched list-item line
+
+ // $val[0] is the full matched line
// $val[1] is the number of initial '>' chars (indent level)
// $val[2] is the quote text
-
+
// we number levels starting at 1, not zero
$level = strlen($val[1]);
-
- // add a level to the list?
+
+ // add a level?
while ($level > $curLevel) {
// the current indent level is greater than the number
// of stack elements, so we must be starting a new
- // level. push the new level onto the stack with a
- // dummy value (boolean true)...
+ // level.
++$curLevel;
-
- //$return .= "\n";
-
+
// ...and add a start token to the return.
$return .= $this->wiki->addToken(
- $this->rule,
+ $this->rule,
array(
- 'type' => 'start',
- 'level' => $curLevel
+ "type" => "start",
+ "level" => $curLevel
)
);
-
- //$return .= "\n\n";
}
-
+
// remove a level?
while ($curLevel > $level) {
-
+
// as long as the stack count is greater than the
// current indent level, we need to end list types.
// continue adding end-list tokens until the stack count
// and the indent level are the same.
-
- //$return .= "\n\n";
-
+
$return .= $this->wiki->addToken(
- $this->rule,
+ $this->rule,
array (
- 'type' => 'end',
- 'level' => $curLevel
+ "type" => "end",
+ "level" => $curLevel
)
);
-
- //$return .= "\n";
+
--$curLevel;
}
-
+
// add the line text.
$return .= $val[2];
}
-
- // the last char of the matched pattern must be \n but we don't
- // want this to be inside the tokens
- $return = substr($return, 0, -1);
-
- // the last line may have been indented. go through the stack
- // and create end-tokens until the stack is empty.
- //$return .= "\n";
+ // close the pending levels
while ($curLevel > 0) {
$return .= $this->wiki->addToken(
- $this->rule,
+ $this->rule,
array (
- 'type' => 'end',
- 'level' => $curLevel
+ "type" => "end",
+ "level" => $curLevel
)
);
--$curLevel;
}
-
- // put back the trailing \n
- $return .= "\n";
// we're done! send back the replacement text.
return $return;
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Bold.php b/includes/pear/Text/Wiki/Parse/Default/Bold.php
index ba5e965..a240df2 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Bold.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Bold.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Bold.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -34,7 +34,7 @@
*
*/
-class Text_Wiki_Parse_Bold extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Bold extends Text_Wiki_Parse {
/**
@@ -71,9 +71,8 @@ class Text_Wiki_Parse_Bold extends Text_Wiki_Parse {
function process(&$matches)
{
- $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
- $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Break.php b/includes/pear/Text/Wiki/Parse/Default/Break.php
index 1a684f1..5a1b10d 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Break.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Break.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Break.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for explicit line breaks.
*
-* This class implements a Text_Wiki_Parse to mark forced line breaks in the
+* This class implements a Text_Wiki_Parse_Default to mark forced line breaks in the
* source text.
*
* @category Text
@@ -31,7 +31,7 @@
*
*/
-class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Break extends Text_Wiki_Parse {
/**
@@ -69,4 +69,3 @@ class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Center.php b/includes/pear/Text/Wiki/Parse/Default/Center.php
index 6ddde51..222e555 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Center.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Center.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Center.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for centered lines of text.
*
-* This class implements a Text_Wiki_Parse to find lines marked for centering.
+* This class implements a Text_Wiki_Parse_Default to find lines marked for centering.
* The line must start with "= " (i.e., an equal-sign followed by a space).
*
* @category Text
@@ -31,7 +31,7 @@
*
*/
-class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Center extends Text_Wiki_Parse {
/**
@@ -64,15 +64,14 @@ class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
{
$start = $this->wiki->addToken(
$this->rule,
- array('type' => 'start')
+ array("type" => "start")
);
$end = $this->wiki->addToken(
$this->rule,
- array('type' => 'end')
+ array("type" => "end")
);
return "\n" . $start . $matches[1] . $end . "\n";
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Code.php b/includes/pear/Text/Wiki/Parse/Default/Code.php
index fc2d3c1..042e01e 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Code.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Code.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Code.php 237313 2007-06-09 23:11:25Z justinpatrin $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for text marked as a code example block.
*
-* This class implements a Text_Wiki_Parse to find sections marked as code
+* This class implements a Text_Wiki_Parse_Default to find sections marked as code
* examples. Blocks are marked as the string <code> on a line by itself,
* followed by the inline code example, and terminated with the string
* </code> on a line by itself. The code example is run through the
@@ -35,7 +35,7 @@
*
*/
-class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Code extends Text_Wiki_Parse {
/**
@@ -49,8 +49,9 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
*
*/
-/* var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/
- var $regex = ';^<code(\s[^>]*)?>((?:(?R)|.*?)*)\n</code>(\s|$);msi';
+ /* var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi'; */
+ /* var $regex = ';^<code(\s[^>]*)?>((?:(?R)|.*?)*)\n</code>(\s|$);msi'; */
+ var $regex = ';^<code(\s[^>]*)?>(.*?)\n</code>(\s|$);msi';
/**
*
@@ -72,28 +73,27 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
// are there additional attribute arguments?
$args = trim($matches[1]);
- if ($args == '') {
+ if ($args == "") {
$options = array(
- 'text' => $matches[2],
- 'attr' => array('type' => '')
+ "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'] = '';
+ if (! isset($attr["type"])) {
+ $attr["type"] = "";
}
// retain the options
$options = array(
- 'text' => $matches[2],
- 'attr' => $attr
+ "text" => $matches[2],
+ "attr" => $attr
);
}
return $this->wiki->addToken($this->rule, $options) . $matches[3];
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Colortext.php b/includes/pear/Text/Wiki/Parse/Default/Colortext.php
index 5d82cd6..5f24ba7 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Colortext.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Colortext.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Colortext.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Colortext extends Text_Wiki_Parse {
/**
*
@@ -70,20 +70,19 @@ class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
$start = $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'start',
- 'color' => $matches[1]
+ "type" => "start",
+ "color" => $matches[1]
)
);
$end = $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'end',
- 'color' => $matches[1]
+ "type" => "end",
+ "color" => $matches[1]
)
);
return $start . $matches[2] . $end;
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Deflist.php b/includes/pear/Text/Wiki/Parse/Default/Deflist.php
index a8ee0fb..1a9fe84 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Deflist.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Deflist.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Deflist.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for definition lists.
*
-* This class implements a Text_Wiki_Parse to find source text marked as a
+* This class implements a Text_Wiki_Parse_Default 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.
@@ -35,7 +35,7 @@
*
*/
-class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Deflist extends Text_Wiki_Parse {
/**
@@ -79,20 +79,20 @@ class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
function process(&$matches)
{
// the replacement text we will return to parse()
- $return = '';
+ $return = "";
// the list of post-processing matches
$list = array();
// start the deflist
- $options = array('type' => 'list_start');
+ $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',
+ "/^(: )(.*)?( : )(.*)?$/Ums",
$matches[1],
$list,
PREG_SET_ORDER
@@ -101,22 +101,21 @@ class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
// add each term and narrative
foreach ($list as $key => $val) {
$return .= (
- $this->wiki->addToken($this->rule, array('type' => 'term_start')) .
+ $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')) .
+ $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'))
+ $this->wiki->addToken($this->rule, array("type" => "narr_end"))
);
}
// end the deflist
- $options = array('type' => 'list_end');
+ $options = array("type" => "list_end");
$return .= $this->wiki->addToken($this->rule, $options);
// done!
return "\n" . $return . "\n\n";
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Delimiter.php b/includes/pear/Text/Wiki/Parse/Default/Delimiter.php
index 8aa4b53..d8c4ea4 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Delimiter.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Delimiter.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Delimiter.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for Text_Wiki delimiter characters already in the source text.
*
-* This class implements a Text_Wiki_Parse to find instances of the delimiter
+* This class implements a Text_Wiki_Parse_Default 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.
@@ -33,11 +33,11 @@
*
*/
-class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Delimiter extends Text_Wiki_Parse {
/**
*
- * Constructor. Overrides the Text_Wiki_Parse constructor so that we
+ * Constructor. Overrides the Text_Wiki_Parse_Default constructor so that we
* can set the $regex property dynamically (we need to include the
* Text_Wiki $delim character.
*
@@ -47,10 +47,27 @@ class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
*
*/
- function Text_Wiki_Parse_delimiter(&$obj)
+ function __construct(&$obj)
{
- parent::Text_Wiki_Parse($obj);
- $this->regex = '/' . $this->wiki->delim . '/';
+ parent::__construct($obj);
+ $this->regex = "/" . $this->wiki->delim . "/";
+ }
+
+ /**
+ *
+ * Constructor. Overrides the Text_Wiki_Parse_Default 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_Default_Delimiter(&$obj)
+ {
+ self::__construct($obj);
}
@@ -73,8 +90,7 @@ class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
{
return $this->wiki->addToken(
$this->rule,
- array('text' => $this->wiki->delim)
+ array("text" => $this->wiki->delim)
);
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Embed.php b/includes/pear/Text/Wiki/Parse/Default/Embed.php
index 2d31a71..406e1b7 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Embed.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Embed.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Embed.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Embeds the results of a PHP script at render-time.
*
-* This class implements a Text_Wiki_Parse to embed the contents of a URL
+* This class implements a Text_Wiki_Parse_Default 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
@@ -38,10 +38,10 @@
*
*/
-class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Embed extends Text_Wiki_Parse {
var $conf = array(
- 'base' => '/path/to/scripts/'
+ "base" => "/path/to/scripts/"
);
var $file = null;
@@ -83,11 +83,11 @@ class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
function process(&$matches)
{
// save the file location
- $this->file = $this->getConf('base', './') . $matches[2];
+ $this->file = $this->getConf("base", "./") . $matches[2];
// extract attribs as variables in the local space
$this->vars = $this->getAttrs($matches[3]);
- unset($this->vars['this']);
+ unset($this->vars["this"]);
extract($this->vars);
// run the script
@@ -99,8 +99,7 @@ class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
// done, place the script output directly in the source
return $this->wiki->addToken(
$this->rule,
- array('text' => $this->output)
+ array("text" => $this->output)
);
}
}
-?> \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Emphasis.php b/includes/pear/Text/Wiki/Parse/Default/Emphasis.php
index 85dd212..70f58a4 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Emphasis.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Emphasis.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Emphasis.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for emphasized text.
*
-* This class implements a Text_Wiki_Parse to find source text marked for
+* This class implements a Text_Wiki_Parse_Default to find source text marked for
* emphasis (italics) as defined by text surrounded by two single-quotes.
* On parsing, the text itself is left in place, but the starting and ending
* instances of two single-quotes are replaced with tokens.
@@ -33,7 +33,7 @@
*
*/
-class Text_Wiki_Parse_emphasis extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_emphasis extends Text_Wiki_Parse {
/**
@@ -72,14 +72,14 @@ class Text_Wiki_Parse_emphasis extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Freelink.php b/includes/pear/Text/Wiki/Parse/Default/Freelink.php
index 6cc0bc6..5f80011 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Freelink.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Freelink.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Freelink.php 224598 2006-12-08 08:23:51Z justinpatrin $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for freelinked page links.
*
-* This class implements a Text_Wiki_Parse to find source text marked as a
+* This class implements a Text_Wiki_Parse_Default to find source text marked as a
* wiki freelink, and automatically create a link to that page.
*
* A freelink is any page name not conforming to the standard
@@ -39,15 +39,15 @@
*
*/
-class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Freelink extends Text_Wiki_Parse {
var $conf = array (
- 'utf-8' => false
+ "utf-8" => false
);
/**
*
- * Constructor. We override the Text_Wiki_Parse constructor so we can
+ * Constructor. We override the Text_Wiki_Parse_Default constructor so we can
* explicitly comment each part of the $regex property.
*
* @access public
@@ -56,16 +56,16 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
*
*/
- function Text_Wiki_Parse_Freelink(&$obj)
+ function __construct(&$obj)
{
- parent::Text_Wiki_Parse($obj);
- if ($this->getConf('utf-8')) {
+ parent::__construct($obj);
+ if ($this->getConf("utf-8")) {
$any = '\p{L}';
} else {
- $any = '';
+ $any = "";
}
$this->regex =
- '/' . // START regex
+ "/" . // START regex
"\\(\\(" . // double open-parens
"(" . // START freelink page patter
"[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&".$any."\xc0-\xff]+" . // 1 or more of just about any character
@@ -80,7 +80,23 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
"[-A-Za-z0-9_:.]*" . // 0 or more alpha, digit, underscore
")?" . // END named anchors pattern 0 or 1
"()\\)\\)" . // double close-parens
- '/'.($this->getConf('utf-8') ? 'u' : ''); // END regex
+ "/".($this->getConf("utf-8") ? "u" : ""); // END regex
+ }
+
+ /**
+ *
+ * Constructor. We override the Text_Wiki_Parse_Default constructor so we can
+ * explicitly comment each part of the $regex property.
+ *
+ * @access public
+ *
+ * @param object &$obj The calling "parent" Text_Wiki object.
+ *
+ */
+
+ function Text_Wiki_Parse_Default_Freelink(&$obj)
+ {
+ self::__construct($obj);
}
@@ -112,7 +128,7 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
$anchor = $matches[3];
// is the page given a new text appearance?
- if (trim($text) == '') {
+ if (trim($text) == "") {
// no
$text = $page;
} else {
@@ -122,9 +138,9 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
// set the options
$options = array(
- 'page' => $page,
- 'text' => $text,
- 'anchor' => $anchor
+ "page" => $page,
+ "text" => $text,
+ "anchor" => $anchor
);
// return a token placeholder
diff --git a/includes/pear/Text/Wiki/Parse/Default/Function.php b/includes/pear/Text/Wiki/Parse/Default/Function.php
index 35580bf..297d2ba 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Function.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Function.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Function.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Function extends Text_Wiki_Parse {
var $regex = '/^(\<function\>)\n(.+)\n(\<\/function\>)(\s|$)/Umsi';
@@ -36,11 +36,11 @@ class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
{
// default options
$opts = array(
- 'name' => null,
- 'access' => null,
- 'return' => null,
- 'params' => array(),
- 'throws' => array()
+ "name" => null,
+ "access" => null,
+ "return" => null,
+ "params" => array(),
+ "throws" => array()
);
// split apart the markup lines and loop through them
@@ -48,14 +48,14 @@ class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
foreach ($lines as $line) {
// skip blank lines
- if (trim($line) == '') {
+ if (trim($line) == "") {
continue;
}
// find the first ':' on the line; the left part is the
// type, the right part is the value. skip lines without
// a ':' on them.
- $pos = strpos($line, ':');
+ $pos = strpos($line, ":");
if ($pos === false) {
continue;
}
@@ -68,60 +68,60 @@ class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
switch($type) {
- case 'a':
- case 'access':
- $opts['access'] = $val;
+ case "a":
+ case "access":
+ $opts["access"] = $val;
break;
- case 'n':
- case 'name':
- $opts['name'] = $val;
+ case "n":
+ case "name":
+ $opts["name"] = $val;
break;
- case 'p':
- case 'param':
- $tmp = explode(',', $val);
+ case "p":
+ case "param":
+ $tmp = explode(",", $val);
$k = count($tmp);
if ($k == 1) {
- $opts['params'][] = array(
- 'type' => $tmp[0],
- 'descr' => null,
- 'default' => null
+ $opts["params"][] = array(
+ "type" => $tmp[0],
+ "descr" => null,
+ "default" => null
);
} elseif ($k == 2) {
- $opts['params'][] = array(
- 'type' => $tmp[0],
- 'descr' => $tmp[1],
- 'default' => null
+ $opts["params"][] = array(
+ "type" => $tmp[0],
+ "descr" => $tmp[1],
+ "default" => null
);
} else {
- $opts['params'][] = array(
- 'type' => $tmp[0],
- 'descr' => $tmp[1],
- 'default' => $tmp[2]
+ $opts["params"][] = array(
+ "type" => $tmp[0],
+ "descr" => $tmp[1],
+ "default" => $tmp[2]
);
}
break;
- case 'r':
- case 'return':
- case 'returns':
- $opts['return'] = $val;
+ case "r":
+ case "return":
+ case "returns":
+ $opts["return"] = $val;
break;
- case 't':
- case 'throws':
- $tmp = explode(',', $val);
+ case "t":
+ case "throws":
+ $tmp = explode(",", $val);
$k = count($tmp);
if ($k == 1) {
- $opts['throws'][] = array(
- 'type' => $tmp[0],
- 'descr' => null
+ $opts["throws"][] = array(
+ "type" => $tmp[0],
+ "descr" => null
);
} else {
- $opts['throws'][] = array(
- 'type' => $tmp[0],
- 'descr' => $tmp[1]
+ $opts["throws"][] = array(
+ "type" => $tmp[0],
+ "descr" => $tmp[1]
);
}
break;
@@ -138,4 +138,4 @@ class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Heading.php b/includes/pear/Text/Wiki/Parse/Default/Heading.php
index 35727e9..bc8d39b 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Heading.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Heading.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Heading.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for heading text.
*
-* This class implements a Text_Wiki_Parse to find source text marked to
+* This class implements a Text_Wiki_Parse_Default to find source text marked to
* be a heading element, as defined by text on a line by itself prefixed
* with a number of plus signs (+). The heading text itself is left in
* the source, but is prefixed and suffixed with delimited tokens marking
@@ -34,7 +34,7 @@
*
*/
-class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Heading extends Text_Wiki_Parse {
/**
@@ -53,7 +53,7 @@ class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
var $regex = '/^(\+{1,6}) (.*)/m';
var $conf = array(
- 'id_prefix' => 'toc'
+ "id_prefix" => "toc"
);
/**
@@ -81,27 +81,27 @@ class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
$id = 0;
}
- $prefix = htmlspecialchars($this->getConf('id_prefix'));
+ $prefix = htmlspecialchars($this->getConf("id_prefix"));
$start = $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'start',
- 'level' => strlen($matches[1]),
- 'text' => $matches[2],
- 'id' => $prefix . $id ++
+ "type" => "start",
+ "level" => strlen($matches[1]),
+ "text" => $matches[2],
+ "id" => $prefix . $id ++
)
);
$end = $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'end',
- 'level' => strlen($matches[1])
+ "type" => "end",
+ "level" => strlen($matches[1])
)
);
return $start . $matches[2] . $end . "\n";
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Horiz.php b/includes/pear/Text/Wiki/Parse/Default/Horiz.php
index a63cb5f..e8d06ec 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Horiz.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Horiz.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Horiz.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for horizontal ruling lines.
*
-* This class implements a Text_Wiki_Parse to find source text marked to
+* This class implements a Text_Wiki_Parse_Default to find source text marked to
* be a horizontal rule, as defined by four dashed on their own line.
*
* @category Text
@@ -31,7 +31,7 @@
*
*/
-class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Horiz extends Text_Wiki_Parse {
/**
@@ -47,7 +47,7 @@ class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
*
*/
- var $regex = '/^([-]{4,})$/m';
+ var $regex = "/^([-]{4,})$/m";
/**
@@ -67,4 +67,4 @@ class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
return $this->wiki->addToken($this->rule);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Html.php b/includes/pear/Text/Wiki/Parse/Default/Html.php
index 38e7389..27b8f89 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Html.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Html.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Html.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for blocks of HTML code.
*
-* This class implements a Text_Wiki_Parse to find source text marked as
+* This class implements a Text_Wiki_Parse_Default to find source text marked as
* HTML to be redndred as-is. The block start is marked by <html> on its
* own line, and the block end is marked by </html> on its own line.
*
@@ -32,7 +32,7 @@
*
*/
-class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Html extends Text_Wiki_Parse {
/**
@@ -68,8 +68,8 @@ class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
function process(&$matches)
{
- $options = array('text' => $matches[1]);
+ $options = array("text" => $matches[1]);
return $this->wiki->addToken($this->rule, $options) . $matches[2];
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Image.php b/includes/pear/Text/Wiki/Parse/Default/Image.php
index 5594644..03bcba2 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Image.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Image.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Image.php 195859 2005-09-12 11:34:44Z toggg $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Image extends Text_Wiki_Parse {
/**
* URL schemes recognized by this rule.
@@ -37,9 +37,9 @@ class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
* @var array
*/
var $conf = array(
- 'schemes' => 'http|https|ftp|gopher|news',
- 'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?',
- 'path_regexp' => '(?:/[^\s"<\\\#delim#\ca-\cz]*)?'
+ "schemes" => "http|https|ftp|gopher|news",
+ "host_regexp" => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?',
+ "path_regexp" => '(?:/[^\s"<\\\#delim#\ca-\cz]*)?'
);
/**
@@ -63,7 +63,7 @@ class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
* @var string
* @see parse()
*/
- var $url = '';
+ var $url = "";
/**
* Constructor.
@@ -73,17 +73,30 @@ class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
* @return The parser object
* @access public
*/
- function Text_Wiki_Parse_Image(&$obj)
+ function __construct(&$obj)
{
$default = $this->conf;
- parent::Text_Wiki_Parse($obj);
+ parent::__construct($obj);
// convert the list of recognized schemes to a regex OR,
- $schemes = $this->getConf('schemes', $default['schemes']);
- $this->url = str_replace( '#delim#', $this->wiki->delim,
- '#(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://'
- . $this->getConf('host_regexp', $default['host_regexp'])
- . $this->getConf('path_regexp', $default['path_regexp']) .'#');
+ $schemes = $this->getConf("schemes", $default["schemes"]);
+ $this->url = str_replace( "#delim#", $this->wiki->delim,
+ "#(?:" . (is_array($schemes) ? implode("|", $schemes) : $schemes) . ")://"
+ . $this->getConf("host_regexp", $default["host_regexp"])
+ . $this->getConf("path_regexp", $default["path_regexp"]) ."#");
+ }
+
+ /**
+ * Constructor.
+ * We override the constructor to build up the url regex from config
+ *
+ * @param object &$obj the base conversion handler
+ * @return The parser object
+ * @access public
+ */
+ function Text_Wiki_Parse_Default_Image(&$obj)
+ {
+ self::__construct($obj);
}
/**
@@ -105,26 +118,26 @@ class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
function process(&$matches)
{
- $pos = strpos($matches[2], ' ');
+ $pos = strpos($matches[2], " ");
if ($pos === false) {
$options = array(
- 'src' => $matches[2],
- 'attr' => array());
+ "src" => $matches[2],
+ "attr" => array());
} else {
// everything after the space is attribute arguments
$options = array(
- 'src' => substr($matches[2], 0, $pos),
- 'attr' => $this->getAttrs(substr($matches[2], $pos+1))
+ "src" => substr($matches[2], 0, $pos),
+ "attr" => $this->getAttrs(substr($matches[2], $pos+1))
);
// check the scheme case of external link
- if (array_key_exists('link', $options['attr'])) {
+ if (array_key_exists("link", $options["attr"])) {
// external url ?
- if (($pos = strpos($options['attr']['link'], '://')) !== false) {
- if (!preg_match($this->url, $options['attr']['link'])) {
+ if (($pos = strpos($options["attr"]["link"], "://")) !== false) {
+ if (!preg_match($this->url, $options["attr"]["link"])) {
return $matches[0];
}
- } elseif (in_array('Wikilink', $this->wiki->disable)) {
+ } elseif (in_array("Wikilink", $this->wiki->disable)) {
return $matches[0]; // Wikilink disabled
}
}
@@ -133,4 +146,3 @@ class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
return $this->wiki->addToken($this->rule, $options);
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Include.php b/includes/pear/Text/Wiki/Parse/Default/Include.php
index c86b15e..f1c7aae 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Include.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Include.php
@@ -12,13 +12,13 @@
*
* @license LGPL
*
-* @version $Id: Include.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
/**
*
-* This class implements a Text_Wiki_Parse to include the results of a
+* This class implements a Text_Wiki_Parse_Default to include the results of a
* script directly into the source at parse-time; thus, the output of the
* script will be parsed by Text_Wiki. This differs from the 'embed'
* rule, which incorporates the results at render-time, meaning that the
@@ -38,10 +38,10 @@
*
*/
-class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Include extends Text_Wiki_Parse {
var $conf = array(
- 'base' => '/path/to/scripts/'
+ "base" => "/path/to/scripts/"
);
var $file = null;
@@ -80,11 +80,11 @@ class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
function process(&$matches)
{
// save the file location
- $this->file = $this->getConf('base', './') . $matches[2];
+ $this->file = $this->getConf("base", "./") . $matches[2];
// extract attribs as variables in the local space
$this->vars = $this->getAttrs($matches[3]);
- unset($this->vars['this']);
+ unset($this->vars["this"]);
extract($this->vars);
// run the script
@@ -97,4 +97,4 @@ class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
return $this->output;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Interwiki.php b/includes/pear/Text/Wiki/Parse/Default/Interwiki.php
index e5f1d77..7f0cc9f 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Interwiki.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Interwiki.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Interwiki.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for interwiki links.
*
-* This class implements a Text_Wiki_Parse to find source text marked as
+* This class implements a Text_Wiki_Parse_Default to find source text marked as
* an Interwiki link. See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
@@ -32,7 +32,7 @@
*
*/
-class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Interwiki extends Text_Wiki_Parse {
// double-colons wont trip up now
var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;-]+)';
@@ -55,15 +55,15 @@ class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
$tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'processDescr'),
+ array(&$this, "processDescr"),
$this->wiki->source
);
// standalone interwiki links
- $tmp_regex = '/' . $this->regex . '/';
+ $tmp_regex = "/" . $this->regex . "/";
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'process'),
+ array(&$this, "process"),
$this->wiki->source
);
@@ -94,9 +94,9 @@ class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
function process(&$matches)
{
$options = array(
- 'site' => $matches[1],
- 'page' => $matches[2],
- 'text' => $matches[0]
+ "site" => $matches[1],
+ "page" => $matches[2],
+ "text" => $matches[0]
);
return $this->wiki->addToken($this->rule, $options);
@@ -127,12 +127,12 @@ class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
function processDescr(&$matches)
{
$options = array(
- 'site' => $matches[1],
- 'page' => $matches[2],
- 'text' => $matches[3]
+ "site" => $matches[1],
+ "page" => $matches[2],
+ "text" => $matches[3]
);
return $this->wiki->addToken($this->rule, $options);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Italic.php b/includes/pear/Text/Wiki/Parse/Default/Italic.php
index 97ba9ff..be0dab1 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Italic.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Italic.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Italic.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for italic text.
*
-* This class implements a Text_Wiki_Parse to find source text marked for
+* This class implements a Text_Wiki_Parse_Default to find source text marked for
* emphasis (italics) as defined by text surrounded by two single-quotes.
* On parsing, the text itself is left in place, but the starting and ending
* instances of two single-quotes are replaced with tokens.
@@ -33,7 +33,7 @@
*
*/
-class Text_Wiki_Parse_Italic extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Italic extends Text_Wiki_Parse {
/**
@@ -72,14 +72,14 @@ class Text_Wiki_Parse_Italic extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/List.php b/includes/pear/Text/Wiki/Parse/Default/List.php
index 0e6d466..b9000c6 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/List.php
+++ b/includes/pear/Text/Wiki/Parse/Default/List.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: List.php 248434 2007-12-17 16:12:25Z justinpatrin $
+* @version $Id$
*
*/
@@ -36,7 +36,7 @@
*
*/
-class Text_Wiki_Parse_List extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_List extends Text_Wiki_Parse {
/**
@@ -86,7 +86,7 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
function process(&$matches)
{
// the replacement text we will return
- $return = '';
+ $return = "";
// the list of post-processing matches
$list = array();
@@ -127,12 +127,12 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$level = strlen($val[1]) + 1;
// get the list item type
- if ($val[2] == '*') {
- $type = 'bullet';
- } elseif ($val[2] == '#') {
- $type = 'number';
+ if ($val[2] == "*") {
+ $type = "bullet";
+ } elseif ($val[2] == "#") {
+ $type = "number";
} else {
- $type = 'unknown';
+ $type = "unknown";
}
// get the text of the list item
@@ -146,8 +146,6 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$level = count($stack);
} else {
- $numSpaces = $level;
-
// reset level as sometimes people use too many spaces
$level = count($stack) + 1;
@@ -161,8 +159,8 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$return .= $this->wiki->addToken(
$this->rule,
array(
- 'type' => $type . '_list_start',
- 'level' => $level - 1
+ "type" => $type . "_list_start",
+ "level" => $level - 1
)
);
}
@@ -185,8 +183,8 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$return .= $this->wiki->addToken(
$this->rule,
array (
- 'type' => array_pop($stack) . '_list_end',
- 'level' => $tmp
+ "type" => array_pop($stack) . "_list_end",
+ "level" => $tmp
)
);
@@ -198,6 +196,8 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
unset($itemcount[$tmp + 1]);
}
+ $numSpaces = $level;
+
// add to the item count for this list (taking into account
// which level we are at).
if (! isset($itemcount[$level])) {
@@ -220,10 +220,10 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$start = $this->wiki->addToken(
$this->rule,
array(
- 'type' => $type . '_item_start',
- 'level' => $level,
- 'count' => $itemcount[$level],
- 'first' => $first
+ "type" => $type . "_item_start",
+ "level" => $level,
+ "count" => $itemcount[$level],
+ "first" => $first
)
);
@@ -231,9 +231,9 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$end = $this->wiki->addToken(
$this->rule,
array(
- 'type' => $type . '_item_end',
- 'level' => $level,
- 'count' => $itemcount[$level]
+ "type" => $type . "_item_end",
+ "level" => $level,
+ "count" => $itemcount[$level]
)
);
@@ -249,8 +249,8 @@ class Text_Wiki_Parse_List extends Text_Wiki_Parse {
$return .= $this->wiki->addToken(
$this->rule,
array (
- 'type' => array_pop($stack) . '_list_end',
- 'level' => count($stack)
+ "type" => array_pop($stack) . "_list_end",
+ "level" => count($stack)
)
);
}
diff --git a/includes/pear/Text/Wiki/Parse/Default/Newline.php b/includes/pear/Text/Wiki/Parse/Default/Newline.php
index 495b7d7..ff666db 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Newline.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Newline.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Newline.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for implied line breaks indicated by newlines.
*
-* This class implements a Text_Wiki_Parse to mark implied line breaks in the
+* This class implements a Text_Wiki_Parse_Default to mark implied line breaks in the
* source text, usually a single carriage return in the middle of a paragraph
* or block-quoted text.
*
@@ -32,7 +32,7 @@
*
*/
-class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Newline extends Text_Wiki_Parse {
/**
@@ -72,4 +72,4 @@ class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Paragraph.php b/includes/pear/Text/Wiki/Parse/Default/Paragraph.php
index e748a11..70baaa8 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Paragraph.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Paragraph.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Paragraph.php 286814 2009-08-04 17:03:17Z rodrigosprimo $
+* @version $Id$
*
*/
@@ -32,7 +32,7 @@
*
*/
-class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Paragraph extends Text_Wiki_Parse {
/**
*
@@ -48,15 +48,15 @@ class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
var $regex = "/^.*?\n\n/m";
var $conf = array(
- 'skip' => array(
- 'blockquote', // are we sure about this one?
- 'code',
- 'heading',
- 'horiz',
- 'deflist',
- 'table',
- 'list',
- 'toc'
+ "skip" => array(
+ "blockquote", // are we sure about this one?
+ "code",
+ "heading",
+ "horiz",
+ "deflist",
+ "table",
+ "list",
+ "toc"
)
);
@@ -81,11 +81,11 @@ class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
function process(&$matches)
{
$delim = $this->wiki->delim;
- $skip = $this->getConf('skip', array());
+ $skip = $this->getConf("skip", array());
// was anything there?
- if (trim($matches[0]) == '') {
- return '';
+ if (trim($matches[0]) == "") {
+ return "";
}
// does the match has tokens inside?
@@ -103,11 +103,11 @@ class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
// if there is no skipable token inside the match
// add the Paragraph token and return
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . trim($matches[0]) . $end;
diff --git a/includes/pear/Text/Wiki/Parse/Default/Phplookup.php b/includes/pear/Text/Wiki/Parse/Default/Phplookup.php
index 7028ec1..1172679 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Phplookup.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Phplookup.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Phplookup.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Phplookup extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Phplookup extends Text_Wiki_Parse {
/**
@@ -66,8 +66,8 @@ class Text_Wiki_Parse_Phplookup extends Text_Wiki_Parse {
function process(&$matches)
{
return $this->wiki->addToken(
- $this->rule, array('text' => $matches[1])
+ $this->rule, array("text" => $matches[1])
);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Prefilter.php b/includes/pear/Text/Wiki/Parse/Default/Prefilter.php
index db20071..761fad2 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Prefilter.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Prefilter.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Prefilter.php 224599 2006-12-08 08:30:37Z justinpatrin $
+* @version $Id$
*
*/
@@ -33,7 +33,7 @@
*
*/
-class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Prefilter extends Text_Wiki_Parse {
/**
@@ -81,4 +81,4 @@ class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Raw.php b/includes/pear/Text/Wiki/Parse/Default/Raw.php
index c4f1b53..1923327 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Raw.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Raw.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Raw.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -32,7 +32,7 @@
*
*/
-class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Raw extends Text_Wiki_Parse {
/**
@@ -66,8 +66,8 @@ class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
function process(&$matches)
{
- $options = array('text' => $matches[1]);
+ $options = array("text" => $matches[1]);
return $this->wiki->addToken($this->rule, $options);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Revise.php b/includes/pear/Text/Wiki/Parse/Default/Revise.php
index 28bf9fd..e48372b 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Revise.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Revise.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Revise.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Revise extends Text_Wiki_Parse {
/**
@@ -58,8 +58,8 @@ class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
*/
var $conf = array(
- 'delmark' => '---',
- 'insmark' => '+++'
+ "delmark" => "---",
+ "insmark" => "+++"
);
@@ -81,10 +81,10 @@ class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
function process(&$matches)
{
- $output = '';
+ $output = "";
$src = $matches[1];
- $delmark = $this->getConf('delmark'); // ---
- $insmark = $this->getConf('insmark'); // +++
+ $delmark = $this->getConf("delmark"); // ---
+ $insmark = $this->getConf("insmark"); // +++
// '---' must be before '+++' (if they both appear)
$del = strpos($src, $delmark);
@@ -111,13 +111,13 @@ class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
}
$output .= $this->wiki->addToken(
- $this->rule, array('type' => 'del_start')
+ $this->rule, array("type" => "del_start")
);
$output .= $text;
$output .= $this->wiki->addToken(
- $this->rule, array('type' => 'del_end')
+ $this->rule, array("type" => "del_end")
);
}
@@ -129,17 +129,17 @@ class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
$text = substr($src, $ins);
$output .= $this->wiki->addToken(
- $this->rule, array('type' => 'ins_start')
+ $this->rule, array("type" => "ins_start")
);
$output .= $text;
$output .= $this->wiki->addToken(
- $this->rule, array('type' => 'ins_end')
+ $this->rule, array("type" => "ins_end")
);
}
return $output;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Smiley.php b/includes/pear/Text/Wiki/Parse/Default/Smiley.php
index c136532..7b79ecb 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Smiley.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Smiley.php
@@ -14,7 +14,7 @@
* @author Bertrand Gugger <bertrand@toggg.com>
* @copyright 2005 bertrand Gugger
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Smiley.php 197527 2005-10-04 08:17:51Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -28,9 +28,9 @@
* @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_Parse::Text_Wiki_Parse()
+ * @see Text_Wiki_Parse_Default::Text_Wiki_Parse_Default()
*/
-class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Smiley extends Text_Wiki_Parse {
/**
* Configuration keys for this rule
@@ -47,31 +47,31 @@ class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
* @var array 'config-key' => mixed config-value
*/
var $conf = array(
- 'smileys' => array(
- ':D' => array('biggrin', 'Very Happy', ':grin:'),
- ':)' => array('smile', 'Smile', '(:'),
- ':(' => array('sad', 'Sad', '):'),
- ':o' => array('surprised', 'Surprised', ':eek:', 'o:'),
- ':shock:' => array('eek', 'Shocked'),
- ':?' => array('confused', 'Confused', ':???:'),
- '8)' => array('cool', 'Cool', '(8'),
- ':lol:' => array('lol', 'Laughing'),
- ':x' => array('mad', 'Mad'),
- ':P' => array('razz', 'Razz'),
- ':oops:' => array('redface', 'Embarassed'),
- ':cry:' => array('cry', 'Crying or Very sad'),
- ':evil:' => array('evil', 'Evil or Very Mad'),
- ':twisted:' => array('twisted', 'Twisted Evil'),
- ':roll:' => array('rolleyes', 'Rolling Eyes'),
- ';)' => array('wink', 'Wink', '(;'),
- ':!:' => array('exclaim', 'Exclamation'),
- ':?:' => array('question', 'Question'),
- ':idea:' => array('idea', 'Idea'),
- ':arrow:' => array('arrow', 'Arrow'),
- ':|' => array('neutral', 'Neutral', '|:'),
- ':mrgreen:' => array('mrgreen', 'Mr. Green'),
+ "smileys" => array(
+ ":D" => array("biggrin", "Very Happy", ":grin:"),
+ ":)" => array("smile", "Smile", "(:"),
+ ":(" => array("sad", "Sad", "):"),
+ ":o" => array("surprised", "Surprised", ":eek:", "o:"),
+ ":shock:" => array("eek", "Shocked"),
+ ":?" => array("confused", "Confused", ":???:"),
+ "8)" => array("cool", "Cool", "(8"),
+ ":lol:" => array("lol", "Laughing"),
+ ":x" => array("mad", "Mad"),
+ ":P" => array("razz", "Razz"),
+ ":oops:" => array("redface", "Embarassed"),
+ ":cry:" => array("cry", "Crying or Very sad"),
+ ":evil:" => array("evil", "Evil or Very Mad"),
+ ":twisted:" => array("twisted", "Twisted Evil"),
+ ":roll:" => array("rolleyes", "Rolling Eyes"),
+ ";)" => array("wink", "Wink", "(;"),
+ ":!:" => array("exclaim", "Exclamation"),
+ ":?:" => array("question", "Question"),
+ ":idea:" => array("idea", "Idea"),
+ ":arrow:" => array("arrow", "Arrow"),
+ ":|" => array("neutral", "Neutral", "|:"),
+ ":mrgreen:" => array("mrgreen", "Mr. Green"),
),
- 'auto_nose' => true
+ "auto_nose" => true
);
/**
@@ -88,20 +88,20 @@ class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
* We override the constructor to build up the regex from config
*
* @param object &$obj the base conversion handler
- * @return The parser object
+ * @return object The parser object
* @access public
*/
- function Text_Wiki_Parse_Smiley(&$obj)
+ function __construct(&$obj)
{
$default = $this->conf;
- parent::Text_Wiki_Parse($obj);
+ parent::__construct($obj);
// read the list of smileys to sort out variantes and :xxx: while building the regexp
- $this->_smileys = $this->getConf('smileys', $default['smileys']);
- $autoNose = $this->getConf('auto_nose', $default['auto_nose']);
- $reg1 = $reg2 = '';
- $sep1 = ':(?:';
- $sep2 = '';
+ $this->_smileys = $this->getConf("smileys", $default["smileys"]);
+ $autoNose = $this->getConf("auto_nose", $default["auto_nose"]);
+ $reg1 = $reg2 = "";
+ $sep1 = ":(?:";
+ $sep2 = "";
foreach ($this->_smileys as $smiley => $def) {
for ($i = 1; $i < count($def); $i++) {
if ($i > 1) {
@@ -111,26 +111,39 @@ class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
$cur = $smiley;
}
$len = strlen($cur);
- if (($cur[0] == ':') && ($len > 2) && ($cur[$len - 1] == ':')) {
- $reg1 .= $sep1 . preg_quote(substr($cur, 1, -1), '#');
- $sep1 = '|';
+ if (($cur[0] == ":") && ($len > 2) && ($cur[$len - 1] == ":")) {
+ $reg1 .= $sep1 . preg_quote(substr($cur, 1, -1), "#");
+ $sep1 = "|";
continue;
}
if ($autoNose && ($len === 2)) {
- $variante = $cur[0] . '-' . $cur[1];
+ $variante = $cur[0] . "-" . $cur[1];
$this->_smileys[$variante] = &$this->_smileys[$smiley];
- $cur = preg_quote($cur[0], '#') . '-?' . preg_quote($cur[1], '#');
+ $cur = preg_quote($cur[0], "#") . "-?" . preg_quote($cur[1], "#");
} else {
- $cur = preg_quote($cur, '#');
+ $cur = preg_quote($cur, "#");
}
$reg2 .= $sep2 . $cur;
- $sep2 = '|';
+ $sep2 = "|";
}
}
- $delim = '[\n\r\s' . $this->wiki->delim . '$^]';
- $this->regex = '#(?<=' . $delim .
- ')(' . ($reg1 ? $reg1 . '):' . ($reg2 ? '|' : '') : '') . $reg2 .
- ')(?=' . $delim . ')#i';
+ $delim = '[\n\r\s' . $this->wiki->delim . "$^]";
+ $this->regex = "#(?<=" . $delim .
+ ")(" . ($reg1 ? $reg1 . "):" . ($reg2 ? "|" : "") : "") . $reg2 .
+ ")(?=" . $delim . ")#i";
+ }
+
+ /**
+ * Constructor.
+ * We override the constructor to build up the regex from config
+ *
+ * @param object &$obj the base conversion handler
+ * @return object The parser object
+ * @access public
+ */
+ function Text_Wiki_Parse_Default_Smiley(&$obj)
+ {
+ return self::__construct($obj);
}
/**
@@ -148,10 +161,9 @@ class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
// tokenize
return $this->wiki->addToken($this->rule,
array(
- 'symbol' => $matches[1],
- 'name' => $this->_smileys[$matches[1]][0],
- 'desc' => $this->_smileys[$matches[1]][1]
+ "symbol" => $matches[1],
+ "name" => $this->_smileys[$matches[1]][0],
+ "desc" => $this->_smileys[$matches[1]][1]
));
}
-}
-?>
+} \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Parse/Default/Strong.php b/includes/pear/Text/Wiki/Parse/Default/Strong.php
index 3fc4595..66ace75 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Strong.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Strong.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Strong.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -21,7 +21,7 @@
*
* Parses for strongly-emphasized text.
*
-* This class implements a Text_Wiki_Parse to find source text marked for
+* This class implements a Text_Wiki_Parse_Default to find source text marked for
* strong emphasis (bold) as defined by text surrounded by three
* single-quotes. On parsing, the text itself is left in place, but the
* starting and ending instances of three single-quotes are replaced with
@@ -35,7 +35,7 @@
*
*/
-class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Strong extends Text_Wiki_Parse {
/**
@@ -73,14 +73,14 @@ class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Subscript.php b/includes/pear/Text/Wiki/Parse/Default/Subscript.php
index eb75c14..f7fff6e 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Subscript.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Subscript.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Subscript.php 180691 2005-02-24 17:24:56Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Subscript extends Text_Wiki_Parse {
/**
@@ -66,14 +66,14 @@ class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Superscript.php b/includes/pear/Text/Wiki/Parse/Default/Superscript.php
index e63c190..de80084 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Superscript.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Superscript.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Superscript.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -28,7 +28,7 @@
*
*/
-class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Superscript extends Text_Wiki_Parse {
/**
@@ -66,14 +66,14 @@ class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Table.php b/includes/pear/Text/Wiki/Parse/Default/Table.php
index 81168b5..7ab72cd 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Table.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Table.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Table.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Parses for table markup.
*
-* This class implements a Text_Wiki_Parse to find source text marked as a
+* This class implements a Text_Wiki_Parse_Default to find source text marked as a
* set of table rows, where a line start and ends with double-pipes (||)
* and uses double-pipes to separate table cells. The rows must be on
* sequential lines (no blank lines between them) -- a blank line
@@ -34,7 +34,7 @@
*
*/
-class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Table extends Text_Wiki_Parse {
/**
@@ -87,7 +87,7 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
function process(&$matches)
{
// our eventual return value
- $return = '';
+ $return = "";
// the number of columns in the table
$num_cols = 0;
@@ -107,7 +107,7 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
// start a new row
$return .= $this->wiki->addToken(
$this->rule,
- array('type' => 'row_start')
+ array("type" => "row_start")
);
// cells are separated by double-pipes
@@ -134,7 +134,7 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
// if there is no content at all, then it's an instance
// of two sets of || next to each other, indicating a
// span.
- if ($cell[$i] == '') {
+ if ($cell[$i] == "") {
// add to the span and loop to the next cell
$span += 1;
@@ -145,20 +145,20 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
// this cell has content.
// find any special "attr"ibute cell markers
- if (substr($cell[$i], 0, 2) == '> ') {
+ if (substr($cell[$i], 0, 2) == "> ") {
// right-align
- $attr = 'right';
+ $attr = "right";
$cell[$i] = substr($cell[$i], 2);
- } elseif (substr($cell[$i], 0, 2) == '= ') {
+ } elseif (substr($cell[$i], 0, 2) == "= ") {
// center-align
- $attr = 'center';
+ $attr = "center";
$cell[$i] = substr($cell[$i], 2);
- } elseif (substr($cell[$i], 0, 2) == '< ') {
+ } elseif (substr($cell[$i], 0, 2) == "< ") {
// left-align
- $attr = 'left';
+ $attr = "left";
$cell[$i] = substr($cell[$i], 2);
- } elseif (substr($cell[$i], 0, 2) == '~ ') {
- $attr = 'header';
+ } elseif (substr($cell[$i], 0, 2) == "~ ") {
+ $attr = "header";
$cell[$i] = substr($cell[$i], 2);
} else {
$attr = null;
@@ -168,9 +168,9 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
$return .= $this->wiki->addToken(
$this->rule,
array (
- 'type' => 'cell_start',
- 'attr' => $attr,
- 'span' => $span
+ "type" => "cell_start",
+ "attr" => $attr,
+ "span" => $span
)
);
@@ -181,9 +181,9 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
$return .= $this->wiki->addToken(
$this->rule,
array (
- 'type' => 'cell_end',
- 'attr' => $attr,
- 'span' => $span
+ "type" => "cell_end",
+ "attr" => $attr,
+ "span" => $span
)
);
@@ -196,7 +196,7 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
// end the row
$return .= $this->wiki->addToken(
$this->rule,
- array('type' => 'row_end')
+ array("type" => "row_end")
);
}
@@ -206,16 +206,16 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
$this->wiki->addToken(
$this->rule,
array(
- 'type' => 'table_start',
- 'rows' => $num_rows,
- 'cols' => $num_cols
+ "type" => "table_start",
+ "rows" => $num_rows,
+ "cols" => $num_cols
)
)
. $return .
$this->wiki->addToken(
$this->rule,
array(
- 'type' => 'table_end'
+ "type" => "table_end"
)
);
@@ -223,4 +223,4 @@ class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
return "\n$return\n\n";
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Tighten.php b/includes/pear/Text/Wiki/Parse/Default/Tighten.php
index a03b51f..fb1ec84 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Tighten.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Tighten.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Tighten.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -29,7 +29,7 @@
*
*/
-class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Tighten extends Text_Wiki_Parse {
/**
@@ -42,8 +42,8 @@ class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
function parse()
{
- $this->wiki->source = str_replace("\n", '',
+ $this->wiki->source = str_replace("\n", "",
$this->wiki->source);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Toc.php b/includes/pear/Text/Wiki/Parse/Default/Toc.php
index dd29a57..05b15bc 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Toc.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Toc.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Toc.php 187179 2005-05-28 21:33:02Z pmjones $
+* @version $Id$
*
*/
@@ -20,7 +20,7 @@
*
* Looks through parsed text and builds a table of contents.
*
-* This class implements a Text_Wiki_Parse to find all heading tokens and
+* This class implements a Text_Wiki_Parse_Default to find all heading tokens and
* build a table of contents. The [[toc]] tag gets replaced with a list
* of all the level-2 through level-6 headings.
*
@@ -33,7 +33,7 @@
*/
-class Text_Wiki_Parse_Toc extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Toc extends Text_Wiki_Parse {
/**
@@ -85,46 +85,46 @@ class Text_Wiki_Parse_Toc extends Text_Wiki_Parse {
$output = $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'list_start',
- 'level' => 0,
- 'attr' => $attr
+ "type" => "list_start",
+ "level" => 0,
+ "attr" => $attr
)
);
- foreach ($this->wiki->getTokens('Heading') as $key => $val) {
+ foreach ($this->wiki->getTokens("Heading") as $key => $val) {
- if ($val[1]['type'] != 'start') {
+ if ($val[1]["type"] != "start") {
continue;
}
$options = array(
- 'type' => 'item_start',
- 'id' => $val[1]['id'],
- 'level' => $val[1]['level'],
- 'count' => $count ++
+ "type" => "item_start",
+ "id" => $val[1]["id"],
+ "level" => $val[1]["level"],
+ "count" => $count ++
);
$output .= $this->wiki->addToken($this->rule, $options);
- $output .= $val[1]['text'];
+ $output .= $val[1]["text"];
$output .= $this->wiki->addToken(
$this->rule,
array(
- 'type' => 'item_end',
- 'level' => $val[1]['level']
+ "type" => "item_end",
+ "level" => $val[1]["level"]
)
);
}
$output .= $this->wiki->addToken(
$this->rule, array(
- 'type' => 'list_end',
- 'level' => 0
+ "type" => "list_end",
+ "level" => 0
)
);
return "\n$output\n";
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Tt.php b/includes/pear/Text/Wiki/Parse/Default/Tt.php
index 6fb7a7f..97f95d8 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Tt.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Tt.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Tt.php 180591 2005-02-23 17:38:29Z pmjones $
+* @version $Id$
*
*/
@@ -37,7 +37,7 @@
*
*/
-class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Tt extends Text_Wiki_Parse {
/**
@@ -71,14 +71,14 @@ class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
function process(&$matches)
{
$start = $this->wiki->addToken(
- $this->rule, array('type' => 'start')
+ $this->rule, array("type" => "start")
);
$end = $this->wiki->addToken(
- $this->rule, array('type' => 'end')
+ $this->rule, array("type" => "end")
);
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Underline.php b/includes/pear/Text/Wiki/Parse/Default/Underline.php
index dc04de4..545ec6a 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Underline.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Underline.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Underline.php 190446 2005-07-10 20:40:20Z justinpatrin $
+* @version $Id$
*
*/
@@ -34,7 +34,7 @@
*
*/
-class Text_Wiki_Parse_Underline extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Underline extends Text_Wiki_Parse {
/**
@@ -71,9 +71,9 @@ class Text_Wiki_Parse_Underline extends Text_Wiki_Parse {
function process(&$matches)
{
- $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
- $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
+ $start = $this->wiki->addToken($this->rule, array("type" => "start"));
+ $end = $this->wiki->addToken($this->rule, array("type" => "end"));
return $start . $matches[1] . $end;
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Url.php b/includes/pear/Text/Wiki/Parse/Default/Url.php
index 7a6f08c..e8ac423 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Url.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Url.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Url.php 293784 2010-01-20 18:48:09Z justinpatrin $
+* @version $Id$
*
*/
@@ -49,7 +49,7 @@
*
*/
-class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Url extends Text_Wiki_Parse {
/**
@@ -76,13 +76,13 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
*/
var $conf = array(
- 'schemes' => array(
- 'http://',
- 'https://',
- 'ftp://',
- 'gopher://',
- 'news://',
- 'mailto:'
+ "schemes" => array(
+ "http://",
+ "https://",
+ "ftp://",
+ "gopher://",
+ "news://",
+ "mailto:"
)
);
@@ -97,18 +97,18 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
*
*/
- function Text_Wiki_Parse_Url(&$obj)
+ function __construct(&$obj)
{
- parent::Text_Wiki_Parse($obj);
+ parent::__construct($obj);
// convert the list of recognized schemes to a regex-safe string,
// where the pattern delim is a slash
$tmp = array();
- $list = $this->getConf('schemes', array());
+ $list = $this->getConf("schemes", array());
foreach ($list as $val) {
- $tmp[] = preg_quote($val, '/');
+ $tmp[] = preg_quote($val, "/");
}
- $schemes = implode('|', $tmp);
+ $schemes = implode("|", $tmp);
// build the regex
$this->regex =
@@ -119,6 +119,21 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
"[^ \\t\\n\\/\"\'{$this->wiki->delim}]*" .
"[A-Za-z0-9\\/?=&~_#]";
}
+
+ /**
+ *
+ * Constructor.
+ *
+ * We override the constructor so we can comment the regex nicely.
+ *
+ * @access public
+ *
+ */
+
+ function Text_Wiki_Parse_Default_Url(&$obj)
+ {
+ self::__construct($obj);
+ }
/**
@@ -143,7 +158,7 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
// the replacement text for matches.
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'processDescr'),
+ array(&$this, "processDescr"),
$this->wiki->source
);
@@ -160,7 +175,7 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
// the replacement text for matches.
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'processFootnote'),
+ array(&$this, "processFootnote"),
$this->wiki->source
);
@@ -172,12 +187,12 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
// the regular expression for this kind of URL
- $tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/';
+ $tmp_regex = "/(^|[^A-Za-z])(" . $this->regex . ")(.*?)/";
// use the standard callback for inline URLs
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'process'),
+ array(&$this, "process"),
$this->wiki->source
);
}
@@ -202,9 +217,9 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
{
// set options
$options = array(
- 'type' => 'inline',
- 'href' => $matches[2],
- 'text' => $matches[2]
+ "type" => "inline",
+ "href" => $matches[2],
+ "text" => $matches[2]
);
// tokenize
@@ -235,9 +250,9 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
// set options
$options = array(
- 'type' => 'footnote',
- 'href' => $matches[1],
- 'text' => $this->footnoteCount
+ "type" => "footnote",
+ "href" => $matches[1],
+ "text" => $this->footnoteCount
);
// tokenize
@@ -269,13 +284,13 @@ class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
{
// set options
$options = array(
- 'type' => 'descr',
- 'href' => $matches[1],
- 'text' => $matches[4]
+ "type" => "descr",
+ "href" => $matches[1],
+ "text" => $matches[4]
);
// tokenize
return $this->wiki->addToken($this->rule, $options);
}
}
-?> \ No newline at end of file
+?>
diff --git a/includes/pear/Text/Wiki/Parse/Default/Wikilink.php b/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
index 2eb079e..beca571 100644..100755
--- a/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
@@ -12,7 +12,7 @@
*
* @license LGPL
*
-* @version $Id: Wikilink.php 224598 2006-12-08 08:23:51Z justinpatrin $
+* @version $Id$
*
*/
@@ -42,18 +42,18 @@
*
*/
-class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
+class Text_Wiki_Parse_Default_Wikilink extends Text_Wiki_Parse {
var $conf = array (
- 'ext_chars' => false,
- 'utf-8' => false
+ "ext_chars" => false,
+ "utf-8" => false
);
/**
*
* Constructor.
*
- * We override the Text_Wiki_Parse constructor so we can
+ * We override the Text_Wiki_Parse_Default constructor so we can
* explicitly comment each part of the $regex property.
*
* @access public
@@ -62,15 +62,15 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
*
*/
- function Text_Wiki_Parse_Wikilink(&$obj)
+ function __construct(&$obj)
{
- parent::Text_Wiki_Parse($obj);
+ parent::__construct($obj);
- if ($this->getConf('utf-8')) {
+ if ($this->getConf("utf-8")) {
$upper = 'A-Z\p{Lu}';
$lower = 'a-z0-9\p{Ll}';
$either = 'A-Za-z0-9\p{L}';
- } else if ($this->getConf('ext_chars')) {
+ } else if ($this->getConf("ext_chars")) {
// use an extended character set; this should
// allow for umlauts and so on. taken from the
// Tavi project defaults.php file.
@@ -102,6 +102,24 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
")?)?)"; // end subpatterns (/4)(/3)(/2)
}
+ /**
+ *
+ * Constructor.
+ *
+ * We override the Text_Wiki_Parse_Default constructor so we can
+ * explicitly comment each part of the $regex property.
+ *
+ * @access public
+ *
+ * @param object &$obj The calling "parent" Text_Wiki object.
+ *
+ */
+
+ function Text_Wiki_Parse_Default_Wikilink(&$obj)
+ {
+ self::__construct($obj);
+ }
+
/**
*
@@ -116,26 +134,23 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
function parse()
{
// described wiki links
- $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/'.($this->getConf('utf-8') ? 'u' : '');
+ $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/'.($this->getConf("utf-8") ? "u" : "");
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'processDescr'),
+ array(&$this, "processDescr"),
$this->wiki->source
);
// standalone wiki links
- if ($this->getConf('utf-8')) {
+ if ($this->getConf("utf-8")) {
$either = 'A-Za-z0-9\p{L}';
- } else if ($this->getConf('ext_chars')) {
- $either = "A-Za-z0-9\xc0-\xfe";
- } else {
- $either = "A-Za-z0-9";
- }
+ } else
+ $either = ( $this->getConf( "ext_chars" ) ) ? "A-Za-z0-9\xc0-\xfe" : "A-Za-z0-9";
- $tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/".($this->getConf('utf-8') ? 'u' : '');
+ $tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/".($this->getConf("utf-8") ? "u" : "");
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- [&$this, 'process' ],
+ array(&$this, "process"),
$this->wiki->source
);
}
@@ -149,7 +164,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
*
* @param array &$matches The array of matches from parse().
*
- * @return string A delimited token to be used as a placeholder in
+ * @return A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
@@ -157,11 +172,11 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
function processDescr(&$matches)
{
// set the options
- $options = [
- 'page' => $matches[1],
- 'text' => $matches[5],
- 'anchor' => $matches[3],
- ];
+ $options = array(
+ "page" => $matches[1],
+ "text" => $matches[5],
+ "anchor" => $matches[3]
+ );
// create and return the replacement token and preceding text
return $this->wiki->addToken($this->rule, $options); // . $matches[7];
@@ -177,7 +192,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
*
* @param array &$matches The array of matches from parse().
*
- * @return string A delimited token to be used as a placeholder in
+ * @return A delimited token to be used as a placeholder in
* the source text, plus any text prior to the match.
*
*/
@@ -186,16 +201,16 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
{
// when prefixed with !, it's explicitly not a wiki link.
// return everything as it was.
- if ($matches[2][0] == '!') {
+ if ($matches[2][0] == "!") {
return $matches[1] . substr($matches[2], 1) . $matches[3];
}
// set the options
- $options = [
- 'page' => $matches[2],
- 'text' => $matches[2] . $matches[3],
- 'anchor' => $matches[3],
- ];
+ $options = array(
+ "page" => $matches[2],
+ "text" => $matches[2] . $matches[3],
+ "anchor" => $matches[3]
+ );
// create and return the replacement token and preceding text
return $matches[1] . $this->wiki->addToken($this->rule, $options);
diff --git a/includes/pear/Text/Wiki/Render.php b/includes/pear/Text/Wiki/Render.php
index 85fd58a..763fb47 100644..100755
--- a/includes/pear/Text/Wiki/Render.php
+++ b/includes/pear/Text/Wiki/Render.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Render.php 209118 2006-03-11 07:12:13Z justinpatrin $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -90,7 +90,7 @@ class Text_Wiki_Render {
*
*/
- function Text_Wiki_Render(&$obj)
+ function __construct(&$obj)
{
// keep a reference to the calling Text_Wiki object
$this->wiki =& $obj;
@@ -103,7 +103,7 @@ class Text_Wiki_Render {
// split into pieces at the _ mark.
// first part is format, second part is rule.
- $part = explode('_', $tmp);
+ $part = explode("_", $tmp);
$this->format = isset($part[0]) ? ucwords(strtolower($part[0])) : null;
$this->rule = isset($part[1]) ? ucwords(strtolower($part[1])) : null;
@@ -138,6 +138,22 @@ class Text_Wiki_Render {
/**
*
+ * Constructor for this render format or rule.
+ *
+ * @access public
+ *
+ * @param object &$obj The calling "parent" Text_Wiki object.
+ *
+ */
+
+ function Text_Wiki_Render(&$obj)
+ {
+ self::__construct($obj);
+ }
+
+
+ /**
+ *
* Simple method to safely get configuration key values.
*
* @access public
@@ -192,7 +208,7 @@ class Text_Wiki_Render {
*
* @access public
* @param string $urlChunk a part of an url to render
- * @return rendered url
+ * @return string rendered url
*
*/
@@ -215,4 +231,3 @@ class Text_Wiki_Render {
return htmlspecialchars($text);
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml.php b/includes/pear/Text/Wiki/Render/Xhtml.php
index ca611bc..6f541fa 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Xhtml.php 206939 2006-02-10 22:31:50Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,9 +26,9 @@
class Text_Wiki_Render_Xhtml extends Text_Wiki_Render {
var $conf = array(
- 'translate' => HTML_ENTITIES,
- 'quotes' => ENT_COMPAT,
- 'charset' => 'ISO-8859-1'
+ "translate" => HTML_ENTITIES,
+ "quotes" => ENT_COMPAT,
+ "charset" => "ISO-8859-1"
);
function pre()
@@ -55,9 +55,9 @@ class Text_Wiki_Render_Xhtml extends Text_Wiki_Render {
{
// attempt to translate HTML entities in the source.
// get the config options.
- $type = $this->getConf('translate', HTML_ENTITIES);
- $quotes = $this->getConf('quotes', ENT_COMPAT);
- $charset = $this->getConf('charset', 'ISO-8859-1');
+ $type = $this->getConf("translate", HTML_ENTITIES);
+ $quotes = $this->getConf("quotes", ENT_COMPAT);
+ $charset = $this->getConf("charset", "ISO-8859-1");
// have to check null and false because HTML_ENTITIES is a zero
if ($type === HTML_ENTITIES) {
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Address.php b/includes/pear/Text/Wiki/Render/Xhtml/Address.php
index ec98eae..54c43be 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Address.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Address.php
@@ -14,7 +14,7 @@
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
*
- * @version CVS: $Id: Address.php 228638 2007-02-01 09:33:00Z mic $
+ * @version CVS: $Id$
*
* @link http://pear.php.net/package/Text_Wiki
*
@@ -23,7 +23,7 @@
class Text_Wiki_Render_Xhtml_Address extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -41,14 +41,14 @@ class Text_Wiki_Render_Xhtml_Address extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<address$css>";
}
- if ($options['type'] == 'end') {
- return '</address>';
+ if ($options["type"] == "end") {
+ return "</address>";
}
+ return "";
}
-}
-?>
+} \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Anchor.php b/includes/pear/Text/Wiki/Render/Xhtml/Anchor.php
index 0a42cac..0be49bb 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Anchor.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Anchor.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Anchor.php 206940 2006-02-10 23:07:03Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -25,24 +25,22 @@
*/
class Text_Wiki_Render_Xhtml_Anchor extends Text_Wiki_Render {
- var $conf = array(
- 'css' => null
- );
+ public $conf = [
+ "css" => null,
+ ];
- function token($options)
+ public function token($options)
{
extract($options); // $type, $name
- if ($type == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($type == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
$format = "<a$css id=\"%s\">";
return sprintf($format, $this->textEncode($name));
}
- if ($type == 'end') {
- return '</a>';
+ if ($type == "end") {
+ return "</a>";
}
}
-}
-
-?>
+} \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Blockquote.php b/includes/pear/Text/Wiki/Render/Xhtml/Blockquote.php
index edbb498..809965b 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Blockquote.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Blockquote.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Blockquote.php 236408 2007-05-26 18:25:45Z mic $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -25,9 +25,9 @@
*/
class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
- var $conf = array(
- 'css' => null
- );
+ public $conf = [
+ "css" => null,
+ ];
/**
*
@@ -44,29 +44,29 @@ class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
function token($options)
{
- $type = $options['type'];
- $level = $options['level'];
+ $type = $options["type"];
+ $level = $options["level"];
// 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);
+ $pad = str_pad("", $level, "\t");
+ $pad = str_replace("\t", " ", $pad);
// pick the css type
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->formatConf(' class="%s"', "css");
- if (isset($options['css'])) {
- $css = ' class="' . $options['css']. '"';
+ if (isset($options["css"])) {
+ $css = ' class="' . $options["css"]. '"';
}
// starting
- if ($type == 'start') {
- return "$pad<blockquote$css>";
+ if ($type == "start") {
+ return "\n$pad<blockquote$css><div>\n$pad ";
}
// ending
- if ($type == 'end') {
- return $pad . "</blockquote>\n";
+ if ($type == "end") {
+ return "\n$pad</div></blockquote>";
}
+ return "";
}
-}
-?>
+} \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Bold.php b/includes/pear/Text/Wiki/Render/Xhtml/Bold.php
index 44b088e..ac3ac32 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Bold.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Bold.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Bold.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,13 +44,13 @@ class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<b$css>";
}
- if ($options['type'] == 'end') {
- return '</b>';
+ if ($options["type"] == "end") {
+ return "</b>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Box.php b/includes/pear/Text/Wiki/Render/Xhtml/Box.php
index ef91883..7c36f36 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Box.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Box.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Box.php 231098 2007-03-03 23:00:54Z mic $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render {
var $conf = array(
- 'css' => 'simplebox'
+ "css" => "simplebox"
);
/**
@@ -44,18 +44,18 @@ class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- if ($options['css']) {
- $css = ' class="' . $options['css']. '"';
+ if ($options["type"] == "start") {
+ if ($options["css"]) {
+ $css = ' class="' . $options["css"]. '"';
}
else {
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->formatConf(' class="%s"', "css");
}
return "<div $css>";
}
- if ($options['type'] == 'end') {
- return '</div>';
+ if ($options["type"] == "end") {
+ return "</div>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Break.php b/includes/pear/Text/Wiki/Render/Xhtml/Break.php
index 6b9b040..ac7ef51 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Break.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Break.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Break.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Break extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,7 +44,7 @@ class Text_Wiki_Render_Xhtml_Break extends Text_Wiki_Render {
function token($options)
{
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->formatConf(' class="%s"', "css");
return "<br$css />\n";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Center.php b/includes/pear/Text/Wiki/Render/Xhtml/Center.php
index b563b3f..7a7a5f7 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Center.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Center.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Center.php 230212 2007-02-19 08:51:19Z mic $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,8 +44,8 @@ class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->getConf('css');
+ if ($options["type"] == "start") {
+ $css = $this->getConf("css");
if ($css) {
return "<div class=\"$css\">";
}
@@ -54,8 +54,8 @@ class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
}
}
- if ($options['type'] == 'end') {
- return '</div>';
+ if ($options["type"] == "end") {
+ return "</div>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Code.php b/includes/pear/Text/Wiki/Render/Xhtml/Code.php
index 13eeef4..955b7ba 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Code.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Code.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Code.php 206940 2006-02-10 23:07:03Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,11 +26,11 @@
class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
var $conf = array(
- '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>
- 'css_filename' => null // class for optional filename <div>
+ "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>
+ "css_filename" => null // class for optional filename <div>
);
/**
@@ -48,21 +48,21 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
function token($options)
{
- $text = $options['text'];
- $attr = $options['attr'];
- $type = strtolower($attr['type']);
+ $text = $options["text"];
+ $attr = $options["attr"];
+ $type = strtolower($attr["type"]);
- $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');
- $css_filename = $this->formatConf(' class="%s"', 'css_filename');
+ $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");
+ $css_filename = $this->formatConf(' class="%s"', "css_filename");
- if ($type == 'php') {
- if (substr($options['text'], 0, 5) != '<?php') {
+ if ($type == "php") {
+ if (substr($options["text"], 0, 5) != "<?php") {
// PHP code example:
// add the PHP tags
- $text = "<?php\n" . $options['text'] . "\n?>"; // <?php
+ $text = "<?php\n" . $options["text"] . "\n?>"; // <?php
}
// convert tabs to four spaces
@@ -80,10 +80,10 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
// translate HTML <font> and color to XHTML <span> and style.
// courtesy of research by A. Kalin :-).
$map = array(
- '<br />' => "\n",
- '&nbsp;' => ' ',
- '<font' => '<span',
- '</font>' => '</span>',
+ "<br />" => "\n",
+ "&nbsp;" => " ",
+ "<font" => "<span",
+ "</font>" => "</span>",
'color="' => 'style="color:'
);
$text = strtr($text, $map);
@@ -96,13 +96,13 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
// replace all <code> tags with classed tags
if ($css_php) {
- $text = str_replace('<code>', "<code$css_php>", $text);
+ $text = str_replace("<code>", "<code$css_php>", $text);
}
// done
$text = "<pre$css>$text</pre>";
- } elseif ($type == 'html' || $type == 'xhtml') {
+ } elseif ($type == "html" || $type == "xhtml") {
// HTML code example:
// add <html> opening and closing tags,
@@ -122,9 +122,9 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
$text = "<pre$css><code$css_code>$text</code></pre>";
}
- if ($css_filename && isset($attr['filename'])) {
+ if ($css_filename && isset($attr["filename"])) {
$text = "<div$css_filename>" .
- $attr['filename'] . '</div>' . $text;
+ $attr["filename"] . "</div>" . $text;
}
return "\n$text\n\n";
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php b/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
index 5d3e8e1..a416093 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Colortext.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,22 +26,22 @@
class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
var $colors = array(
- 'aqua',
- 'black',
- 'blue',
- 'fuchsia',
- 'gray',
- 'green',
- 'lime',
- 'maroon',
- 'navy',
- 'olive',
- 'purple',
- 'red',
- 'silver',
- 'teal',
- 'white',
- 'yellow'
+ "aqua",
+ "black",
+ "blue",
+ "fuchsia",
+ "gray",
+ "green",
+ "lime",
+ "maroon",
+ "navy",
+ "olive",
+ "purple",
+ "red",
+ "silver",
+ "teal",
+ "white",
+ "yellow"
);
@@ -60,20 +60,19 @@ class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
function token($options)
{
- $type = $options['type'];
- $color = $options['color'];
+ $type = $options["type"];
+ $color = $options["color"];
- if (! in_array($color, $this->colors) && $color[0] != '#') {
- $color = '#' . $color;
+ if (! in_array($color, $this->colors) && $color[0] != "#") {
+ $color = "#" . $color;
}
- if ($type == 'start') {
+ if ($type == "start") {
return "<span style=\"color: $color;\">";
}
- if ($options['type'] == 'end') {
- return '</span>';
+ if ($options["type"] == "end") {
+ return "</span>";
}
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Deflist.php b/includes/pear/Text/Wiki/Render/Xhtml/Deflist.php
index 35225c0..c075426 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Deflist.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Deflist.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Deflist.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,9 +26,9 @@
class Text_Wiki_Render_Xhtml_Deflist extends Text_Wiki_Render {
var $conf = array(
- 'css_dl' => null,
- 'css_dt' => null,
- 'css_dd' => null
+ "css_dl" => null,
+ "css_dt" => null,
+ "css_dd" => null
);
/**
@@ -46,40 +46,40 @@ class Text_Wiki_Render_Xhtml_Deflist extends Text_Wiki_Render {
function token($options)
{
- $type = $options['type'];
+ $type = $options["type"];
$pad = " ";
switch ($type) {
- case 'list_start':
- $css = $this->formatConf(' class="%s"', 'css_dl');
+ case "list_start":
+ $css = $this->formatConf(' class="%s"', "css_dl");
return "<dl$css>\n";
break;
- case 'list_end':
+ case "list_end":
return "</dl>\n\n";
break;
- case 'term_start':
- $css = $this->formatConf(' class="%s"', 'css_dt');
+ case "term_start":
+ $css = $this->formatConf(' class="%s"', "css_dt");
return $pad . "<dt$css>";
break;
- case 'term_end':
+ case "term_end":
return "</dt>\n";
break;
- case 'narr_start':
- $css = $this->formatConf(' class="%s"', 'css_dd');
+ case "narr_start":
+ $css = $this->formatConf(' class="%s"', "css_dd");
return $pad . $pad . "<dd$css>";
break;
- case 'narr_end':
+ case "narr_end":
return "</dd>\n";
break;
default:
- return '';
+ return "";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Delimiter.php b/includes/pear/Text/Wiki/Render/Xhtml/Delimiter.php
index e39bcc7..05e0ed2 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Delimiter.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Delimiter.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Delimiter.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -40,7 +40,7 @@ class Text_Wiki_Render_Xhtml_Delimiter extends Text_Wiki_Render {
function token($options)
{
- return $options['text'];
+ return $options["text"];
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Embed.php b/includes/pear/Text/Wiki/Render/Xhtml/Embed.php
index d425411..8043f77 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Embed.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Embed.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Embed.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -40,7 +40,7 @@ class Text_Wiki_Render_Xhtml_Embed extends Text_Wiki_Render {
function token($options)
{
- return $options['text'];
+ return $options["text"];
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Emphasis.php b/includes/pear/Text/Wiki/Render/Xhtml/Emphasis.php
index a7910d7..0c5d393 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Emphasis.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Emphasis.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Emphasis.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Emphasis extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
@@ -45,13 +45,13 @@ class Text_Wiki_Render_Xhtml_Emphasis extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<em$css>";
}
- if ($options['type'] == 'end') {
- return '</em>';
+ if ($options["type"] == "end") {
+ return "</em>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Font.php b/includes/pear/Text/Wiki/Render/Xhtml/Font.php
index f4b78ce..1337f0c 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Font.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Font.php
@@ -10,7 +10,7 @@
* @author Bertrand Gugger <bertrand@toggg.com>
* @copyright 2005 bertrand Gugger
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Font.php 192578 2005-08-06 11:36:45Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -61,18 +61,18 @@ class Text_Wiki_Render_Xhtml_Font extends Text_Wiki_Render {
*/
function token($options)
{
- if ($options['type'] == 'end') {
- return '</span>';
+ if ($options["type"] == "end") {
+ return "</span>";
}
- if ($options['type'] != 'start') {
- return '';
+ if ($options["type"] != "start") {
+ return "";
}
$ret = '<span style="';
- if (isset($options['size'])) {
- $size = trim($options['size']);
+ if (isset($options["size"])) {
+ $size = trim($options["size"]);
if (is_numeric($size)) {
- $size .= 'px';
+ $size .= "px";
}
$ret .= "font-size: $size;";
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Freelink.php b/includes/pear/Text/Wiki/Render/Xhtml/Freelink.php
index f592fdf..78f88a9 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Freelink.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Freelink.php
@@ -9,14 +9,14 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Freelink.php 191862 2005-07-30 08:03:29Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
/**
* The wikilink render class.
*/
-require_once 'Text/Wiki/Render/Xhtml/Wikilink.php';
+require_once "Text/Wiki/Render/Xhtml/Wikilink.php";
/**
* This class renders free links in XHTML.
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Function.php b/includes/pear/Text/Wiki/Render/Xhtml/Function.php
index 1ed050e..e14e702 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Function.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Function.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Function.php 206940 2006-02-10 23:07:03Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -27,19 +27,19 @@ class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
var $conf = array(
// list separator for params and throws
- 'list_sep' => ', ',
+ "list_sep" => ", ",
// the "main" format string
- 'format_main' => '%access %return <b>%name</b> ( %params ) %throws',
+ "format_main" => "%access %return <b>%name</b> ( %params ) %throws",
// the looped format string for required params
- 'format_param' => '%type <i>%descr</i>',
+ "format_param" => "%type <i>%descr</i>",
// the looped format string for params with default values
- 'format_paramd' => '[%type <i>%descr</i> default %default]',
+ "format_paramd" => "[%type <i>%descr</i> default %default]",
// the looped format string for throws
- 'format_throws' => '<b>throws</b> %type <i>%descr</i>'
+ "format_throws" => "<b>throws</b> %type <i>%descr</i>"
);
/**
@@ -60,48 +60,48 @@ class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
extract($options); // name, access, return, params, throws
// build the baseline output
- $output = $this->conf['format_main'];
- $output = str_replace('%access', $this->textEncode($access), $output);
- $output = str_replace('%return', $this->textEncode($return), $output);
- $output = str_replace('%name', $this->textEncode($name), $output);
+ $output = $this->conf["format_main"];
+ $output = str_replace("%access", $this->textEncode($access), $output);
+ $output = str_replace("%return", $this->textEncode($return), $output);
+ $output = str_replace("%name", $this->textEncode($name), $output);
// build the set of params
$list = array();
foreach ($params as $key => $val) {
// is there a default value?
- if ($val['default']) {
- $tmp = $this->conf['format_paramd'];
+ if ($val["default"]) {
+ $tmp = $this->conf["format_paramd"];
} else {
- $tmp = $this->conf['format_param'];
+ $tmp = $this->conf["format_param"];
}
// add the param elements
- $tmp = str_replace('%type', $this->textEncode($val['type']), $tmp);
- $tmp = str_replace('%descr', $this->textEncode($val['descr']), $tmp);
- $tmp = str_replace('%default', $this->textEncode($val['default']), $tmp);
+ $tmp = str_replace("%type", $this->textEncode($val["type"]), $tmp);
+ $tmp = str_replace("%descr", $this->textEncode($val["descr"]), $tmp);
+ $tmp = str_replace("%default", $this->textEncode($val["default"]), $tmp);
$list[] = $tmp;
}
// insert params into output
- $tmp = implode($this->conf['list_sep'], $list);
- $output = str_replace('%params', $tmp, $output);
+ $tmp = implode($this->conf["list_sep"], $list);
+ $output = str_replace("%params", $tmp, $output);
// build the set of throws
$list = array();
foreach ($throws as $key => $val) {
- $tmp = $this->conf['format_throws'];
- $tmp = str_replace('%type', $this->textEncode($val['type']), $tmp);
- $tmp = str_replace('%descr', $this->textEncode($val['descr']), $tmp);
+ $tmp = $this->conf["format_throws"];
+ $tmp = str_replace("%type", $this->textEncode($val["type"]), $tmp);
+ $tmp = str_replace("%descr", $this->textEncode($val["descr"]), $tmp);
$list[] = $tmp;
}
// insert throws into output
- $tmp = implode($this->conf['list_sep'], $list);
- $output = str_replace('%throws', $tmp, $output);
+ $tmp = implode($this->conf["list_sep"], $list);
+ $output = str_replace("%throws", $tmp, $output);
// close the div and return the output
- $output .= '</div>';
+ $output .= "</div>";
return "\n$output\n\n";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Heading.php b/includes/pear/Text/Wiki/Render/Xhtml/Heading.php
index 0d3c05f..cd6d7bc 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Heading.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Heading.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @version CVS: $Id: Heading.php 196293 2005-09-18 13:39:39Z toggg $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,12 +26,12 @@
class Text_Wiki_Render_Xhtml_Heading extends Text_Wiki_Render {
var $conf = array(
- 'css_h1' => null,
- 'css_h2' => null,
- 'css_h3' => null,
- 'css_h4' => null,
- 'css_h5' => null,
- 'css_h6' => null
+ "css_h1" => null,
+ "css_h2" => null,
+ "css_h3" => null,
+ "css_h4" => null,
+ "css_h5" => null,
+ "css_h6" => null
);
function token($options)
@@ -42,19 +42,19 @@ class Text_Wiki_Render_Xhtml_Heading extends Text_Wiki_Render {
extract($options);
switch($type) {
- case 'start':
+ case "start":
$css = $this->formatConf(' class="%s"', "css_h$level");
- return '
-<h'.$level.$css.' id="'.$id.'"'.($collapse !== null ? ' onclick="hideTOC(\''.$id.'\');"' : '').'>';
+ return "
+<h".$level.$css.' id="'.$id.'"'.($collapse !== null ? ' onclick="hideTOC(\''.$id.'\');"' : "").">";
- case 'end':
- return '</h'.$level.'>
-'.($collapse !== null ? '<a id="'.$id.'__link" href="javascript:void();" onclick="hideTOC(\''.$id.'\')">['.($collapse ? '+' : '-').']</a>
-' : '');
- case 'startContent':
+ case "end":
+ return "</h".$level.">
+".($collapse !== null ? '<a id="'.$id.'__link" href="javascript:void();" onclick="hideTOC(\''.$id.'\')">['.($collapse ? "+" : "-")."]</a>
+" : "");
+ case "startContent":
if ($collapse !== null) {
if ($jsOutput) {
- $js = '';
+ $js = "";
} else {
$js = '
<script language="javascript">
@@ -73,15 +73,15 @@ function hideTOC(id) {
';
}
} else {
- $js = '';
+ $js = "";
}
return $js.'
-<div style="'.($collapse === true ? 'display: none; ' : '').'padding: 0px; margin: 0px; border: none;" id="'.$id.'__content">
+<div style="'.($collapse === true ? "display: none; " : "").'padding: 0px; margin: 0px; border: none;" id="'.$id.'__content">
';
- case 'endContent':
- return '
+ case "endContent":
+ return "
</div>
-';
+";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Horiz.php b/includes/pear/Text/Wiki/Render/Xhtml/Horiz.php
index e480f5e..3c488eb 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Horiz.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Horiz.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,7 +44,7 @@ class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
function token($options)
{
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->formatConf(' class="%s"', "css");
return "<hr$css />\n";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Html.php b/includes/pear/Text/Wiki/Render/Xhtml/Html.php
index 7ca4218..b511a81 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Html.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Html.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -41,7 +41,7 @@ class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render {
function token($options)
{
- return $options['text'];
+ return $options["text"];
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Image.php b/includes/pear/Text/Wiki/Render/Xhtml/Image.php
index 51def7b..ddb9001 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Image.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Image.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,10 +26,10 @@
class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
var $conf = array(
- 'base' => '/',
- 'url_base' => null,
- 'css' => null,
- 'css_link' => null
+ "base" => "/",
+ "url_base" => null,
+ "css" => null,
+ "css_link" => null
);
@@ -49,88 +49,88 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
function token($options)
{
// note the image source
- $src = $options['src'];
+ $src = $options["src"];
// is the source a local file or URL?
- if (strpos($src, '://') === false) {
+ if (strpos($src, "://") === false) {
// the source refers to a local file.
// add the URL base to it.
- $src = $this->getConf('base', '/') . $src;
+ $src = $this->getConf("base", "/") . $src;
}
// stephane@metacites.net
// is the image clickable?
- if (isset($options['attr']['link'])) {
+ 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'], '://')) {
+ if (strpos($options["attr"]["link"], "://")) {
// it's a URL, prefix the URL base
- $href = $this->getConf('url_base') . $options['attr']['link'];
+ $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'];
+ $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']);
+ unset($options["attr"]["link"]);
// stephane@metacites.net -- 25/07/2004
// use CSS for all alignment
- if (isset($options['attr']['align'])) {
+ if (isset($options["attr"]["align"])) {
// make sure we have a style attribute
- if (!isset($options['attr']['style'])) {
+ if (!isset($options["attr"]["style"])) {
// no style, set up a blank one
- $options['attr']['style'] = '';
+ $options["attr"]["style"] = "";
} else {
// style exists, add a space
- $options['attr']['style'] .= ' ';
+ $options["attr"]["style"] .= " ";
}
- if ($options['attr']['align'] == 'center') {
+ if ($options["attr"]["align"] == "center") {
// add a "center" style to the existing style.
- $options['attr']['style'] .=
- 'display: block; margin-left: auto; margin-right: auto;';
+ $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'];
+ $options["attr"]["style"] .=
+ "float: ".$options["attr"]["align"];
}
// unset so it won't show up as an attribute
- unset($options['attr']['align']);
+ 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'])) {
+ if (! isset($options["attr"]["width"]) &&
+ ! isset($options["attr"]["height"])) {
// does the source refer to a local file or a URL?
- if (strpos($src,'://')) {
+ if (strpos($src,"://")) {
// is a URL link
$imageFile = $src;
- } elseif ($src[0] == '.') {
+ } 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;
+ $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];
+ $options["attr"]["width"] = $imageSize[0];
+ $options["attr"]["height"] = $imageSize[1];
}
}
@@ -139,20 +139,20 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
$output = '<img src="' . $this->textEncode($src) . '"';
// get the CSS class but don't add it yet
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->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) {
+ foreach ($options["attr"] as $key => $val) {
// track the 'alt' attribute
- if (strtolower($key) == 'alt') {
+ if (strtolower($key) == "alt") {
$alt = true;
}
// the 'class' attribute overrides the CSS class conf
- if (strtolower($key) == 'class') {
+ if (strtolower($key) == "class") {
$css = null;
}
@@ -163,7 +163,7 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
// always add an "alt" attribute per Stephane Solliec
if (! $alt) {
- $alt = $this->textEncode(basename($options['src']));
+ $alt = $this->textEncode(basename($options["src"]));
$output .= " alt=\"$alt\"";
}
@@ -174,7 +174,7 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
if ($href) {
// yes, add the href and return
$href = $this->textEncode($href);
- $css = $this->formatConf(' class="%s"', 'css_link');
+ $css = $this->formatConf(' class="%s"', "css_link");
$output = "<a$css href=\"$href\">$output</a>";
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Include.php b/includes/pear/Text/Wiki/Render/Xhtml/Include.php
index a152c40..bd980fd 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Include.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Include.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render {
function token()
{
- return '';
+ return "";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Interwiki.php b/includes/pear/Text/Wiki/Render/Xhtml/Interwiki.php
index 9686b62..b33c9b5 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Interwiki.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Interwiki.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,13 +26,13 @@
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'
+ "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
+ "target" => "_blank",
+ "css" => null
);
@@ -51,24 +51,24 @@ class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
function token($options)
{
- $text = $options['text'];
- if (isset($options['url'])) {
+ $text = $options["text"];
+ if (isset($options["url"])) {
// calculated by the parser (e.g. Mediawiki)
- $href = $options['url'];
+ $href = $options["url"];
} else {
- $site = $options['site'];
+ $site = $options["site"];
// toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces)
- $page = $this->urlEncode($options['page']);
+ $page = $this->urlEncode($options["page"]);
- if (isset($this->conf['sites'][$site])) {
- $href = $this->conf['sites'][$site];
+ 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) {
+ if (strpos($href, "%s") === false) {
// use the old form
$href = $href . $page;
} else {
@@ -78,15 +78,15 @@ class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
}
// allow for alternative targets
- $target = $this->getConf('target');
+ $target = $this->getConf("target");
// build base link
- $css = $this->formatConf(' class="%s"', 'css');
+ $css = $this->formatConf(' class="%s"', "css");
$text = $this->textEncode($text);
$output = "<a$css href=\"$href\"";
// are we targeting a specific window?
- if ($target && $target != '_self') {
+ if ($target && $target != "_self") {
// this is XHTML compliant, suggested by Aaron Kalin.
// code tip is actually from youngpup.net, and it
// uses the $target as the new window name.
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Italic.php b/includes/pear/Text/Wiki/Render/Xhtml/Italic.php
index b5cbed5..780f354 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Italic.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Italic.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,13 +44,13 @@ class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<i$css>";
}
- if ($options['type'] == 'end') {
- return '</i>';
+ if ($options["type"] == "end") {
+ return "</i>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/List.php b/includes/pear/Text/Wiki/Render/Xhtml/List.php
index 8ec06cb..94e7fd4 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/List.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/List.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,10 +26,10 @@
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
+ "css_ol" => null,
+ "css_ol_li" => null,
+ "css_ul" => null,
+ "css_ul_li" => null
);
/**
@@ -55,15 +55,15 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
// 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);
+ $pad = str_pad("", $level, "\t");
+ $pad = str_replace("\t", " ", $pad);
switch ($type) {
- case 'bullet_list_start':
+ case "bullet_list_start":
// build the base HTML
- $css = $this->formatConf(' class="%s"', 'css_ul');
+ $css = $this->formatConf(' class="%s"', "css_ul");
$html = "<ul$css>";
/*
@@ -79,7 +79,7 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
return $html;
break;
- case 'bullet_list_end':
+ case "bullet_list_end":
// build the base HTML
$html = "</li>\n$pad</ul>";
@@ -95,14 +95,14 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
return $html;
break;
- case 'number_list_start':
+ case "number_list_start":
if (isset($format)) {
$format = ' type="' . $format . '"';
} else {
- $format = '';
+ $format = "";
}
// build the base HTML
- $css = $this->formatConf(' class="%s"', 'css_ol');
+ $css = $this->formatConf(' class="%s"', "css_ol");
$html = "<ol{$format}{$css}>";
/*
@@ -118,7 +118,7 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
return $html;
break;
- case 'number_list_end':
+ case "number_list_end":
// build the base HTML
$html = "</li>\n$pad</ol>";
@@ -134,14 +134,14 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
return $html;
break;
- case 'bullet_item_start':
- case 'number_item_start':
+ 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');
+ if ($type == "bullet_item_start") {
+ $css = $this->formatConf(' class="%s"', "css_ul_li");
} else {
- $css = $this->formatConf(' class="%s"', 'css_ol_li');
+ $css = $this->formatConf(' class="%s"', "css_ol_li");
}
// build the base HTML
@@ -158,13 +158,13 @@ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
return $html;
break;
- case 'bullet_item_end':
- case 'number_item_end':
+ 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 '';
+ return "";
break;
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Newline.php b/includes/pear/Text/Wiki/Render/Xhtml/Newline.php
index 19676c6..dfae543 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Newline.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Newline.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Page.php b/includes/pear/Text/Wiki/Render/Xhtml/Page.php
index d9f638b..2c535b2 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Page.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Page.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -40,7 +40,7 @@ class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render {
function token($options)
{
- return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE';
+ return "PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Paragraph.php b/includes/pear/Text/Wiki/Render/Xhtml/Paragraph.php
index fc73627..361b0ea 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Paragraph.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Paragraph.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -46,12 +46,12 @@ class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
{
extract($options); //type
- if ($type == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($type == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<p$css>";
}
- if ($type == 'end') {
+ if ($type == "end") {
return "</p>\n\n";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Phplookup.php b/includes/pear/Text/Wiki/Render/Xhtml/Phplookup.php
index e77b0b7..cf9471d 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Phplookup.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Phplookup.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,8 +26,8 @@
class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
var $conf = array(
- 'target' => '_blank',
- 'css' => null
+ "target" => "_blank",
+ "css" => null
);
@@ -46,15 +46,15 @@ class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
function token($options)
{
- $text = trim($options['text']);
- $css = $this->formatConf(' class="%s"', 'css');
+ $text = trim($options["text"]);
+ $css = $this->formatConf(' class="%s"', "css");
// start the html
$output = "<a$css";
// are we targeting another window?
- $target = $this->getConf('target', '');
- if ($target && $target != '_self') {
+ $target = $this->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);
@@ -63,7 +63,7 @@ class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
}
// take off the final parens for functions
- if (substr($text, -2) == '()') {
+ if (substr($text, -2) == "()") {
$q = substr($text, 0, -2);
} else {
$q = $text;
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Plugin.php b/includes/pear/Text/Wiki/Render/Xhtml/Plugin.php
index 048ba80..8971261 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Plugin.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Plugin.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -41,7 +41,7 @@ class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render {
function token($options)
{
- return '';
+ return "";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Prefilter.php b/includes/pear/Text/Wiki/Render/Xhtml/Prefilter.php
index b0ae26e..2c275de 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Prefilter.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Prefilter.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -28,7 +28,7 @@
class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render {
function token()
{
- return '';
+ return "";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Preformatted.php b/includes/pear/Text/Wiki/Render/Xhtml/Preformatted.php
index a68ce76..4bd8783 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Preformatted.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Preformatted.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -40,8 +40,8 @@ class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render {
function token($options)
{
- $text = $this->textEncode($options['text']);
- return '<pre>'.$text.'</pre>';
+ $text = $this->textEncode($options["text"]);
+ return "<pre>".$text."</pre>";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Raw.php b/includes/pear/Text/Wiki/Render/Xhtml/Raw.php
index 3027153..3b1e405 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Raw.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Raw.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -40,7 +40,7 @@ class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render {
function token($options)
{
- return $this->textEncode($options['text']);
+ return $this->textEncode($options["text"]);
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Revise.php b/includes/pear/Text/Wiki/Render/Xhtml/Revise.php
index f81fd7f..98203ce 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Revise.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Revise.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,8 +26,8 @@
class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
var $conf = array(
- 'css_ins' => null,
- 'css_del' => null
+ "css_ins" => null,
+ "css_del" => null
);
@@ -46,21 +46,21 @@ class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'del_start') {
- $css = $this->formatConf(' class="%s"', 'css_del');
+ if ($options["type"] == "del_start") {
+ $css = $this->formatConf(' class="%s"', "css_del");
return "<del$css>";
}
- if ($options['type'] == 'del_end') {
+ if ($options["type"] == "del_end") {
return "</del>";
}
- if ($options['type'] == 'ins_start') {
- $css = $this->formatConf(' class="%s"', 'css_ins');
+ if ($options["type"] == "ins_start") {
+ $css = $this->formatConf(' class="%s"', "css_ins");
return "<ins$css>";
}
- if ($options['type'] == 'ins_end') {
+ if ($options["type"] == "ins_end") {
return "</ins>";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Smiley.php b/includes/pear/Text/Wiki/Render/Xhtml/Smiley.php
index 778796b..123fa64 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Smiley.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Smiley.php
@@ -10,7 +10,7 @@
* @author Bertrand Gugger <bertrand@toggg.com>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -43,9 +43,9 @@ class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
* @var array 'config-key' => mixed config-value
*/
var $conf = array(
- 'prefix' => 'images/smiles/icon_',
- 'extension' => '.gif',
- 'css' => null
+ "prefix" => "images/smiles/icon_",
+ "extension" => ".gif",
+ "css" => null
);
/**
@@ -58,7 +58,7 @@ class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
*/
function token($options)
{
- $imageFile = $this->getConf('prefix') . $options['name'] . $this->getConf('extension');
+ $imageFile = $this->getConf("prefix") . $options["name"] . $this->getConf("extension");
// attempt to get the image size
$imageSize = @getimagesize($imageFile);
@@ -66,9 +66,9 @@ class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
// return the HTML output
return '<img src="' . $this->textEncode($imageFile) . '"' .
(is_array($imageSize) ?
- ' width="' . $imageSize[0] . '" height="' . $imageSize[1] .'"' : '') .
- ' alt="' . $options['desc'] . '"' .
- $this->formatConf(' class="%s"', 'css') . ' />';
+ ' width="' . $imageSize[0] . '" height="' . $imageSize[1] .'"' : "") .
+ ' alt="' . $options["desc"] . '"' .
+ $this->formatConf(' class="%s"', "css") . " />";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Specialchar.php b/includes/pear/Text/Wiki/Render/Xhtml/Specialchar.php
index 4372c02..afda876 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Specialchar.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Specialchar.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -25,26 +25,26 @@
*/
class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render {
- var $types = array('~bs~' => '&#92;',
- '~hs~' => '&nbsp;',
- '~amp~' => '&amp;',
- '~ldq~' => '&ldquo;',
- '~rdq~' => '&rdquo;',
- '~lsq~' => '&lsquo;',
- '~rsq~' => '&rsquo;',
- '~c~' => '&copy;',
- '~--~' => '&mdash;',
- '" -- "' => '&mdash;',
- '&quot; -- &quot;' => '&mdash;',
- '~lt~' => '&lt;',
- '~gt~' => '&gt;');
+ var $types = array("~bs~" => "&#92;",
+ "~hs~" => "&nbsp;",
+ "~amp~" => "&amp;",
+ "~ldq~" => "&ldquo;",
+ "~rdq~" => "&rdquo;",
+ "~lsq~" => "&lsquo;",
+ "~rsq~" => "&rsquo;",
+ "~c~" => "&copy;",
+ "~--~" => "&mdash;",
+ '" -- "' => "&mdash;",
+ "&quot; -- &quot;" => "&mdash;",
+ "~lt~" => "&lt;",
+ "~gt~" => "&gt;");
function token($options)
{
- if (isset($this->types[$options['char']])) {
- return $this->types[$options['char']];
+ if (isset($this->types[$options["char"]])) {
+ return $this->types[$options["char"]];
} else {
- return '&#'.substr($options['char'], 1, -1).';';
+ return "&#".substr($options["char"], 1, -1).";";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Strong.php b/includes/pear/Text/Wiki/Render/Xhtml/Strong.php
index da816a7..c479529 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Strong.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Strong.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -27,7 +27,7 @@ class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -45,13 +45,13 @@ class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<strong$css>";
}
- if ($options['type'] == 'end') {
- return '</strong>';
+ if ($options["type"] == "end") {
+ return "</strong>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Subscript.php b/includes/pear/Text/Wiki/Render/Xhtml/Subscript.php
index 653a110..3e2f27b 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Subscript.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Subscript.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,13 +44,13 @@ class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<sub$css>";
}
- if ($options['type'] == 'end') {
- return '</sub>';
+ if ($options["type"] == "end") {
+ return "</sub>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Superscript.php b/includes/pear/Text/Wiki/Render/Xhtml/Superscript.php
index 1a39453..5502dfc 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Superscript.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Superscript.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -44,13 +44,13 @@ class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<sup$css>";
}
- if ($options['type'] == 'end') {
- return '</sup>';
+ if ($options["type"] == "end") {
+ return "</sup>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Table.php b/includes/pear/Text/Wiki/Render/Xhtml/Table.php
index 670ff7b..ed76ce6 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Table.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Table.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,11 +26,11 @@
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
+ "css_table" => null,
+ "css_caption" => null,
+ "css_tr" => null,
+ "css_th" => null,
+ "css_td" => null
);
@@ -54,52 +54,52 @@ class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
extract($options);
// free format
- $format = isset($format) ? ' '. $format : '';
+ $format = isset($format) ? " ". $format : "";
- $pad = ' ';
+ $pad = " ";
switch ($type) {
- case 'table_start':
- $css = $this->formatConf(' class="%s"', 'css_table');
+ case "table_start":
+ $css = $this->formatConf(' class="%s"', "css_table");
return "\n\n<table$css$format>\n";
break;
- case 'table_end':
+ case "table_end":
return "</table>\n\n";
break;
- case 'caption_start':
- $css = $this->formatConf(' class="%s"', 'css_caption');
+ case "caption_start":
+ $css = $this->formatConf(' class="%s"', "css_caption");
return "<caption$css$format>\n";
break;
- case 'caption_end':
+ case "caption_end":
return "</caption>\n";
break;
- case 'row_start':
- $css = $this->formatConf(' class="%s"', 'css_tr');
+ case "row_start":
+ $css = $this->formatConf(' class="%s"', "css_tr");
return "$pad<tr$css$format>\n";
break;
- case 'row_end':
+ case "row_end":
return "$pad</tr>\n";
break;
- case 'cell_start':
+ case "cell_start":
// base html
$html = $pad . $pad;
// is this a TH or TD cell?
- if ($attr == 'header') {
+ if ($attr == "header") {
// start a header cell
- $css = $this->formatConf(' class="%s"', 'css_th');
+ $css = $this->formatConf(' class="%s"', "css_th");
$html .= "<th$css";
} else {
// start a normal cell
- $css = $this->formatConf(' class="%s"', 'css_td');
+ $css = $this->formatConf(' class="%s"', "css_td");
$html .= "<td$css";
}
@@ -114,7 +114,7 @@ class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
}
// add alignment
- if ($attr != 'header' && $attr != '') {
+ if ($attr != "header" && $attr != "") {
$html .= " style=\"text-align: $attr;\"";
}
@@ -123,8 +123,8 @@ class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
return $html;
break;
- case 'cell_end':
- if ($attr == 'header') {
+ case "cell_end":
+ if ($attr == "header") {
return "</th>\n";
} else {
return "</td>\n";
@@ -132,7 +132,7 @@ class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
break;
default:
- return '';
+ return "";
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Tighten.php b/includes/pear/Text/Wiki/Render/Xhtml/Tighten.php
index 30d6dfd..48277f0 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Tighten.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Tighten.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -28,7 +28,7 @@ class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render {
function token()
{
- return '';
+ return "";
}
}
?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Titlebar.php b/includes/pear/Text/Wiki/Render/Xhtml/Titlebar.php
index d6e24a8..31c1b96 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Titlebar.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Titlebar.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,7 +26,7 @@
class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render {
var $conf = array(
- 'css' => 'titlebar'
+ "css" => "titlebar"
);
/**
@@ -44,13 +44,13 @@ class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<div$css>";
}
- if ($options['type'] == 'end') {
- return '</div>';
+ if ($options["type"] == "end") {
+ return "</div>";
}
}
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Toc.php b/includes/pear/Text/Wiki/Render/Xhtml/Toc.php
index 2b68b68..7048f09 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Toc.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Toc.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,11 +26,12 @@
class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
var $conf = array(
- 'css_list' => null,
- 'css_item' => null,
- 'title' => '<strong>Table of Contents</strong>',
- 'div_id' => 'toc',
- 'collapse' => true
+ "css_list" => null,
+ "css_item" => null,
+ "title" => "<strong>Table of Contents</strong>",
+ "div_id" => "toc",
+ "base_url" => "",
+ "collapse" => true
);
var $min = 2;
@@ -55,46 +56,46 @@ class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
switch ($type) {
- case 'list_start':
+ case "list_start":
- $css = $this->getConf('css_list');
- $html = '';
+ $css = $this->getConf("css_list");
+ $html = "";
// collapse div within a table?
- if ($this->getConf('collapse')) {
+ if ($this->getConf("collapse")) {
$html .= '<table border="0" cellspacing="0" cellpadding="0">';
$html .= "<tr><td>\n";
}
// add the div, class, and id
- $html .= '<div';
+ $html .= "<div";
if ($css) {
$html .= " class=\"$css\"";
}
- $div_id = $this->getConf('div_id');
+ $div_id = $this->getConf("div_id");
if ($div_id) {
$html .= " id=\"$div_id\"";
}
// add the title, and done
- $html .= '>';
- $html .= $this->getConf('title');
+ $html .= ">";
+ $html .= $this->getConf("title");
return $html;
break;
- case 'list_end':
- if ($this->getConf('collapse')) {
+ case "list_end":
+ if ($this->getConf("collapse")) {
return "\n</div>\n</td></tr></table>\n\n";
} else {
return "\n</div>\n\n";
}
break;
- case 'item_start':
+ case "item_start":
$html = "\n\t<div";
- $css = $this->getConf('css_item');
+ $css = $this->getConf("css_item");
if ($css) {
$html .= " class=\"$css\"";
}
@@ -102,11 +103,11 @@ class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
$pad = ($level - $this->min);
$html .= " style=\"margin-left: {$pad}em;\">";
- $html .= "<a href=\"#$id\">";
+ $html .= '<a href="' . $this->getConf("base_url") . "#" . $id . '">';
return $html;
break;
- case 'item_end':
+ case "item_end":
return "</a></div>";
break;
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Tt.php b/includes/pear/Text/Wiki/Render/Xhtml/Tt.php
index 3cefe85..7f52284 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Tt.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Tt.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -27,7 +27,7 @@ class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render {
var $conf = array(
- 'css' => null
+ "css" => null
);
/**
@@ -45,14 +45,14 @@ class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<tt$css>";
}
- if ($options['type'] == 'end') {
- return '</tt>';
+ if ($options["type"] == "end") {
+ return "</tt>";
}
+ return "";
}
-}
-?>
+} \ No newline at end of file
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Underline.php b/includes/pear/Text/Wiki/Render/Xhtml/Underline.php
index a6cbf59..5e604f2 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Underline.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Underline.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -25,9 +25,9 @@
*/
class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render {
- var $conf = array(
- 'css' => null
- );
+ public $conf = [
+ "css" => null,
+ ];
/**
*
@@ -44,14 +44,14 @@ class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render {
function token($options)
{
- if ($options['type'] == 'start') {
- $css = $this->formatConf(' class="%s"', 'css');
+ if ($options["type"] == "start") {
+ $css = $this->formatConf(' class="%s"', "css");
return "<u$css>";
}
- if ($options['type'] == 'end') {
- return '</u>';
+ if ($options["type"] == "end") {
+ return "</u>";
}
+ return "";
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Url.php b/includes/pear/Text/Wiki/Render/Xhtml/Url.php
index 5c06177..f4f2e80 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Url.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Url.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,15 +26,15 @@
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
- );
+ public $conf = [
+ "target" => "_blank",
+ "images" => true,
+ "img_ext" => [ "jpg", "jpeg", "gif", "png" ],
+ "css_inline" => null,
+ "css_footnote" => null,
+ "css_descr" => null,
+ "css_img" => null,
+ ];
/**
*
@@ -57,75 +57,67 @@ class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
// find the rightmost dot and determine the filename
// extension.
- $pos = strrpos($href, '.');
+ $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()))) {
+ if ($this->getConf("images") &&
+ in_array($ext, $this->getConf("img_ext", array()))) {
// create alt text for the image
- if (! isset($text) || $text == '') {
+ if (! isset($text) || $text == "") {
$text = basename($href);
$text = $this->textEncode($text);
}
// generate an image tag
- $css = $this->formatConf(' class="%s"', 'css_img');
+ $css = $this->formatConf(' class="%s"', "css_img");
$start = "<img$css src=\"$href\" alt=\"$text\" title=\"$text\" /><!-- ";
$end = " -->";
} 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');
- }
+ $target = ( $href[0] == "#" ||
+ strtolower( substr( $href, 0, 7 ) ) == "mailto:" ) ? "" : $this->getConf( "target" );
- // generate a regular link (not an image)
- $text = $this->textEncode($text);
- $css = $this->formatConf(' class="%s"', "css_$type");
- $start = "<a$css href=\"$href\"";
+ // generate a regular link (not an image)
+ $text = $this->textEncode( $text );
+ $css = $this->formatConf( ' class="%s"', "css_$type" );
+ $start = "<a$css href=\"$href\"";
- 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);
- $start .= " onclick=\"window.open(this.href, '$target');";
- $start .= " return false;\"";
- }
-
- if (isset($name)) {
- $start .= " id=\"$name\"";
- }
+ 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 );
+ $start .= " onclick=\"window.open(this.href, '$target');";
+ $start .= " return false;\"";
+ }
- // finish up output
- $start .= ">";
- $end = "</a>";
+ if (isset( $name )) {
+ $start .= " id=\"$name\"";
+ }
- // make numbered references look like footnotes when no
- // CSS class specified, make them superscript by default
- if ($type == 'footnote' && ! $css) {
- $start = '<sup>' . $start;
- $end = $end . '</sup>';
- }
- }
+ // finish up output
+ $start .= ">";
+ $end = "</a>";
+
+ // make numbered references look like footnotes when no
+ // CSS class specified, make them superscript by default
+ if ($type == "footnote" && !$css) {
+ $start = "<sup>" . $start;
+ $end = $end . "</sup>";
+ }
+ }
+
+ if ($options["type"] == "start") {
+ $output = $start;
+ }
+ else { $end .= "</sup>"; }
+ $output = ( $options["type"] == "end" ) ? $end : $start . $text . $end;
+
+ return $output;
+ }
- if ($options['type'] == 'start') {
- $output = $start;
- } else if ($options['type'] == 'end') {
- $output = $end;
- } else {
- $output = $start . $text . $end;
- }
- return $output;
- }
}
-?>
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Wikilink.php b/includes/pear/Text/Wiki/Render/Xhtml/Wikilink.php
index b93b000..5912a57 100644..100755
--- a/includes/pear/Text/Wiki/Render/Xhtml/Wikilink.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Wikilink.php
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @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 $
+ * @version CVS: $Id$
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -26,14 +26,14 @@
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
+ "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
);
@@ -59,8 +59,8 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
// 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'];
+ if (isset($this->conf["exists_callback"])) {
+ $callback =& $this->conf["exists_callback"];
} else {
$callback = false;
}
@@ -70,7 +70,7 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
$exists = call_user_func($callback, $page);
} else {
// no callback, go to the naive page array.
- $list = $this->getConf('pages');
+ $list = $this->getConf("pages");
if (is_array($list)) {
// yes, check against the page list
$exists = in_array($page, $list);
@@ -80,7 +80,7 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
}
}
- $anchor = '#'.$this->urlEncode(substr($anchor, 1));
+ $anchor = "#".$this->urlEncode(substr($anchor, 1));
// does the page exist?
if ($exists) {
@@ -91,9 +91,9 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
// 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');
+ $href = $this->getConf("view_url");
- if (strpos($href, '%s') === false) {
+ if (strpos($href, "%s") === false) {
// use the old form (page-at-end)
$href = $href . $this->urlEncode($page) . $anchor;
} else {
@@ -102,19 +102,19 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
}
// get the CSS class and generate output
- $css = ' class="'.$this->textEncode($this->getConf('css')).'"';
+ $css = ' class="'.$this->textEncode($this->getConf("css")).'"';
- $start = '<a'.$css.' href="'.$this->textEncode($href).'">';
- $end = '</a>';
+ $start = "<a".$css.' href="'.$this->textEncode($href).'">';
+ $end = "</a>";
} else {
// PAGE DOES NOT EXIST.
// link to a create-page url, but only if new_url is set
- $href = $this->getConf('new_url', null);
+ $href = $this->getConf("new_url", null);
// set the proper HREF
- if (! $href || trim($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
@@ -126,7 +126,7 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
// 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) {
+ if (strpos($href, "%s") === false) {
// use the old form
$href = $href . $this->urlEncode($page);
} else {
@@ -136,24 +136,24 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
}
// get the appropriate CSS class and new-link text
- $css = ' class="'.$this->textEncode($this->getConf('css_new')).'"';
- $new = $this->getConf('new_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');
+ $pos = $this->getConf("new_text_pos");
if (! $pos || ! $new) {
// no position (or no new_text), use css only on the page name
- $start = '<a'.$css.' href="'.$this->textEncode($href).'">';
- $end = '</a>';
- } elseif ($pos == 'before') {
+ $start = "<a".$css.' href="'.$this->textEncode($href).'">';
+ $end = "</a>";
+ } elseif ($pos == "before") {
// use the new_text BEFORE the page name
- $start = '<a'.$css.' href="'.$this->textEncode($href).'">'.$this->textEncode($new).'</a>';
- $end = '';
+ $start = "<a".$css.' href="'.$this->textEncode($href).'">'.$this->textEncode($new)."</a>";
+ $end = "";
} else {
// default, use the new_text link AFTER the page name
- $start = '';
- $end = '<a'.$css.' href="'.$this->textEncode($href).'">'.$this->textEncode($new).'</a>';
+ $start = "";
+ $end = "<a".$css.' href="'.$this->textEncode($href).'">'.$this->textEncode($new)."</a>";
}
}
if (!strlen($text)) {
@@ -161,10 +161,10 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
}
if (isset($type)) {
switch ($type) {
- case 'start':
+ case "start":
$output = $start;
break;
- case 'end':
+ case "end":
$output = $end;
break;
}