merge bundled libs with 1.7.8
fixing idents spaces tabs and version numbers for .current_version file
This commit is contained in:
parent
c61cf9d10a
commit
f4ec48675b
@ -1,12 +1,14 @@
|
|||||||
Cache_Lite 1.5.1
|
Cache_Lite 1.54
|
||||||
HTTP_Request 1.2.4
|
HTTP_Request 1.43
|
||||||
HTTP_Request2 2.2.1
|
HTTP_Request2 2.2.1
|
||||||
Net_CheckIP 1.1
|
Net_CheckIP 1.5
|
||||||
Net_Socket 1.0.6
|
Net_DNSBL 1.4
|
||||||
Net_URL 1.0.14
|
Net_Socket 1.24
|
||||||
PEAR 1.9.4
|
Net_URL 1.36
|
||||||
Text_Wiki 0.25.0
|
Net_SURBL 1.4
|
||||||
XML_RPC 1.4.0
|
Onyx (customized) 1.0
|
||||||
Onyx 1.0 (customized)
|
PEAR 1.83
|
||||||
Smarty 2.6.9
|
SimplePie 1.2.1
|
||||||
Net_DNSBL 1.0.0
|
Smarty 3.1.18
|
||||||
|
Text_Wiki 1.27
|
||||||
|
XML_RPC 1.5.5
|
||||||
|
@ -376,8 +376,8 @@ class Cache_Lite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
|
if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
|
||||||
$this->clean(false, 'old');
|
$this->clean(false, 'old');
|
||||||
}
|
}
|
||||||
if ($this->_writeControl) {
|
if ($this->_writeControl) {
|
||||||
$res = $this->_writeAndControl($data);
|
$res = $this->_writeAndControl($data);
|
||||||
if (is_bool($res)) {
|
if (is_bool($res)) {
|
||||||
@ -599,7 +599,7 @@ class Cache_Lite
|
|||||||
$motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
|
$motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
|
||||||
}
|
}
|
||||||
if ($this->_memoryCaching) {
|
if ($this->_memoryCaching) {
|
||||||
foreach($this->_memoryCachingArray as $key => $v) {
|
foreach($this->_memoryCachingArray as $key => $v) {
|
||||||
if (strpos($key, $motif) !== false) {
|
if (strpos($key, $motif) !== false) {
|
||||||
unset($this->_memoryCachingArray[$key]);
|
unset($this->_memoryCachingArray[$key]);
|
||||||
$this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
|
$this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
|
||||||
|
@ -89,7 +89,7 @@ class HTTP_Request {
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_user;
|
var $_user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic Auth Password
|
* Basic Auth Password
|
||||||
* @var string
|
* @var string
|
||||||
@ -101,25 +101,25 @@ class HTTP_Request {
|
|||||||
* @var object Net_Socket
|
* @var object Net_Socket
|
||||||
*/
|
*/
|
||||||
var $_sock;
|
var $_sock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy server
|
* Proxy server
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_proxy_host;
|
var $_proxy_host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy port
|
* Proxy port
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
var $_proxy_port;
|
var $_proxy_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy username
|
* Proxy username
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_proxy_user;
|
var $_proxy_user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy password
|
* Proxy password
|
||||||
* @var string
|
* @var string
|
||||||
@ -133,7 +133,7 @@ class HTTP_Request {
|
|||||||
var $_postData;
|
var $_postData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request body
|
* Request body
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_body;
|
var $_body;
|
||||||
@ -145,7 +145,7 @@ class HTTP_Request {
|
|||||||
var $_bodyDisallowed = array('TRACE');
|
var $_bodyDisallowed = array('TRACE');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Files to post
|
* Files to post
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $_postFiles = array();
|
var $_postFiles = array();
|
||||||
@ -155,25 +155,25 @@ class HTTP_Request {
|
|||||||
* @var float
|
* @var float
|
||||||
*/
|
*/
|
||||||
var $_timeout;
|
var $_timeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP_Response object
|
* HTTP_Response object
|
||||||
* @var object HTTP_Response
|
* @var object HTTP_Response
|
||||||
*/
|
*/
|
||||||
var $_response;
|
var $_response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to allow redirects
|
* Whether to allow redirects
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
var $_allowRedirects;
|
var $_allowRedirects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum redirects allowed
|
* Maximum redirects allowed
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
var $_maxRedirects;
|
var $_maxRedirects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current number of redirects
|
* Current number of redirects
|
||||||
* @var integer
|
* @var integer
|
||||||
@ -193,7 +193,7 @@ class HTTP_Request {
|
|||||||
var $_listeners = array();
|
var $_listeners = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to save response body in response object property
|
* Whether to save response body in response object property
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
var $_saveBody = true;
|
var $_saveBody = true;
|
||||||
@ -286,7 +286,7 @@ class HTTP_Request {
|
|||||||
$this->addHeader('Accept-Encoding', 'gzip');
|
$this->addHeader('Accept-Encoding', 'gzip');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a Host header for HTTP/1.1 requests
|
* Generates a Host header for HTTP/1.1 requests
|
||||||
*
|
*
|
||||||
@ -303,14 +303,14 @@ class HTTP_Request {
|
|||||||
|
|
||||||
} elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
|
} elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
|
||||||
$host = $this->_url->host . ':' . $this->_url->port;
|
$host = $this->_url->host . ':' . $this->_url->port;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$host = $this->_url->host;
|
$host = $this->_url->host;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $host;
|
return $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the object to its initial state (DEPRECATED).
|
* Resets the object to its initial state (DEPRECATED).
|
||||||
* Takes the same parameters as the constructor.
|
* Takes the same parameters as the constructor.
|
||||||
@ -344,7 +344,7 @@ class HTTP_Request {
|
|||||||
$this->addHeader('Host', $this->_generateHostHeader());
|
$this->addHeader('Host', $this->_generateHostHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a proxy to be used
|
* Sets a proxy to be used
|
||||||
*
|
*
|
||||||
@ -438,8 +438,8 @@ class HTTP_Request {
|
|||||||
function addQueryString($name, $value, $preencoded = false)
|
function addQueryString($name, $value, $preencoded = false)
|
||||||
{
|
{
|
||||||
$this->_url->addQueryString($name, $value, $preencoded);
|
$this->_url->addQueryString($name, $value, $preencoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the querystring to literally what you supply
|
* Sets the querystring to literally what you supply
|
||||||
*
|
*
|
||||||
@ -546,7 +546,7 @@ class HTTP_Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears any postdata that has been added (DEPRECATED).
|
* Clears any postdata that has been added (DEPRECATED).
|
||||||
*
|
*
|
||||||
* Useful for multiple request scenarios.
|
* Useful for multiple request scenarios.
|
||||||
*
|
*
|
||||||
@ -570,9 +570,9 @@ class HTTP_Request {
|
|||||||
$cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
|
$cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
|
||||||
$this->addHeader('Cookie', $cookies . $name . '=' . $value);
|
$this->addHeader('Cookie', $cookies . $name . '=' . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears any cookies that have been added (DEPRECATED).
|
* Clears any cookies that have been added (DEPRECATED).
|
||||||
*
|
*
|
||||||
* Useful for multiple request scenarios
|
* Useful for multiple request scenarios
|
||||||
*
|
*
|
||||||
@ -645,7 +645,7 @@ class HTTP_Request {
|
|||||||
AND $this->getResponseCode() < 399
|
AND $this->getResponseCode() < 399
|
||||||
AND !empty($this->_response->_headers['location'])) {
|
AND !empty($this->_response->_headers['location'])) {
|
||||||
|
|
||||||
|
|
||||||
$redirect = $this->_response->_headers['location'];
|
$redirect = $this->_response->_headers['location'];
|
||||||
|
|
||||||
// Absolute URL
|
// Absolute URL
|
||||||
@ -655,7 +655,7 @@ class HTTP_Request {
|
|||||||
// Absolute path
|
// Absolute path
|
||||||
} elseif ($redirect[0] == '/') {
|
} elseif ($redirect[0] == '/') {
|
||||||
$this->_url->path = $redirect;
|
$this->_url->path = $redirect;
|
||||||
|
|
||||||
// Relative path
|
// Relative path
|
||||||
} elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
|
} elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
|
||||||
if (substr($this->_url->path, -1) == '/') {
|
if (substr($this->_url->path, -1) == '/') {
|
||||||
@ -665,7 +665,7 @@ class HTTP_Request {
|
|||||||
}
|
}
|
||||||
$redirect = Net_URL::resolvePath($redirect);
|
$redirect = Net_URL::resolvePath($redirect);
|
||||||
$this->_url->path = $redirect;
|
$this->_url->path = $redirect;
|
||||||
|
|
||||||
// Filename, no path
|
// Filename, no path
|
||||||
} else {
|
} else {
|
||||||
if (substr($this->_url->path, -1) == '/') {
|
if (substr($this->_url->path, -1) == '/') {
|
||||||
@ -842,7 +842,7 @@ class HTTP_Request {
|
|||||||
$request .= 'Content-Length: ' . strlen($this->_body) . "\r\n\r\n";
|
$request .= 'Content-Length: ' . strlen($this->_body) . "\r\n\r\n";
|
||||||
$request .= $this->_body;
|
$request .= $this->_body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $request;
|
return $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,7 +894,7 @@ class HTTP_Request {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a Listener from the list of listeners
|
* Removes a Listener from the list of listeners
|
||||||
*
|
*
|
||||||
* @param object HTTP_Request_Listener instance to detach
|
* @param object HTTP_Request_Listener instance to detach
|
||||||
* @return boolean whether the listener was successfully detached
|
* @return boolean whether the listener was successfully detached
|
||||||
@ -951,13 +951,13 @@ class HTTP_Response
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_protocol;
|
var $_protocol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return code
|
* Return code
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_code;
|
var $_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response headers
|
* Response headers
|
||||||
* @var array
|
* @var array
|
||||||
@ -965,7 +965,7 @@ class HTTP_Response
|
|||||||
var $_headers;
|
var $_headers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookies set in response
|
* Cookies set in response
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $_cookies;
|
var $_cookies;
|
||||||
@ -1078,7 +1078,7 @@ class HTTP_Response
|
|||||||
list($headername, $headervalue) = explode(':', $header, 2);
|
list($headername, $headervalue) = explode(':', $header, 2);
|
||||||
$headername = strtolower($headername);
|
$headername = strtolower($headername);
|
||||||
$headervalue = ltrim($headervalue);
|
$headervalue = ltrim($headervalue);
|
||||||
|
|
||||||
if ('set-cookie' != $headername) {
|
if ('set-cookie' != $headername) {
|
||||||
if (isset($this->_headers[$headername])) {
|
if (isset($this->_headers[$headername])) {
|
||||||
$this->_headers[$headername] .= ',' . $headervalue;
|
$this->_headers[$headername] .= ',' . $headervalue;
|
||||||
@ -1154,7 +1154,7 @@ class HTTP_Response
|
|||||||
if (0 == $this->_chunkLength) {
|
if (0 == $this->_chunkLength) {
|
||||||
$line = $this->_sock->readLine();
|
$line = $this->_sock->readLine();
|
||||||
if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
|
if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
|
||||||
$this->_chunkLength = hexdec($matches[1]);
|
$this->_chunkLength = hexdec($matches[1]);
|
||||||
// Chunk with zero length indicates the end
|
// Chunk with zero length indicates the end
|
||||||
if (0 == $this->_chunkLength) {
|
if (0 == $this->_chunkLength) {
|
||||||
$this->_sock->readLine(); // make this an eof()
|
$this->_sock->readLine(); // make this an eof()
|
||||||
|
@ -122,12 +122,12 @@ class ONYX_RSS
|
|||||||
($file && file_exists($file) && $time <= $this->rss['cache_age'] && $mod >= (time() - ($this->rss['cache_age'] * 60))))
|
($file && file_exists($file) && $time <= $this->rss['cache_age'] && $mod >= (time() - ($this->rss['cache_age'] * 60))))
|
||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
|
require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
|
||||||
serendipity_request_start();
|
serendipity_request_start();
|
||||||
$req = new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5));
|
$req = new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5));
|
||||||
$res = $req->sendRequest();
|
$res = $req->sendRequest();
|
||||||
|
|
||||||
if (PEAR::isError($res) || $req->getResponseCode() != '200')
|
if (PEAR::isError($res) || $req->getResponseCode() != '200')
|
||||||
{
|
{
|
||||||
serendipity_request_end();
|
serendipity_request_end();
|
||||||
|
@ -60,15 +60,15 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
|
|||||||
'attr' => array('type' => '')
|
'attr' => array('type' => '')
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// get the attributes...
|
// get the attributes...
|
||||||
$attr = $this->getAttrs($args);
|
$attr = $this->getAttrs($args);
|
||||||
|
|
||||||
// ... and make sure we have a 'type'
|
// ... and make sure we have a 'type'
|
||||||
if (! isset($attr['type'])) {
|
if (! isset($attr['type'])) {
|
||||||
$attr['type'] = '';
|
$attr['type'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// retain the options
|
// retain the options
|
||||||
$options = array(
|
$options = array(
|
||||||
'text' => $matches[3],
|
'text' => $matches[3],
|
||||||
'attr' => $attr
|
'attr' => $attr
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
|
class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
|
||||||
|
|
||||||
var $conf = array(
|
var $conf = array(
|
||||||
// list separator for params and throws
|
// list separator for params and throws
|
||||||
'list_sep' => ', ',
|
'list_sep' => ', ',
|
||||||
|
|
||||||
// the "main" format string
|
// the "main" format string
|
||||||
|
@ -39,9 +39,9 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
|
|||||||
if (isset($this->conf['exists_callback'])) {
|
if (isset($this->conf['exists_callback'])) {
|
||||||
$callback =& $this->conf['exists_callback'];
|
$callback =& $this->conf['exists_callback'];
|
||||||
} else {
|
} else {
|
||||||
$callback = false;
|
$callback = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($callback) {
|
if ($callback) {
|
||||||
// use the callback function
|
// use the callback function
|
||||||
$exists = call_user_func($callback, $page);
|
$exists = call_user_func($callback, $page);
|
||||||
|
@ -292,54 +292,54 @@ class Text_Wiki_Rule {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Simple method to extract 'option="value"' portions of wiki markup,
|
* Simple method to extract 'option="value"' portions of wiki markup,
|
||||||
* typically used only in macros.
|
* typically used only in macros.
|
||||||
*
|
*
|
||||||
* The syntax is pretty strict; there can be no spaces between the
|
* The syntax is pretty strict; there can be no spaces between the
|
||||||
* option name, the equals, and the first double-quote; the value
|
* option name, the equals, and the first double-quote; the value
|
||||||
* must be surrounded by double-quotes. You can escape characters in
|
* must be surrounded by double-quotes. You can escape characters in
|
||||||
* the value with a backslash, and the backslash will be stripped for
|
* the value with a backslash, and the backslash will be stripped for
|
||||||
* you.
|
* you.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
* @param string $text The "macro options" portion of macro markup.
|
* @param string $text The "macro options" portion of macro markup.
|
||||||
*
|
*
|
||||||
* @return array An associative array of key-value pairs where the
|
* @return array An associative array of key-value pairs where the
|
||||||
* key is the option name and the value is the option value.
|
* key is the option name and the value is the option value.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getMacroArgs($text)
|
function getMacroArgs($text)
|
||||||
{
|
{
|
||||||
// find the =" sections;
|
// find the =" sections;
|
||||||
$tmp = explode('="', trim($text));
|
$tmp = explode('="', trim($text));
|
||||||
|
|
||||||
// basic setup
|
// basic setup
|
||||||
$k = count($tmp) - 1;
|
$k = count($tmp) - 1;
|
||||||
$arg = array();
|
$arg = array();
|
||||||
$key = null;
|
$key = null;
|
||||||
|
|
||||||
// loop through the sections
|
// loop through the sections
|
||||||
foreach ($tmp as $i => $val) {
|
foreach ($tmp as $i => $val) {
|
||||||
|
|
||||||
// first element is always the first key
|
// first element is always the first key
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
$key = trim($val);
|
$key = trim($val);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the last double-quote in the value.
|
// find the last double-quote in the value.
|
||||||
// the part to the left is the value for the last key,
|
// the part to the left is the value for the last key,
|
||||||
// the part to the right is the next key name
|
// the part to the right is the next key name
|
||||||
$pos = strrpos($val, '"');
|
$pos = strrpos($val, '"');
|
||||||
$arg[$key] = stripslashes(substr($val, 0, $pos));
|
$arg[$key] = stripslashes(substr($val, 0, $pos));
|
||||||
$key = trim(substr($val, $pos+1));
|
$key = trim(substr($val, $pos+1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arg;
|
return $arg;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -189,21 +189,21 @@ class Text_Wiki_Rule_blockquote extends Text_Wiki_Rule {
|
|||||||
{
|
{
|
||||||
$type = $options['type'];
|
$type = $options['type'];
|
||||||
$level = $options['level'];
|
$level = $options['level'];
|
||||||
|
|
||||||
// set up indenting so that the results look nice; we do this
|
// set up indenting so that the results look nice; we do this
|
||||||
// in two steps to avoid str_pad mathematics. ;-)
|
// in two steps to avoid str_pad mathematics. ;-)
|
||||||
$pad = str_pad('', $level, "\t");
|
$pad = str_pad('', $level, "\t");
|
||||||
$pad = str_replace("\t", ' ', $pad);
|
$pad = str_replace("\t", ' ', $pad);
|
||||||
|
|
||||||
// starting
|
// starting
|
||||||
if ($type == 'start') {
|
if ($type == 'start') {
|
||||||
return "$pad<blockquote>";
|
return "$pad<blockquote>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ending
|
// ending
|
||||||
if ($type == 'end') {
|
if ($type == 'end') {
|
||||||
return $pad . "</blockquote>\n";
|
return $pad . "</blockquote>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -84,15 +84,15 @@ class Text_Wiki_Rule_center extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
if ($options['type'] == 'start') {
|
if ($options['type'] == 'start') {
|
||||||
//return "\n<center>\n";
|
//return "\n<center>\n";
|
||||||
return '<div style="text-align: center;">';
|
return '<div style="text-align: center;">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['type'] == 'end') {
|
if ($options['type'] == 'end') {
|
||||||
//return "</center>\n";
|
//return "</center>\n";
|
||||||
return '</div>';
|
return '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The regular expression used to find source text matching this
|
* The regular expression used to find source text matching this
|
||||||
@ -47,10 +47,10 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';
|
var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a token entry for the matched text. Token options are:
|
* Generates a token entry for the matched text. Token options are:
|
||||||
@ -65,12 +65,12 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
* the source text.
|
* the source text.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
// are there additional arguments?
|
// are there additional arguments?
|
||||||
$args = trim($matches[2]);
|
$args = trim($matches[2]);
|
||||||
|
|
||||||
if ($args == '') {
|
if ($args == '') {
|
||||||
$options = array(
|
$options = array(
|
||||||
'text' => $matches[3],
|
'text' => $matches[3],
|
||||||
@ -82,11 +82,11 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
'args' => $this->getMacroArgs($args)
|
'args' => $this->getMacroArgs($args)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->addToken($options) . $matches[5];
|
return $this->addToken($options) . $matches[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -99,36 +99,36 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
// trim opening and closing whitespace
|
// trim opening and closing whitespace
|
||||||
$text = trim($options['text']);
|
$text = trim($options['text']);
|
||||||
$args = $options['args'];
|
$args = $options['args'];
|
||||||
|
|
||||||
if (strtolower($args['type']) == 'php') {
|
if (strtolower($args['type']) == 'php') {
|
||||||
|
|
||||||
// PHP code example
|
// PHP code example
|
||||||
|
|
||||||
// add the PHP tags
|
// add the PHP tags
|
||||||
$text = "<?php\n" . $options['text'] . "\n?>"; // <?php
|
$text = "<?php\n" . $options['text'] . "\n?>"; // <?php
|
||||||
|
|
||||||
// convert tabs to four spaces
|
// convert tabs to four spaces
|
||||||
$text = str_replace("\t", " ", $text);
|
$text = str_replace("\t", " ", $text);
|
||||||
|
|
||||||
// colorize the code block (also converts HTML entities and adds
|
// colorize the code block (also converts HTML entities and adds
|
||||||
// <code>...</code> tags)
|
// <code>...</code> tags)
|
||||||
ob_start();
|
ob_start();
|
||||||
highlight_string($text);
|
highlight_string($text);
|
||||||
$text = ob_get_contents();
|
$text = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
// replace <br /> tags with simple newlines
|
// replace <br /> tags with simple newlines
|
||||||
//$text = str_replace("<br />", "\n", $text);
|
//$text = str_replace("<br />", "\n", $text);
|
||||||
|
|
||||||
// replace non-breaking space with simple spaces
|
// replace non-breaking space with simple spaces
|
||||||
//$text = str_replace(" ", " ", $text);
|
//$text = str_replace(" ", " ", $text);
|
||||||
|
|
||||||
// replace <br /> tags with simple newlines
|
// replace <br /> tags with simple newlines
|
||||||
// replace non-breaking space with simple spaces
|
// replace non-breaking space with simple spaces
|
||||||
// translate old HTML to new XHTML
|
// translate old HTML to new XHTML
|
||||||
@ -141,18 +141,18 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
'color="' => 'style="color:'
|
'color="' => 'style="color:'
|
||||||
);
|
);
|
||||||
$text = strtr($text, $map);
|
$text = strtr($text, $map);
|
||||||
|
|
||||||
// get rid of the last newline inside the code block
|
// get rid of the last newline inside the code block
|
||||||
// (becuase higlight_string puts one there)
|
// (becuase higlight_string puts one there)
|
||||||
if (substr($text, -8) == "\n</code>") {
|
if (substr($text, -8) == "\n</code>") {
|
||||||
$text = substr($text, 0, -8) . "</code>";
|
$text = substr($text, 0, -8) . "</code>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// done
|
// done
|
||||||
$text = "<pre>$text</pre>";
|
$text = "<pre>$text</pre>";
|
||||||
|
|
||||||
} elseif (strtolower($args['type']) == 'html') {
|
} elseif (strtolower($args['type']) == 'html') {
|
||||||
|
|
||||||
// HTML code example:
|
// HTML code example:
|
||||||
// add <html> opening and closing tags,
|
// add <html> opening and closing tags,
|
||||||
// convert tabs to four spaces,
|
// convert tabs to four spaces,
|
||||||
@ -161,7 +161,7 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
$text = "<html>\n$text\n</html>";
|
$text = "<html>\n$text\n</html>";
|
||||||
$text = htmlentities($text);
|
$text = htmlentities($text);
|
||||||
$text = "<pre><code>$text</code></pre>";
|
$text = "<pre><code>$text</code></pre>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// generic code example:
|
// generic code example:
|
||||||
// convert tabs to four spaces,
|
// convert tabs to four spaces,
|
||||||
@ -170,7 +170,7 @@ class Text_Wiki_Rule_code extends Text_Wiki_Rule {
|
|||||||
$text = htmlentities($text);
|
$text = htmlentities($text);
|
||||||
$text = "<pre><code>$text</code></pre>";
|
$text = "<pre><code>$text</code></pre>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "\n$text\n";
|
return "\n$text\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,17 +88,17 @@ class Text_Wiki_Rule_colortext extends Text_Wiki_Rule {
|
|||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$start = $this->addToken(
|
$start = $this->addToken(
|
||||||
array(
|
array(
|
||||||
'type' => 'start',
|
'type' => 'start',
|
||||||
'color' => $matches[1]
|
'color' => $matches[1]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$end = $this->addToken(
|
$end = $this->addToken(
|
||||||
array(
|
array(
|
||||||
'type' => 'end',
|
'type' => 'end',
|
||||||
'color' => $matches[1]
|
'color' => $matches[1]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $start . $matches[2] . $end;
|
return $start . $matches[2] . $end;
|
||||||
|
@ -91,12 +91,12 @@ class Text_Wiki_Rule_embed extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
$file = $this->_conf['base'] . $options['path'];
|
$file = $this->_conf['base'] . $options['path'];
|
||||||
ob_start();
|
ob_start();
|
||||||
include($file);
|
include($file);
|
||||||
$output = ob_get_contents();
|
$output = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -91,13 +91,13 @@ class Text_Wiki_Rule_emphasis extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
if ($options['type'] == 'start') {
|
if ($options['type'] == 'start') {
|
||||||
return '<em>';
|
return '<em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['type'] == 'end') {
|
if ($options['type'] == 'end') {
|
||||||
return '</em>';
|
return '</em>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -151,12 +151,12 @@ class Text_Wiki_Rule_freelink extends Text_Wiki_Rule {
|
|||||||
// the page exists, show a link to the page
|
// the page exists, show a link to the page
|
||||||
$href = $this->_conf['view_url'];
|
$href = $this->_conf['view_url'];
|
||||||
if (strpos($href, '%s') === false) {
|
if (strpos($href, '%s') === false) {
|
||||||
// use the old form
|
// use the old form
|
||||||
$href = $href . $page . '#' . $anchor;
|
$href = $href . $page . '#' . $anchor;
|
||||||
} else {
|
} else {
|
||||||
// use the new form
|
// use the new form
|
||||||
$href = sprintf($href, $page . '#' . $anchor);
|
$href = sprintf($href, $page . '#' . $anchor);
|
||||||
}
|
}
|
||||||
return "<a href=\"$href\">$text</a>";
|
return "<a href=\"$href\">$text</a>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -165,12 +165,12 @@ class Text_Wiki_Rule_freelink extends Text_Wiki_Rule {
|
|||||||
// the "new page" text
|
// the "new page" text
|
||||||
$href = $this->_conf['new_url'];
|
$href = $this->_conf['new_url'];
|
||||||
if (strpos($href, '%s') === false) {
|
if (strpos($href, '%s') === false) {
|
||||||
// use the old form
|
// use the old form
|
||||||
$href = $href . $page;
|
$href = $href . $page;
|
||||||
} else {
|
} else {
|
||||||
// use the new form
|
// use the new form
|
||||||
$href = sprintf($href, $page);
|
$href = sprintf($href, $page);
|
||||||
}
|
}
|
||||||
return $text . "<a href=\"$href\">{$this->_conf['new_text']}</a>";
|
return $text . "<a href=\"$href\">{$this->_conf['new_text']}</a>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,20 +73,20 @@ class Text_Wiki_Rule_image extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$pos = strpos($matches[2], ' ');
|
$pos = strpos($matches[2], ' ');
|
||||||
|
|
||||||
if ($pos === false) {
|
if ($pos === false) {
|
||||||
$options = array(
|
$options = array(
|
||||||
'src' => $matches[2],
|
'src' => $matches[2],
|
||||||
'args' => array());
|
'args' => array());
|
||||||
} else {
|
} else {
|
||||||
// everything after the space is macro options
|
// everything after the space is macro options
|
||||||
$options = array(
|
$options = array(
|
||||||
'src' => substr($matches[2], 0, $pos),
|
'src' => substr($matches[2], 0, $pos),
|
||||||
'args' => $this->getMacroArgs(substr($matches[2], $pos+1))
|
'args' => $this->getMacroArgs(substr($matches[2], $pos+1))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->addToken($options);
|
return $this->addToken($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,31 +106,31 @@ class Text_Wiki_Rule_image extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
$src = '"' . $this->_conf['base'] . $options['src'] . '"';
|
$src = '"' . $this->_conf['base'] . $options['src'] . '"';
|
||||||
|
|
||||||
if (isset($options['args']['link'])) {
|
if (isset($options['args']['link'])) {
|
||||||
// this image has a wikilink
|
// this image has a wikilink
|
||||||
$href = $this->_wiki->getRuleConf('wikilink', 'view_url') .
|
$href = $this->_wiki->getRuleConf('wikilink', 'view_url') .
|
||||||
$options['args']['link'];
|
$options['args']['link'];
|
||||||
} else {
|
} else {
|
||||||
// image is not linked
|
// image is not linked
|
||||||
$href = null;
|
$href = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unset these so they don't show up as attributes
|
// unset these so they don't show up as attributes
|
||||||
unset($options['args']['src']);
|
unset($options['args']['src']);
|
||||||
unset($options['args']['link']);
|
unset($options['args']['link']);
|
||||||
|
|
||||||
$attr = '';
|
$attr = '';
|
||||||
foreach ($options['args'] as $key => $val) {
|
foreach ($options['args'] as $key => $val) {
|
||||||
$attr .= "$key=\"$val\" ";
|
$attr .= "$key=\"$val\" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($href) {
|
if ($href) {
|
||||||
return "<a href=\"$href\"><img src=$src $attr/></a>";
|
return "<a href=\"$href\"><img src=$src $attr/></a>";
|
||||||
} else {
|
} else {
|
||||||
return "<img src=$src $attr/>";
|
return "<img src=$src $attr/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -69,12 +69,12 @@ class Text_Wiki_Rule_include extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$file = $this->_conf['base'] . $matches[2];
|
$file = $this->_conf['base'] . $matches[2];
|
||||||
ob_start();
|
ob_start();
|
||||||
include($file);
|
include($file);
|
||||||
$output = ob_get_contents();
|
$output = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -50,36 +50,36 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function parse()
|
function parse()
|
||||||
{
|
{
|
||||||
// described interwiki links
|
// described interwiki links
|
||||||
$tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
|
$tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
$tmp_regex,
|
$tmp_regex,
|
||||||
array(&$this, 'processDescr'),
|
array(&$this, 'processDescr'),
|
||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
|
|
||||||
// standalone interwiki links
|
// standalone interwiki links
|
||||||
$tmp_regex = '/' . $this->regex . '/';
|
$tmp_regex = '/' . $this->regex . '/';
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
$tmp_regex,
|
$tmp_regex,
|
||||||
array(&$this, 'process'),
|
array(&$this, 'process'),
|
||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a replacement for the matched standalone interwiki text.
|
* Generates a replacement for the matched standalone interwiki text.
|
||||||
* Token options are:
|
* Token options are:
|
||||||
*
|
*
|
||||||
* 'site' => The key name for the Text_Wiki interwiki array map,
|
* 'site' => The key name for the Text_Wiki interwiki array map,
|
||||||
* usually the name of the interwiki site.
|
* usually the name of the interwiki site.
|
||||||
*
|
*
|
||||||
* 'page' => The page on the target interwiki to link to.
|
* 'page' => The page on the target interwiki to link to.
|
||||||
*
|
*
|
||||||
* 'text' => The text to display as the link.
|
* 'text' => The text to display as the link.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
@ -89,7 +89,7 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
* the source text, plus any text priot to the match.
|
* the source text, plus any text priot to the match.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$options = array(
|
$options = array(
|
||||||
@ -97,27 +97,27 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
'page' => $matches[2],
|
'page' => $matches[2],
|
||||||
'text' => $matches[0]
|
'text' => $matches[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
// if not in the interwiki map, don't make it an interwiki link
|
// if not in the interwiki map, don't make it an interwiki link
|
||||||
if (isset($this->_conf['sites'][$options['site']])) {
|
if (isset($this->_conf['sites'][$options['site']])) {
|
||||||
return $this->addToken($options);
|
return $this->addToken($options);
|
||||||
} else {
|
} else {
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a replacement for described interwiki links. Token
|
* Generates a replacement for described interwiki links. Token
|
||||||
* options are:
|
* options are:
|
||||||
*
|
*
|
||||||
* 'site' => The key name for the Text_Wiki interwiki array map,
|
* 'site' => The key name for the Text_Wiki interwiki array map,
|
||||||
* usually the name of the interwiki site.
|
* usually the name of the interwiki site.
|
||||||
*
|
*
|
||||||
* 'page' => The page on the target interwiki to link to.
|
* 'page' => The page on the target interwiki to link to.
|
||||||
*
|
*
|
||||||
* 'text' => The text to display as the link.
|
* 'text' => The text to display as the link.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
@ -127,7 +127,7 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
* the source text, plus any text priot to the match.
|
* the source text, plus any text priot to the match.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function processDescr(&$matches)
|
function processDescr(&$matches)
|
||||||
{
|
{
|
||||||
$options = array(
|
$options = array(
|
||||||
@ -135,16 +135,16 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
'page' => $matches[2],
|
'page' => $matches[2],
|
||||||
'text' => $matches[3]
|
'text' => $matches[3]
|
||||||
);
|
);
|
||||||
|
|
||||||
// if not in the interwiki map, don't make it an interwiki link
|
// if not in the interwiki map, don't make it an interwiki link
|
||||||
if (isset($this->_conf['sites'][$options['site']])) {
|
if (isset($this->_conf['sites'][$options['site']])) {
|
||||||
return $this->addToken($options);
|
return $this->addToken($options);
|
||||||
} else {
|
} else {
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -157,38 +157,37 @@ class Text_Wiki_Rule_interwiki extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
$site = $options['site'];
|
$site = $options['site'];
|
||||||
$page = $options['page'];
|
$page = $options['page'];
|
||||||
$text = $options['text'];
|
$text = $options['text'];
|
||||||
|
|
||||||
if (isset($this->_conf['sites'][$site])) {
|
if (isset($this->_conf['sites'][$site])) {
|
||||||
$href = $this->_conf['sites'][$site];
|
$href = $this->_conf['sites'][$site];
|
||||||
} else {
|
} else {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// old form where page is at end,
|
||||||
|
// or new form with %s placeholder for sprintf()?
|
||||||
|
if (strpos($href, '%s') === false) {
|
||||||
|
// use the old form
|
||||||
|
$href = $href . $page;
|
||||||
|
} else {
|
||||||
|
// use the new form
|
||||||
|
$href = sprintf($href, $page);
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow for alternative targets
|
||||||
|
if (isset($this->_conf['target']) &&
|
||||||
|
trim($this->_conf['target']) != '') {
|
||||||
|
$target = 'target="' . $this->_conf['target'] . '"';
|
||||||
|
} else {
|
||||||
|
$target = '';
|
||||||
|
}
|
||||||
|
|
||||||
// old form where page is at end,
|
|
||||||
// or new form with %s placeholder for sprintf()?
|
|
||||||
if (strpos($href, '%s') === false) {
|
|
||||||
// use the old form
|
|
||||||
$href = $href . $page;
|
|
||||||
} else {
|
|
||||||
// use the new form
|
|
||||||
$href = sprintf($href, $page);
|
|
||||||
}
|
|
||||||
|
|
||||||
// allow for alternative targets
|
|
||||||
if (isset($this->_conf['target']) &&
|
|
||||||
trim($this->_conf['target']) != '') {
|
|
||||||
$target = 'target="' . $this->_conf['target'] . '"';
|
|
||||||
} else {
|
|
||||||
$target = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return "<a $target href=\"$href\">$text</a>";
|
return "<a $target href=\"$href\">$text</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_italic extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_italic extends Text_Wiki_Rule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The regular expression used to parse the source text and find
|
* The regular expression used to parse the source text and find
|
||||||
@ -47,10 +47,10 @@ class Text_Wiki_Rule_italic extends Text_Wiki_Rule {
|
|||||||
* @see parse()
|
* @see parse()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $regex = "/''(()|[^'].*)''/U";
|
var $regex = "/''(()|[^'].*)''/U";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a replacement for the matched text. Token options are:
|
* Generates a replacement for the matched text. Token options are:
|
||||||
@ -67,15 +67,15 @@ class Text_Wiki_Rule_italic extends Text_Wiki_Rule {
|
|||||||
* emphasized.
|
* emphasized.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$start = $this->addToken(array('type' => 'start'));
|
$start = $this->addToken(array('type' => 'start'));
|
||||||
$end = $this->addToken(array('type' => 'end'));
|
$end = $this->addToken(array('type' => 'end'));
|
||||||
return $start . $matches[1] . $end;
|
return $start . $matches[1] . $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -88,16 +88,16 @@ class Text_Wiki_Rule_italic extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
if ($options['type'] == 'start') {
|
if ($options['type'] == 'start') {
|
||||||
return '<i>';
|
return '<i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['type'] == 'end') {
|
if ($options['type'] == 'end') {
|
||||||
return '</i>';
|
return '</i>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -253,11 +253,11 @@ class Text_Wiki_Rule_list extends Text_Wiki_Rule {
|
|||||||
// attempt XHTML compliance so that sub-lists are part
|
// attempt XHTML compliance so that sub-lists are part
|
||||||
// of a list item, not between list items
|
// of a list item, not between list items
|
||||||
if ($level > 0) {
|
if ($level > 0) {
|
||||||
$pre = '<li style="list-style: none;">';
|
$pre = '<li style="list-style: none;">';
|
||||||
$post = '</li>';
|
$post = '</li>';
|
||||||
} else {
|
} else {
|
||||||
$pre = '';
|
$pre = '';
|
||||||
$post = '';
|
$post = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_paragraph extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_paragraph extends Text_Wiki_Rule {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The regular expression used to find source text matching this
|
* The regular expression used to find source text matching this
|
||||||
@ -43,10 +43,10 @@ class Text_Wiki_Rule_paragraph extends Text_Wiki_Rule {
|
|||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $regex = "/^.*?\n\n/m";
|
var $regex = "/^.*?\n\n/m";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a token entry for the matched text. Token options are:
|
* Generates a token entry for the matched text. Token options are:
|
||||||
@ -63,55 +63,55 @@ class Text_Wiki_Rule_paragraph extends Text_Wiki_Rule {
|
|||||||
* the source text.
|
* the source text.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$delim = $this->_wiki->delim;
|
$delim = $this->_wiki->delim;
|
||||||
|
|
||||||
// was anything there?
|
// was anything there?
|
||||||
if (trim($matches[0]) == '') {
|
if (trim($matches[0]) == '') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// does the match start with a delimiter?
|
// does the match start with a delimiter?
|
||||||
if (substr($matches[0], 0, 1) != $delim) {
|
if (substr($matches[0], 0, 1) != $delim) {
|
||||||
// no.
|
// no.
|
||||||
$start = $this->addToken(array('type' => 'start'));
|
$start = $this->addToken(array('type' => 'start'));
|
||||||
$end = $this->addToken(array('type' => 'end'));
|
$end = $this->addToken(array('type' => 'end'));
|
||||||
return $start . trim($matches[0]) . $end;
|
return $start . trim($matches[0]) . $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the line starts with a delimiter. read in the delimited
|
// the line starts with a delimiter. read in the delimited
|
||||||
// token number, check the token, and see if we should
|
// token number, check the token, and see if we should
|
||||||
// skip it.
|
// skip it.
|
||||||
|
|
||||||
// loop starting at the second character (we already know
|
// loop starting at the second character (we already know
|
||||||
// the first is a delimiter) until we find another
|
// the first is a delimiter) until we find another
|
||||||
// delimiter; the text between them is a token key number.
|
// delimiter; the text between them is a token key number.
|
||||||
$key = '';
|
$key = '';
|
||||||
$len = strlen($matches[0]);
|
$len = strlen($matches[0]);
|
||||||
for ($i = 1; $i < $len; $i++) {
|
for ($i = 1; $i < $len; $i++) {
|
||||||
$char = $matches[0]{$i};
|
$char = $matches[0]{$i};
|
||||||
if ($char == $delim) {
|
if ($char == $delim) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
$key .= $char;
|
$key .= $char;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// look at the token and see if it's skippable (if we skip,
|
// look at the token and see if it's skippable (if we skip,
|
||||||
// it will not be marked as a paragraph)
|
// it will not be marked as a paragraph)
|
||||||
$token_type = $this->_wiki->_tokens[$key][0];
|
$token_type = $this->_wiki->_tokens[$key][0];
|
||||||
if (in_array($token_type, $this->_conf['skip'])) {
|
if (in_array($token_type, $this->_conf['skip'])) {
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
} else {
|
} else {
|
||||||
$start = $this->addToken(array('type' => 'start'));
|
$start = $this->addToken(array('type' => 'start'));
|
||||||
$end = $this->addToken(array('type' => 'end'));
|
$end = $this->addToken(array('type' => 'end'));
|
||||||
return $start . trim($matches[0]) . $end;
|
return $start . trim($matches[0]) . $end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -124,15 +124,15 @@ class Text_Wiki_Rule_paragraph extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
extract($options); //type
|
extract($options); //type
|
||||||
|
|
||||||
if ($type == 'start') {
|
if ($type == 'start') {
|
||||||
return '<p>';
|
return '<p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'end') {
|
if ($type == 'end') {
|
||||||
return "</p>\n\n";
|
return "</p>\n\n";
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_phpcode extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_phpcode extends Text_Wiki_Rule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* The regular expression used to find source text matching this
|
* The regular expression used to find source text matching this
|
||||||
@ -47,10 +47,10 @@ class Text_Wiki_Rule_phpcode extends Text_Wiki_Rule {
|
|||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $regex = '/^(\<php\>)\n(.+)\n(\<\/php\>)(\s|$)/Umsi';
|
var $regex = '/^(\<php\>)\n(.+)\n(\<\/php\>)(\s|$)/Umsi';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a token entry for the matched text. Token options are:
|
* Generates a token entry for the matched text. Token options are:
|
||||||
@ -65,14 +65,14 @@ class Text_Wiki_Rule_phpcode extends Text_Wiki_Rule {
|
|||||||
* the source text.
|
* the source text.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
$options = array('text' => $matches[2]);
|
$options = array('text' => $matches[2]);
|
||||||
return $this->addToken($options) . $matches[4];
|
return $this->addToken($options) . $matches[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -85,49 +85,49 @@ class Text_Wiki_Rule_phpcode extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
// add the PHP tags
|
// add the PHP tags
|
||||||
$text = "<?php\n" . $options['text'] . "\n?>"; // <?php
|
$text = "<?php\n" . $options['text'] . "\n?>"; // <?php
|
||||||
|
|
||||||
// convert tabs to four spaces
|
// convert tabs to four spaces
|
||||||
$text = str_replace("\t", " ", $text);
|
$text = str_replace("\t", " ", $text);
|
||||||
|
|
||||||
// colorize the code block (also converts HTML entities and adds
|
// colorize the code block (also converts HTML entities and adds
|
||||||
// <code>...</code> tags)
|
// <code>...</code> tags)
|
||||||
ob_start();
|
ob_start();
|
||||||
highlight_string($text);
|
highlight_string($text);
|
||||||
$text = ob_get_contents();
|
$text = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
// replace <br /> tags with simple newlines
|
// replace <br /> tags with simple newlines
|
||||||
//$text = str_replace("<br />", "\n", $text);
|
//$text = str_replace("<br />", "\n", $text);
|
||||||
|
|
||||||
// replace non-breaking space with simple spaces
|
// replace non-breaking space with simple spaces
|
||||||
//$text = str_replace(" ", " ", $text);
|
//$text = str_replace(" ", " ", $text);
|
||||||
|
|
||||||
// replace <br /> tags with simple newlines
|
// replace <br /> tags with simple newlines
|
||||||
// replace non-breaking space with simple spaces
|
// replace non-breaking space with simple spaces
|
||||||
// translate old HTML to new XHTML
|
// translate old HTML to new XHTML
|
||||||
// courtesy of research by A. Kalin :-)
|
// courtesy of research by A. Kalin :-)
|
||||||
$map = array(
|
$map = array(
|
||||||
'<br />' => "\n",
|
'<br />' => "\n",
|
||||||
' ' => ' ',
|
' ' => ' ',
|
||||||
'<font' => '<span',
|
'<font' => '<span',
|
||||||
'</font>' => '</span>',
|
'</font>' => '</span>',
|
||||||
'color="' => 'style="color:'
|
'color="' => 'style="color:'
|
||||||
);
|
);
|
||||||
$text = strtr($text, $map);
|
$text = strtr($text, $map);
|
||||||
|
|
||||||
// get rid of the last newline inside the code block
|
// get rid of the last newline inside the code block
|
||||||
// (becuase higlight_string puts one there)
|
// (becuase higlight_string puts one there)
|
||||||
if (substr($text, -8) == "\n</code>") {
|
if (substr($text, -8) == "\n</code>") {
|
||||||
$text = substr($text, 0, -8) . "</code>";
|
$text = substr($text, 0, -8) . "</code>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return "\n<pre>$text</pre>\n";
|
return "\n<pre>$text</pre>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -86,7 +86,7 @@ class Text_Wiki_Rule_phplookup extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
$text = trim($options['text']);
|
$text = trim($options['text']);
|
||||||
return "<a href=\"http://php.net/$text\">$text</a>";
|
return "<a href=\"http://php.net/$text\">$text</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,10 @@ class Text_Wiki_Rule_prefilter extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
// finally, compress all instances of 3 or more newlines
|
// finally, compress all instances of 3 or more newlines
|
||||||
// down to two newlines.
|
// down to two newlines.
|
||||||
$find = "/\n{3,}/m";
|
$find = "/\n{3,}/m";
|
||||||
$replace = "\n\n";
|
$replace = "\n\n";
|
||||||
$this->_wiki->_source = preg_replace($find, $replace,
|
$this->_wiki->_source = preg_replace($find, $replace,
|
||||||
$this->_wiki->_source);
|
$this->_wiki->_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,68 +74,68 @@ class Text_Wiki_Rule_table extends Text_Wiki_Rule {
|
|||||||
* table elements and cell text.
|
* table elements and cell text.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
// out eventual return value
|
// out eventual return value
|
||||||
$return = '';
|
$return = '';
|
||||||
|
|
||||||
// start a new table
|
// start a new table
|
||||||
$return .= $this->addToken(array('type' => 'table_start'));
|
$return .= $this->addToken(array('type' => 'table_start'));
|
||||||
|
|
||||||
// rows are separated by newlines in the matched text
|
// rows are separated by newlines in the matched text
|
||||||
$rows = explode("\n", $matches[1]);
|
$rows = explode("\n", $matches[1]);
|
||||||
|
|
||||||
// loop through each row
|
// loop through each row
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
// start a new row
|
// start a new row
|
||||||
$return .= $this->addToken(array('type' => 'row_start'));
|
$return .= $this->addToken(array('type' => 'row_start'));
|
||||||
|
|
||||||
// cells are separated by double-pipes
|
// cells are separated by double-pipes
|
||||||
$cell = explode("||", $row);
|
$cell = explode("||", $row);
|
||||||
|
|
||||||
// get the last cell number
|
// get the last cell number
|
||||||
$last = count($cell) - 1;
|
$last = count($cell) - 1;
|
||||||
|
|
||||||
// by default, cells span only one column (their own)
|
// by default, cells span only one column (their own)
|
||||||
$span = 1;
|
$span = 1;
|
||||||
|
|
||||||
// ignore cell zero, and ignore the "last" cell; cell zero
|
// ignore cell zero, and ignore the "last" cell; cell zero
|
||||||
// is before the first double-pipe, and the "last" cell is
|
// is before the first double-pipe, and the "last" cell is
|
||||||
// after the last double-pipe. both are always empty.
|
// after the last double-pipe. both are always empty.
|
||||||
for ($i = 1; $i < $last; $i ++) {
|
for ($i = 1; $i < $last; $i ++) {
|
||||||
|
|
||||||
// if there is no content at all, then it's an instance
|
// if there is no content at all, then it's an instance
|
||||||
// of two sets of || next to each other, indicating a
|
// of two sets of || next to each other, indicating a
|
||||||
// colspan.
|
// colspan.
|
||||||
if ($cell[$i] == '') {
|
if ($cell[$i] == '') {
|
||||||
|
|
||||||
// add to the span and loop to the next cell
|
// add to the span and loop to the next cell
|
||||||
$span += 1;
|
$span += 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// this cell has content.
|
// this cell has content.
|
||||||
|
|
||||||
// find the alignment, if any.
|
// find the alignment, if any.
|
||||||
if (substr($cell[$i], 0, 2) == '> ') {
|
if (substr($cell[$i], 0, 2) == '> ') {
|
||||||
// set to right-align and strip the tag
|
// set to right-align and strip the tag
|
||||||
$align = 'right';
|
$align = 'right';
|
||||||
$cell[$i] = substr($cell[$i], 2);
|
$cell[$i] = substr($cell[$i], 2);
|
||||||
} elseif (substr($cell[$i], 0, 2) == '= ') {
|
} elseif (substr($cell[$i], 0, 2) == '= ') {
|
||||||
// set to center-align and strip the tag
|
// set to center-align and strip the tag
|
||||||
$align = 'center';
|
$align = 'center';
|
||||||
$cell[$i] = substr($cell[$i], 2);
|
$cell[$i] = substr($cell[$i], 2);
|
||||||
} elseif (substr($cell[$i], 0, 2) == '< ') {
|
} elseif (substr($cell[$i], 0, 2) == '< ') {
|
||||||
// set to left-align and strip the tag
|
// set to left-align and strip the tag
|
||||||
$align = 'left';
|
$align = 'left';
|
||||||
$cell[$i] = substr($cell[$i], 2);
|
$cell[$i] = substr($cell[$i], 2);
|
||||||
} else {
|
} else {
|
||||||
$align = null;
|
$align = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start a new cell...
|
// start a new cell...
|
||||||
$return .= $this->addToken(
|
$return .= $this->addToken(
|
||||||
array (
|
array (
|
||||||
@ -144,10 +144,10 @@ class Text_Wiki_Rule_table extends Text_Wiki_Rule {
|
|||||||
'colspan' => $span
|
'colspan' => $span
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// ...add the content...
|
// ...add the content...
|
||||||
$return .= trim($cell[$i]);
|
$return .= trim($cell[$i]);
|
||||||
|
|
||||||
// ...and end the cell.
|
// ...and end the cell.
|
||||||
$return .= $this->addToken(
|
$return .= $this->addToken(
|
||||||
array (
|
array (
|
||||||
@ -156,26 +156,26 @@ class Text_Wiki_Rule_table extends Text_Wiki_Rule {
|
|||||||
'colspan' => $span
|
'colspan' => $span
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// reset the colspan.
|
// reset the colspan.
|
||||||
$span = 1;
|
$span = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// end the row
|
// end the row
|
||||||
$return .= $this->addToken(array('type' => 'row_end'));
|
$return .= $this->addToken(array('type' => 'row_end'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// end the table
|
// end the table
|
||||||
$return .= $this->addToken(array('type' => 'table_end'));
|
$return .= $this->addToken(array('type' => 'table_end'));
|
||||||
|
|
||||||
// we're done!
|
// we're done!
|
||||||
return "\n$return\n";
|
return "\n$return\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -193,56 +193,56 @@ class Text_Wiki_Rule_table extends Text_Wiki_Rule {
|
|||||||
{
|
{
|
||||||
// make nice variable names (type, align, colspan)
|
// make nice variable names (type, align, colspan)
|
||||||
extract($options);
|
extract($options);
|
||||||
|
|
||||||
$pad = ' ';
|
$pad = ' ';
|
||||||
|
|
||||||
$border = (isset($this->_conf['border']))
|
$border = (isset($this->_conf['border']))
|
||||||
? $this->_conf['border'] : '1';
|
? $this->_conf['border'] : '1';
|
||||||
|
|
||||||
$spacing = (isset($this->_conf['spacing']))
|
$spacing = (isset($this->_conf['spacing']))
|
||||||
? $this->_conf['spacing'] : '0';
|
? $this->_conf['spacing'] : '0';
|
||||||
|
|
||||||
$padding = (isset($this->_conf['padding']))
|
$padding = (isset($this->_conf['padding']))
|
||||||
? $this->_conf['padding'] : '4';
|
? $this->_conf['padding'] : '4';
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|
||||||
case 'table_start':
|
case 'table_start':
|
||||||
return "<table border=\"$border\" " .
|
return "<table border=\"$border\" " .
|
||||||
"cellspacing=\"$spacing\" " .
|
"cellspacing=\"$spacing\" " .
|
||||||
"cellpadding=\"$padding\">\n";
|
"cellpadding=\"$padding\">\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'table_end':
|
case 'table_end':
|
||||||
return "</table>\n";
|
return "</table>\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'row_start':
|
case 'row_start':
|
||||||
return "$pad<tr>\n";
|
return "$pad<tr>\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'row_end':
|
case 'row_end':
|
||||||
return "$pad</tr>\n";
|
return "$pad</tr>\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'cell_start':
|
case 'cell_start':
|
||||||
$tmp = $pad . $pad . '<td';
|
$tmp = $pad . $pad . '<td';
|
||||||
if ($colspan > 1) {
|
if ($colspan > 1) {
|
||||||
$tmp .= " colspan=\"$colspan\"";
|
$tmp .= " colspan=\"$colspan\"";
|
||||||
}
|
}
|
||||||
if ($align) {
|
if ($align) {
|
||||||
$tmp .= " align=\"$align\"";
|
$tmp .= " align=\"$align\"";
|
||||||
}
|
}
|
||||||
return $tmp . '>';
|
return $tmp . '>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'cell_end':
|
case 'cell_end':
|
||||||
return "</td>\n";
|
return "</td>\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ class Text_Wiki_Rule_tighten extends Text_Wiki_Rule {
|
|||||||
|
|
||||||
function parse()
|
function parse()
|
||||||
{
|
{
|
||||||
$this->_wiki->_source = str_replace("\n", '',
|
$this->_wiki->_source = str_replace("\n", '',
|
||||||
$this->_wiki->_source);
|
$this->_wiki->_source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* When doing numbered references (footnote-style references), we
|
* When doing numbered references (footnote-style references), we
|
||||||
@ -53,10 +53,10 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @var int
|
* @var int
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $footnoteCount = 0;
|
var $footnoteCount = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* An array of filename extensions that indicate a file is an image.
|
* An array of filename extensions that indicate a file is an image.
|
||||||
@ -66,25 +66,25 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @var array
|
* @var array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $img_ext = array('.jpg', '.png', '.gif');
|
var $img_ext = array('.jpg', '.png', '.gif');
|
||||||
|
|
||||||
|
|
||||||
function Text_Wiki_Rule_url(&$obj, $name)
|
function Text_Wiki_Rule_url(&$obj, $name)
|
||||||
{
|
{
|
||||||
parent::Text_Wiki_Rule($obj, $name);
|
parent::Text_Wiki_Rule($obj, $name);
|
||||||
|
|
||||||
$this->regex =
|
$this->regex =
|
||||||
"(http:\/\/|https:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|mailto:)" . // protocols
|
"(http:\/\/|https:\/\/|ftp:\/\/|gopher:\/\/|news:\/\/|mailto:)" . // protocols
|
||||||
"(" .
|
"(" .
|
||||||
"[^ \\/\"\'{$this->_wiki->delim}]*\\/" . // no spaces, \, /, ", or single quotes;
|
"[^ \\/\"\'{$this->_wiki->delim}]*\\/" . // no spaces, \, /, ", or single quotes;
|
||||||
")*" .
|
")*" .
|
||||||
"[^ \\t\\n\\/\"\'{$this->_wiki->delim}]*" .
|
"[^ \\t\\n\\/\"\'{$this->_wiki->delim}]*" .
|
||||||
"[A-Za-z0-9\\/?=&~_]";
|
"[A-Za-z0-9\\/?=&~_]";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* A somewhat complex parsing method to find three different kinds
|
* A somewhat complex parsing method to find three different kinds
|
||||||
@ -93,17 +93,17 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @access public
|
* @access public
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function parse()
|
function parse()
|
||||||
{
|
{
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Described-reference (named) URLs.
|
// Described-reference (named) URLs.
|
||||||
//
|
//
|
||||||
|
|
||||||
// the regular expression for this kind of URL
|
// the regular expression for this kind of URL
|
||||||
$tmp_regex = '/\[(' . $this->regex . ') ([^\]]+)\]/';
|
$tmp_regex = '/\[(' . $this->regex . ') ([^\]]+)\]/';
|
||||||
|
|
||||||
// use a custom callback processing method to generate
|
// use a custom callback processing method to generate
|
||||||
// the replacement text for matches.
|
// the replacement text for matches.
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
@ -111,16 +111,16 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
array(&$this, 'processDescr'),
|
array(&$this, 'processDescr'),
|
||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Numbered-reference (footnote-style) URLs.
|
// Numbered-reference (footnote-style) URLs.
|
||||||
//
|
//
|
||||||
|
|
||||||
// the regular expression for this kind of URL
|
// the regular expression for this kind of URL
|
||||||
$tmp_regex = '/\[(' . $this->regex . ')\]/U';
|
$tmp_regex = '/\[(' . $this->regex . ')\]/U';
|
||||||
|
|
||||||
// use a custom callback processing method to generate
|
// use a custom callback processing method to generate
|
||||||
// the replacement text for matches.
|
// the replacement text for matches.
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
@ -128,17 +128,17 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
array(&$this, 'processFootnote'),
|
array(&$this, 'processFootnote'),
|
||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Normal inline URLs.
|
// Normal inline URLs.
|
||||||
//
|
//
|
||||||
|
|
||||||
// the regular expression for this kind of URL
|
// 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
|
// use the standard callback for inline URLs
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
$tmp_regex,
|
$tmp_regex,
|
||||||
@ -146,8 +146,8 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Process inline URLs and return replacement text with a delimited
|
* Process inline URLs and return replacement text with a delimited
|
||||||
@ -168,7 +168,7 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @return string The processed text replacement.
|
* @return string The processed text replacement.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
// set options
|
// set options
|
||||||
@ -177,12 +177,12 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
'href' => $matches[2],
|
'href' => $matches[2],
|
||||||
'text' => $matches[2]
|
'text' => $matches[2]
|
||||||
);
|
);
|
||||||
|
|
||||||
// tokenize
|
// tokenize
|
||||||
return $matches[1] . $this->addToken($options) . $matches[5];
|
return $matches[1] . $this->addToken($options) . $matches[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Process numbered (footnote) URLs and return replacement text with
|
* Process numbered (footnote) URLs and return replacement text with
|
||||||
@ -203,24 +203,24 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @return string The processed text replacement.
|
* @return string The processed text replacement.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function processFootnote(&$matches)
|
function processFootnote(&$matches)
|
||||||
{
|
{
|
||||||
// keep a running count for footnotes
|
// keep a running count for footnotes
|
||||||
$this->footnoteCount++;
|
$this->footnoteCount++;
|
||||||
|
|
||||||
// set options
|
// set options
|
||||||
$options = array(
|
$options = array(
|
||||||
'type' => 'footnote',
|
'type' => 'footnote',
|
||||||
'href' => $matches[1],
|
'href' => $matches[1],
|
||||||
'text' => $this->footnoteCount
|
'text' => $this->footnoteCount
|
||||||
);
|
);
|
||||||
|
|
||||||
// tokenize
|
// tokenize
|
||||||
return $this->addToken($options);
|
return $this->addToken($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Process described-reference (named-reference) URLs and return
|
* Process described-reference (named-reference) URLs and return
|
||||||
@ -241,7 +241,7 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @return string The processed text replacement.
|
* @return string The processed text replacement.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function processDescr(&$matches)
|
function processDescr(&$matches)
|
||||||
{
|
{
|
||||||
// set options
|
// set options
|
||||||
@ -250,12 +250,12 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
'href' => $matches[1],
|
'href' => $matches[1],
|
||||||
'text' => $matches[4]
|
'text' => $matches[4]
|
||||||
);
|
);
|
||||||
|
|
||||||
// tokenize
|
// tokenize
|
||||||
return $this->addToken($options);
|
return $this->addToken($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -268,48 +268,48 @@ class Text_Wiki_Rule_url extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
// create local variables from the options array (text,
|
// create local variables from the options array (text,
|
||||||
// href, type)
|
// href, type)
|
||||||
extract($options);
|
extract($options);
|
||||||
|
|
||||||
// find the rightmost dot and determine the filename
|
// find the rightmost dot and determine the filename
|
||||||
// extension.
|
// extension.
|
||||||
$pos = strrpos($href, '.');
|
$pos = strrpos($href, '.');
|
||||||
$ext = strtolower(substr($href, $pos));
|
$ext = strtolower(substr($href, $pos));
|
||||||
|
|
||||||
// does the filename extension indicate an image file?
|
// does the filename extension indicate an image file?
|
||||||
if (in_array($ext, $this->img_ext)) {
|
if (in_array($ext, $this->img_ext)) {
|
||||||
|
|
||||||
// create alt text for the image
|
// create alt text for the image
|
||||||
if (! isset($text) || $text == '') {
|
if (! isset($text) || $text == '') {
|
||||||
$text = basename($href);
|
$text = basename($href);
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate an image tag
|
// generate an image tag
|
||||||
$output = "<img src=\"$href\" alt=\"$text\" />";
|
$output = "<img src=\"$href\" alt=\"$text\" />";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// allow for alternative targets
|
// allow for alternative targets
|
||||||
if (isset($this->_conf['target']) &&
|
if (isset($this->_conf['target']) &&
|
||||||
trim($this->_conf['target']) != '') {
|
trim($this->_conf['target']) != '') {
|
||||||
$target = 'target="' . $this->_conf['target'] . '"';
|
$target = 'target="' . $this->_conf['target'] . '"';
|
||||||
} else {
|
} else {
|
||||||
$target = '';
|
$target = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a regular link (not an image)
|
// generate a regular link (not an image)
|
||||||
$output = "<a $target href=\"$href\">$text</a>";
|
$output = "<a $target href=\"$href\">$text</a>";
|
||||||
|
|
||||||
// make numbered references look like footnotes
|
// make numbered references look like footnotes
|
||||||
if ($type == 'footnote') {
|
if ($type == 'footnote') {
|
||||||
$output = '<sup>' . $output . '</sup>';
|
$output = '<sup>' . $output . '</sup>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Constructor. We override the Text_Wiki_Rule constructor so we can
|
* Constructor. We override the Text_Wiki_Rule constructor so we can
|
||||||
@ -51,11 +51,11 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
* @param string $name The token name to use for this rule.
|
* @param string $name The token name to use for this rule.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Text_Wiki_Rule_wikilink(&$obj, $name)
|
function Text_Wiki_Rule_wikilink(&$obj, $name)
|
||||||
{
|
{
|
||||||
parent::Text_Wiki_Rule($obj, $name);
|
parent::Text_Wiki_Rule($obj, $name);
|
||||||
|
|
||||||
$this->regex =
|
$this->regex =
|
||||||
"(!?" . // START WikiPage pattern (1)
|
"(!?" . // START WikiPage pattern (1)
|
||||||
"[A-Z]" . // 1 upper
|
"[A-Z]" . // 1 upper
|
||||||
@ -71,8 +71,8 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
"[-A-Za-z0-9_]" . // 1 dash, alpha, digit, or underscore
|
"[-A-Za-z0-9_]" . // 1 dash, alpha, digit, or underscore
|
||||||
")?)?)"; // end subpatterns (/4)(/3)(/2)
|
")?)?)"; // end subpatterns (/4)(/3)(/2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* First parses for described links, then for standalone links.
|
* First parses for described links, then for standalone links.
|
||||||
@ -82,17 +82,17 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function parse()
|
function parse()
|
||||||
{
|
{
|
||||||
// described wiki links
|
// described wiki links
|
||||||
$tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
|
$tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
$tmp_regex,
|
$tmp_regex,
|
||||||
array(&$this, 'processDescr'),
|
array(&$this, 'processDescr'),
|
||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
|
|
||||||
// standalone wiki links
|
// standalone wiki links
|
||||||
$tmp_regex = '/(^|[^A-Za-z0-9\-_])' . $this->regex . '/';
|
$tmp_regex = '/(^|[^A-Za-z0-9\-_])' . $this->regex . '/';
|
||||||
$this->_wiki->_source = preg_replace_callback(
|
$this->_wiki->_source = preg_replace_callback(
|
||||||
@ -101,8 +101,8 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
$this->_wiki->_source
|
$this->_wiki->_source
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a replacement for described links. Token options are:
|
* Generates a replacement for described links. Token options are:
|
||||||
@ -121,7 +121,7 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
* the source text, plus any text priot to the match.
|
* the source text, plus any text priot to the match.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function processDescr(&$matches)
|
function processDescr(&$matches)
|
||||||
{
|
{
|
||||||
// set the options
|
// set the options
|
||||||
@ -130,12 +130,12 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
'text' => $matches[5],
|
'text' => $matches[5],
|
||||||
'anchor' => $matches[3]
|
'anchor' => $matches[3]
|
||||||
);
|
);
|
||||||
|
|
||||||
// create and return the replacement token and preceding text
|
// create and return the replacement token and preceding text
|
||||||
return $this->addToken($options); // . $matches[7];
|
return $this->addToken($options); // . $matches[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Generates a replacement for standalone links. Token options are:
|
* Generates a replacement for standalone links. Token options are:
|
||||||
@ -154,7 +154,7 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
* the source text, plus any text prior to the match.
|
* the source text, plus any text prior to the match.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function process(&$matches)
|
function process(&$matches)
|
||||||
{
|
{
|
||||||
// when prefixed with !, it's explicitly not a wiki link.
|
// when prefixed with !, it's explicitly not a wiki link.
|
||||||
@ -162,19 +162,19 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
if ($matches[2][0] == '!') {
|
if ($matches[2][0] == '!') {
|
||||||
return $matches[1] . substr($matches[2], 1) . $matches[3];
|
return $matches[1] . substr($matches[2], 1) . $matches[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the options
|
// set the options
|
||||||
$options = array(
|
$options = array(
|
||||||
'page' => $matches[2],
|
'page' => $matches[2],
|
||||||
'text' => $matches[2] . $matches[3],
|
'text' => $matches[2] . $matches[3],
|
||||||
'anchor' => $matches[3]
|
'anchor' => $matches[3]
|
||||||
);
|
);
|
||||||
|
|
||||||
// create and return the replacement token and preceding text
|
// create and return the replacement token and preceding text
|
||||||
return $matches[1] . $this->addToken($options);
|
return $matches[1] . $this->addToken($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Renders a token into text matching the requested format.
|
* Renders a token into text matching the requested format.
|
||||||
@ -187,55 +187,55 @@ class Text_Wiki_Rule_wikilink extends Text_Wiki_Rule {
|
|||||||
* @return string The text rendered from the token options.
|
* @return string The text rendered from the token options.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function renderXhtml($options)
|
function renderXhtml($options)
|
||||||
{
|
{
|
||||||
// make nice variable names (page, anchor, text)
|
// make nice variable names (page, anchor, text)
|
||||||
extract($options);
|
extract($options);
|
||||||
|
|
||||||
// does the page exist?
|
// does the page exist?
|
||||||
if (in_array($page, $this->_conf['pages'])) {
|
if (in_array($page, $this->_conf['pages'])) {
|
||||||
|
|
||||||
// yes, link to the page view, but we have to build
|
// yes, link to the page view, but we have to build
|
||||||
// the HREF. we support both the old form where
|
// the HREF. we support both the old form where
|
||||||
// the page always comes at the end, and the new
|
// the page always comes at the end, and the new
|
||||||
// form that uses %s for sprintf()
|
// form that uses %s for sprintf()
|
||||||
$href = $this->_conf['view_url'];
|
$href = $this->_conf['view_url'];
|
||||||
|
|
||||||
if (strpos($href, '%s') === false) {
|
if (strpos($href, '%s') === false) {
|
||||||
// use the old form
|
// use the old form
|
||||||
$href = $href . $page . $anchor;
|
$href = $href . $page . $anchor;
|
||||||
} else {
|
} else {
|
||||||
// use the new form
|
// use the new form
|
||||||
$href = sprintf($href, $page . $anchor);
|
$href = sprintf($href, $page . $anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<a href=\"$href\">$text</a>";
|
return "<a href=\"$href\">$text</a>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no, link to a create-page url, but only if new_url is set
|
// no, link to a create-page url, but only if new_url is set
|
||||||
if (! isset($this->_conf['new_url']) ||
|
if (! isset($this->_conf['new_url']) ||
|
||||||
trim($this->_conf['new_url']) == '') {
|
trim($this->_conf['new_url']) == '') {
|
||||||
return $text;
|
return $text;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// yes, link to the page view, but we have to build
|
// yes, link to the page view, but we have to build
|
||||||
// the HREF. we support both the old form where
|
// the HREF. we support both the old form where
|
||||||
// the page always comes at the end, and the new
|
// the page always comes at the end, and the new
|
||||||
// form that uses sprintf()
|
// form that uses sprintf()
|
||||||
$href = $this->_conf['new_url'];
|
$href = $this->_conf['new_url'];
|
||||||
|
|
||||||
if (strpos($href, '%s') === false) {
|
if (strpos($href, '%s') === false) {
|
||||||
// use the old form
|
// use the old form
|
||||||
$href = $href . $page;
|
$href = $href . $page;
|
||||||
} else {
|
} else {
|
||||||
// use the new form
|
// use the new form
|
||||||
$href = sprintf($href, $page);
|
$href = sprintf($href, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text . "<a href=\"$href\">{$this->_conf['new_text']}</a>";
|
return $text . "<a href=\"$href\">{$this->_conf['new_text']}</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -245,7 +245,7 @@ function XML_RPC_Server_debugmsg($m)
|
|||||||
* ),
|
* ),
|
||||||
* 1,
|
* 1,
|
||||||
* 0
|
* 0
|
||||||
* );
|
* );
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @category Web Services
|
* @category Web Services
|
||||||
@ -553,8 +553,8 @@ class XML_RPC_Server
|
|||||||
$XML_RPC_xh[$parser]['isf'] = 0;
|
$XML_RPC_xh[$parser]['isf'] = 0;
|
||||||
$XML_RPC_xh[$parser]['params'] = array();
|
$XML_RPC_xh[$parser]['params'] = array();
|
||||||
$XML_RPC_xh[$parser]['method'] = '';
|
$XML_RPC_xh[$parser]['method'] = '';
|
||||||
$XML_RPC_xh[$parser]['stack'] = array();
|
$XML_RPC_xh[$parser]['stack'] = array();
|
||||||
$XML_RPC_xh[$parser]['valuestack'] = array();
|
$XML_RPC_xh[$parser]['valuestack'] = array();
|
||||||
|
|
||||||
$plist = '';
|
$plist = '';
|
||||||
|
|
||||||
|
@ -132,4 +132,4 @@ else
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "REMEMBER TO UPDATE docs/RELEASE and commit SVN branch"
|
echo "REMEMBER TO UPDATE docs/RELEASE and commit github branch: git tag -a X.Y ; git push --tags"
|
||||||
|
@ -32,10 +32,10 @@ will be printed.)
|
|||||||
|| {{```''italic text''```}} || ''italic text'' ||
|
|| {{```''italic text''```}} || ''italic text'' ||
|
||||||
|| {{```'''bold text'''```}} || '''bold text''' ||
|
|| {{```'''bold text'''```}} || '''bold text''' ||
|
||||||
|| {{```'''''italic and bold'''''```}} || '''''italic and bold''''' ||
|
|| {{```'''''italic and bold'''''```}} || '''''italic and bold''''' ||
|
||||||
|| {{```//emphasis//```}} || //emphasis// ||
|
|| {{```//emphasis//```}} || //emphasis// ||
|
||||||
|| {{```**strong**```}} || **strong** ||
|
|| {{```**strong**```}} || **strong** ||
|
||||||
|| {{```//**emphasis and strong**//```}} || //**emphasis and strong**// ||
|
|| {{```//**emphasis and strong**//```}} || //**emphasis and strong**// ||
|
||||||
|| {{```**//strong and emphasis//**```}} || **//strong and emphasis//** ||
|
|| {{```**//strong and emphasis//**```}} || **//strong and emphasis//** ||
|
||||||
|| {{```{{teletype text}}```}} || {{teletype text}} ||
|
|| {{```{{teletype text}}```}} || {{teletype text}} ||
|
||||||
|| {{<```php:function()```>}} || <php:function()> ||
|
|| {{<```php:function()```>}} || <php:function()> ||
|
||||||
|| {{```@@--- delete text +++ insert text @@```}} || @@--- delete text +++ insert text @@ ||
|
|| {{```@@--- delete text +++ insert text @@```}} || @@--- delete text +++ insert text @@ ||
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|| {{strong}} || Strong (usually bold) text. || {{type:[start|end]}} ||
|
|| {{strong}} || Strong (usually bold) text. || {{type:[start|end]}} ||
|
||||||
|| {{superscript}} || Superscript text. || {{type:[start|end]}} ||
|
|| {{superscript}} || Superscript text. || {{type:[start|end]}} ||
|
||||||
|| {{table}} || Table elements. || {{type:[table|row|cell]_[start|end], colspan}} ||
|
|| {{table}} || Table elements. || {{type:[table|row|cell]_[start|end], colspan}} ||
|
||||||
|| {{tt}} || Teletype (monospaced) text. || {{type:[start|end]}} ||
|
|| {{tt}} || Teletype (monospaced) text. || {{type:[start|end]}} ||
|
||||||
|| {{url}} || A page URL. || {{type:[inline|footnote|descr]}}, {{href}}, {{text}} ||
|
|| {{url}} || A page URL. || {{type:[inline|footnote|descr]}}, {{href}}, {{text}} ||
|
||||||
|| {{wikilink}} || A local !WikiPage reference. || {{page}}, {{anchor}} ||
|
|| {{wikilink}} || A local !WikiPage reference. || {{page}}, {{anchor}} ||
|
||||||
|| {{toc}} || Table of contents. || {{type:[list_start|list_end|item_start|item_end|target], level, count}} ||
|
|| {{toc}} || Table of contents. || {{type:[list_start|list_end|item_start|item_end|target], level, count}} ||
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user