From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- plugins/dokuwiki/inc/HTTPClient.php | 436 ++ plugins/dokuwiki/inc/JpegMeta.php | 2982 ++++++++++++ plugins/dokuwiki/inc/cache.php | 291 ++ plugins/dokuwiki/inc/common.php | 1009 +++++ plugins/dokuwiki/inc/confutils.php | 189 + plugins/dokuwiki/inc/events.php | 202 + plugins/dokuwiki/inc/geshi.php | 4775 ++++++++++++++++++++ plugins/dokuwiki/inc/geshi/actionscript-french.php | 957 ++++ plugins/dokuwiki/inc/geshi/actionscript.php | 199 + plugins/dokuwiki/inc/geshi/ada.php | 135 + plugins/dokuwiki/inc/geshi/apache.php | 173 + plugins/dokuwiki/inc/geshi/applescript.php | 136 + plugins/dokuwiki/inc/geshi/asm.php | 200 + plugins/dokuwiki/inc/geshi/asp.php | 155 + plugins/dokuwiki/inc/geshi/autoit.php | 196 + plugins/dokuwiki/inc/geshi/bash.php | 137 + plugins/dokuwiki/inc/geshi/c.php | 144 + plugins/dokuwiki/inc/geshi/c_mac.php | 176 + plugins/dokuwiki/inc/geshi/caddcl.php | 127 + plugins/dokuwiki/inc/geshi/cadlisp.php | 187 + plugins/dokuwiki/inc/geshi/cpp.php | 172 + plugins/dokuwiki/inc/geshi/csharp.php | 233 + plugins/dokuwiki/inc/geshi/css.php | 178 + plugins/dokuwiki/inc/geshi/d.php | 287 ++ plugins/dokuwiki/inc/geshi/delphi.php | 272 ++ plugins/dokuwiki/inc/geshi/diff.php | 186 + plugins/dokuwiki/inc/geshi/div.php | 128 + plugins/dokuwiki/inc/geshi/dos.php | 185 + plugins/dokuwiki/inc/geshi/eiffel.php | 397 ++ plugins/dokuwiki/inc/geshi/freebasic.php | 137 + plugins/dokuwiki/inc/geshi/gml.php | 504 +++ plugins/dokuwiki/inc/geshi/html4strict.php | 256 ++ plugins/dokuwiki/inc/geshi/html5.php | 210 + plugins/dokuwiki/inc/geshi/ini.php | 125 + plugins/dokuwiki/inc/geshi/inno.php | 215 + plugins/dokuwiki/inc/geshi/java.php | 1390 ++++++ plugins/dokuwiki/inc/geshi/javascript.php | 146 + plugins/dokuwiki/inc/geshi/lisp.php | 135 + plugins/dokuwiki/inc/geshi/lua.php | 137 + plugins/dokuwiki/inc/geshi/matlab.php | 869 ++++ plugins/dokuwiki/inc/geshi/mpasm.php | 160 + plugins/dokuwiki/inc/geshi/nsis.php | 354 ++ plugins/dokuwiki/inc/geshi/objc.php | 241 + plugins/dokuwiki/inc/geshi/ocaml-brief.php | 114 + plugins/dokuwiki/inc/geshi/ocaml.php | 163 + plugins/dokuwiki/inc/geshi/oobas.php | 132 + plugins/dokuwiki/inc/geshi/oracle8.php | 489 ++ plugins/dokuwiki/inc/geshi/pascal.php | 145 + plugins/dokuwiki/inc/geshi/perl.php | 169 + plugins/dokuwiki/inc/geshi/php-brief.php | 162 + plugins/dokuwiki/inc/geshi/php.php | 356 ++ plugins/dokuwiki/inc/geshi/python.php | 229 + plugins/dokuwiki/inc/geshi/qbasic.php | 147 + plugins/dokuwiki/inc/geshi/ruby.php | 149 + plugins/dokuwiki/inc/geshi/scheme.php | 172 + plugins/dokuwiki/inc/geshi/sdlbasic.php | 163 + plugins/dokuwiki/inc/geshi/smarty.php | 168 + plugins/dokuwiki/inc/geshi/sql.php | 137 + plugins/dokuwiki/inc/geshi/vb.php | 150 + plugins/dokuwiki/inc/geshi/vbnet.php | 199 + plugins/dokuwiki/inc/geshi/vhdl.php | 140 + plugins/dokuwiki/inc/geshi/visualfoxpro.php | 444 ++ plugins/dokuwiki/inc/geshi/xml.php | 147 + plugins/dokuwiki/inc/html.php | 1290 ++++++ plugins/dokuwiki/inc/infoutils.php | 249 + plugins/dokuwiki/inc/init.php | 367 ++ plugins/dokuwiki/inc/io.php | 567 +++ plugins/dokuwiki/inc/pageutils.php | 478 ++ plugins/dokuwiki/inc/parser/handler.php | 1653 +++++++ plugins/dokuwiki/inc/parser/lexer.php | 607 +++ plugins/dokuwiki/inc/parser/parser.php | 932 ++++ plugins/dokuwiki/inc/parser/renderer.php | 212 + plugins/dokuwiki/inc/parser/xhtml.php | 1097 +++++ plugins/dokuwiki/inc/parserutils.php | 524 +++ plugins/dokuwiki/inc/pluginutils.php | 95 + plugins/dokuwiki/inc/utf8.php | 1276 ++++++ 76 files changed, 33045 insertions(+) create mode 100644 plugins/dokuwiki/inc/HTTPClient.php create mode 100644 plugins/dokuwiki/inc/JpegMeta.php create mode 100644 plugins/dokuwiki/inc/cache.php create mode 100644 plugins/dokuwiki/inc/common.php create mode 100644 plugins/dokuwiki/inc/confutils.php create mode 100644 plugins/dokuwiki/inc/events.php create mode 100644 plugins/dokuwiki/inc/geshi.php create mode 100644 plugins/dokuwiki/inc/geshi/actionscript-french.php create mode 100644 plugins/dokuwiki/inc/geshi/actionscript.php create mode 100644 plugins/dokuwiki/inc/geshi/ada.php create mode 100644 plugins/dokuwiki/inc/geshi/apache.php create mode 100644 plugins/dokuwiki/inc/geshi/applescript.php create mode 100644 plugins/dokuwiki/inc/geshi/asm.php create mode 100644 plugins/dokuwiki/inc/geshi/asp.php create mode 100644 plugins/dokuwiki/inc/geshi/autoit.php create mode 100644 plugins/dokuwiki/inc/geshi/bash.php create mode 100644 plugins/dokuwiki/inc/geshi/c.php create mode 100644 plugins/dokuwiki/inc/geshi/c_mac.php create mode 100644 plugins/dokuwiki/inc/geshi/caddcl.php create mode 100644 plugins/dokuwiki/inc/geshi/cadlisp.php create mode 100644 plugins/dokuwiki/inc/geshi/cpp.php create mode 100644 plugins/dokuwiki/inc/geshi/csharp.php create mode 100644 plugins/dokuwiki/inc/geshi/css.php create mode 100644 plugins/dokuwiki/inc/geshi/d.php create mode 100644 plugins/dokuwiki/inc/geshi/delphi.php create mode 100644 plugins/dokuwiki/inc/geshi/diff.php create mode 100644 plugins/dokuwiki/inc/geshi/div.php create mode 100644 plugins/dokuwiki/inc/geshi/dos.php create mode 100644 plugins/dokuwiki/inc/geshi/eiffel.php create mode 100644 plugins/dokuwiki/inc/geshi/freebasic.php create mode 100644 plugins/dokuwiki/inc/geshi/gml.php create mode 100644 plugins/dokuwiki/inc/geshi/html4strict.php create mode 100644 plugins/dokuwiki/inc/geshi/html5.php create mode 100644 plugins/dokuwiki/inc/geshi/ini.php create mode 100644 plugins/dokuwiki/inc/geshi/inno.php create mode 100644 plugins/dokuwiki/inc/geshi/java.php create mode 100644 plugins/dokuwiki/inc/geshi/javascript.php create mode 100644 plugins/dokuwiki/inc/geshi/lisp.php create mode 100644 plugins/dokuwiki/inc/geshi/lua.php create mode 100644 plugins/dokuwiki/inc/geshi/matlab.php create mode 100644 plugins/dokuwiki/inc/geshi/mpasm.php create mode 100644 plugins/dokuwiki/inc/geshi/nsis.php create mode 100644 plugins/dokuwiki/inc/geshi/objc.php create mode 100644 plugins/dokuwiki/inc/geshi/ocaml-brief.php create mode 100644 plugins/dokuwiki/inc/geshi/ocaml.php create mode 100644 plugins/dokuwiki/inc/geshi/oobas.php create mode 100644 plugins/dokuwiki/inc/geshi/oracle8.php create mode 100644 plugins/dokuwiki/inc/geshi/pascal.php create mode 100644 plugins/dokuwiki/inc/geshi/perl.php create mode 100644 plugins/dokuwiki/inc/geshi/php-brief.php create mode 100644 plugins/dokuwiki/inc/geshi/php.php create mode 100644 plugins/dokuwiki/inc/geshi/python.php create mode 100644 plugins/dokuwiki/inc/geshi/qbasic.php create mode 100644 plugins/dokuwiki/inc/geshi/ruby.php create mode 100644 plugins/dokuwiki/inc/geshi/scheme.php create mode 100644 plugins/dokuwiki/inc/geshi/sdlbasic.php create mode 100644 plugins/dokuwiki/inc/geshi/smarty.php create mode 100644 plugins/dokuwiki/inc/geshi/sql.php create mode 100644 plugins/dokuwiki/inc/geshi/vb.php create mode 100644 plugins/dokuwiki/inc/geshi/vbnet.php create mode 100644 plugins/dokuwiki/inc/geshi/vhdl.php create mode 100644 plugins/dokuwiki/inc/geshi/visualfoxpro.php create mode 100644 plugins/dokuwiki/inc/geshi/xml.php create mode 100644 plugins/dokuwiki/inc/html.php create mode 100644 plugins/dokuwiki/inc/infoutils.php create mode 100644 plugins/dokuwiki/inc/init.php create mode 100644 plugins/dokuwiki/inc/io.php create mode 100644 plugins/dokuwiki/inc/pageutils.php create mode 100644 plugins/dokuwiki/inc/parser/handler.php create mode 100644 plugins/dokuwiki/inc/parser/lexer.php create mode 100644 plugins/dokuwiki/inc/parser/parser.php create mode 100644 plugins/dokuwiki/inc/parser/renderer.php create mode 100644 plugins/dokuwiki/inc/parser/xhtml.php create mode 100644 plugins/dokuwiki/inc/parserutils.php create mode 100644 plugins/dokuwiki/inc/pluginutils.php create mode 100644 plugins/dokuwiki/inc/utf8.php (limited to 'plugins/dokuwiki/inc') diff --git a/plugins/dokuwiki/inc/HTTPClient.php b/plugins/dokuwiki/inc/HTTPClient.php new file mode 100644 index 0000000..7a4d1e6 --- /dev/null +++ b/plugins/dokuwiki/inc/HTTPClient.php @@ -0,0 +1,436 @@ + + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +require_once(DOKU_CONF.'dokuwiki.php'); + +define('HTTP_NL',"\r\n"); + + +/** + * This class implements a basic HTTP client + * + * It supports POST and GET, Proxy usage, basic authentication, + * handles cookies and referers. It is based upon the httpclient + * function from the VideoDB project. + * + * @link http://www.splitbrain.org/go/videodb + * @author Andreas Goetz + * @author Andreas Gohr + */ +class HTTPClient { + //set these if you like + var $agent; // User agent + var $http; // HTTP version defaults to 1.0 + var $timeout; // read timeout (seconds) + var $cookies; + var $referer; + var $max_redirect; + var $max_bodysize; // abort if the response body is bigger than this + var $header_regexp; // if set this RE must match against the headers, else abort + var $headers; + var $debug; + + // don't set these, read on error + var $error; + var $redirect_count; + + // read these after a successful request + var $resp_status; + var $resp_body; + var $resp_headers; + + // set these to do basic authentication + var $user; + var $pass; + + // set these if you need to use a proxy + var $proxy_host; + var $proxy_port; + var $proxy_user; + var $proxy_pass; + var $proxy_ssl; //boolean set to true if your proxy needs SSL + + /** + * Constructor. + * + * @author Andreas Gohr + */ + function __construct(){ + $this->agent = 'Mozilla/4.0 (compatible; DokuWiki HTTP Client; '.PHP_OS.')'; + $this->timeout = 15; + $this->cookies = array(); + $this->referer = ''; + $this->max_redirect = 3; + $this->redirect_count = 0; + $this->status = 0; + $this->headers = array(); + $this->http = '1.0'; + $this->debug = false; + $this->max_bodysize = 0; + $this->header_regexp= ''; + if(extension_loaded('zlib')) $this->headers['Accept-encoding'] = 'gzip'; + $this->headers['Accept'] = 'text/xml,application/xml,application/xhtml+xml,'. + 'text/html,text/plain,image/png,image/jpeg,image/gif,*/*'; + $this->headers['Accept-Language'] = 'en-us'; + } + + + /** + * Simple function to do a GET request + * + * Returns the wanted page or false on an error; + * + * @param string $url The URL to fetch + * @param bool $sloppy304 Return body on 304 not modified + * @author Andreas Gohr + */ + function get($url,$sloppy304=false){ + if(!$this->sendRequest($url)) return false; + if($this->status == 304 && $sloppy304) return $this->resp_body; + if($this->status != 200) return false; + return $this->resp_body; + } + + /** + * Simple function to do a POST request + * + * Returns the resulting page or false on an error; + * + * @author Andreas Gohr + */ + function post($url,$data){ + if(!$this->sendRequest($url,$data,'POST')) return false; + if($this->status != 200) return false; + return $this->resp_body; + } + + /** + * Do an HTTP request + * + * @author Andreas Goetz + * @author Andreas Gohr + */ + function sendRequest($url,$data=array(),$method='GET'){ + $this->error = ''; + $this->status = 0; + + // parse URL into bits + $uri = parse_url($url); + $server = $uri['host']; + $path = $uri['path']; + if(empty($path)) $path = '/'; + if(!empty($uri['query'])) $path .= '?'.$uri['query']; + $port = $uri['port']; + if($uri['user']) $this->user = $uri['user']; + if($uri['pass']) $this->pass = $uri['pass']; + + // proxy setup + if($this->proxy_host){ + $request_url = $url; + $server = $this->proxy_host; + $port = $this->proxy_port; + if (empty($port)) $port = 8080; + }else{ + $request_url = $path; + $server = $server; + if (empty($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80; + } + + // add SSL stream prefix if needed - needs SSL support in PHP + if($port == 443 || $this->proxy_ssl) $server = 'ssl://'.$server; + + // prepare headers + $headers = $this->headers; + $headers['Host'] = $uri['host']; + $headers['User-Agent'] = $this->agent; + $headers['Referer'] = $this->referer; + $headers['Connection'] = 'Close'; + if($method == 'POST'){ + $post = $this->_postEncode($data); + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + $headers['Content-Length'] = strlen($post); + } + if($this->user) { + $headers['Authorization'] = 'BASIC '.base64_encode($this->user.':'.$this->pass); + } + if($this->proxy_user) { + $headers['Proxy-Authorization'] = 'BASIC '.base64_encode($this->proxy_user.':'.$this->proxy_pass); + } + + // stop time + $start = time(); + + // open socket + $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout); + if (!$socket){ + $resp->status = '-100'; + $this->error = "Could not connect to $server:$port\n$errstr ($errno)"; + return false; + } + //set non blocking + stream_set_blocking($socket,0); + + // build request + $request = "$method $request_url HTTP/".$this->http.HTTP_NL; + $request .= $this->_buildHeaders($headers); + $request .= $this->_getCookies(); + $request .= HTTP_NL; + $request .= $post; + + $this->_debug('request',$request); + + // send request + fputs($socket, $request); + // read headers from socket + $r_headers = ''; + do{ + if(time()-$start > $this->timeout){ + $this->status = -100; + $this->error = 'Timeout while reading headers'; + return false; + } + if(feof($socket)){ + $this->error = 'Premature End of File (socket)'; + return false; + } + $r_headers .= fread($socket,1); #FIXME read full lines here? + }while(!preg_match('/\r\n\r\n$/',$r_headers)); + + $this->_debug('response headers',$r_headers); + + // check if expected body size exceeds allowance + if($this->max_bodysize && preg_match('/\r\nContent-Length:\s*(\d+)\r\n/i',$r_headers,$match)){ + if($match[1] > $this->max_bodysize){ + $this->error = 'Reported content length exceeds allowed response size'; + return false; + } + } + + // get Status + if (!preg_match('/^HTTP\/(\d\.\d)\s*(\d+).*?\n/', $r_headers, $m)) { + $this->error = 'Server returned bad answer'; + return false; + } + $this->status = $m[2]; + + // handle headers and cookies + $this->resp_headers = $this->_parseHeaders($r_headers); + if(isset($this->resp_headers['set-cookie'])){ + foreach ((array) $this->resp_headers['set-cookie'] as $c){ + list($key, $value, $foo) = explode('=', $cookie); + $this->cookies[$key] = $value; + } + } + + $this->_debug('Object headers',$this->resp_headers); + + // check server status code to follow redirect + if($this->status == 301 || $this->status == 302 ){ + if (empty($this->resp_headers['location'])){ + $this->error = 'Redirect but no Location Header found'; + return false; + }elseif($this->redirect_count == $this->max_redirect){ + $this->error = 'Maximum number of redirects exceeded'; + return false; + }else{ + $this->redirect_count++; + $this->referer = $url; + if (!preg_match('/^http/i', $this->resp_headers['location'])){ + $this->resp_headers['location'] = $uri['scheme'].'://'.$uri['host']. + $this->resp_headers['location']; + } + // perform redirected request, always via GET (required by RFC) + return $this->sendRequest($this->resp_headers['location'],array(),'GET'); + } + } + + // check if headers are as expected + if($this->header_regexp && !preg_match($this->header_regexp,$r_headers)){ + $this->error = 'The received headers did not match the given regexp'; + return false; + } + + //read body (with chunked encoding if needed) + $r_body = ''; + if(preg_match('/transfer\-(en)?coding:\s*chunked\r\n/i',$r_header)){ + do { + unset($chunk_size); + do { + if(feof($socket)){ + $this->error = 'Premature End of File (socket)'; + return false; + } + if(time()-$start > $this->timeout){ + $this->status = -100; + $this->error = 'Timeout while reading chunk'; + return false; + } + $byte = fread($socket,1); + $chunk_size .= $byte; + } while (preg_match('/[a-zA-Z0-9]/',$byte)); // read chunksize including \r + + $byte = fread($socket,1); // readtrailing \n + $chunk_size = hexdec($chunk_size); + $this_chunk = fread($socket,$chunk_size); + $r_body .= $this_chunk; + if ($chunk_size) $byte = fread($socket,2); // read trailing \r\n + + if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){ + $this->error = 'Allowed response size exceeded'; + return false; + } + } while ($chunk_size); + }else{ + // read entire socket + while (!feof($socket)) { + if(time()-$start > $this->timeout){ + $this->status = -100; + $this->error = 'Timeout while reading response'; + return false; + } + $r_body .= fread($socket,4096); + if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){ + $this->error = 'Allowed response size exceeded'; + return false; + } + } + } + + // close socket + $status = socket_get_status($socket); + fclose($socket); + + // decode gzip if needed + if($this->resp_headers['content-encoding'] == 'gzip'){ + $this->resp_body = gzinflate(substr($r_body, 10)); + }else{ + $this->resp_body = $r_body; + } + + $this->_debug('response body',$this->resp_body); + $this->redirect_count = 0; + return true; + } + + /** + * print debug info + * + * @author Andreas Gohr + */ + function _debug($info,$var){ + if(!$this->debug) return; + print ''.$info.'
'; + ob_start(); + print_r($var); + $content = htmlspecialchars(ob_get_contents()); + ob_end_clean(); + print '
'.$content.'
'; + } + + /** + * convert given header string to Header array + * + * All Keys are lowercased. + * + * @author Andreas Gohr + */ + function _parseHeaders($string){ + $headers = array(); + $lines = explode("\n",$string); + foreach($lines as $line){ + list($key,$val) = explode(':',$line,2); + $key = strtolower(trim($key)); + $val = trim($val); + if(empty($val)) continue; + if(isset($headers[$key])){ + if(is_array($headers[$key])){ + $headers[$key][] = $val; + }else{ + $headers[$key] = array($headers[$key],$val); + } + }else{ + $headers[$key] = $val; + } + } + return $headers; + } + + /** + * convert given header array to header string + * + * @author Andreas Gohr + */ + function _buildHeaders($headers){ + $string = ''; + foreach($headers as $key => $value){ + if(empty($value)) continue; + $string .= $key.': '.$value.HTTP_NL; + } + return $string; + } + + /** + * get cookies as http header string + * + * @author Andreas Goetz + */ + function _getCookies(){ + foreach ($this->cookies as $key => $val){ + if ($headers) $headers .= '; '; + $headers .= $key.'='.$val; + } + + if ($headers) $headers = "Cookie: $headers".HTTP_NL; + return $headers; + } + + /** + * Encode data for posting + * + * @todo handle mixed encoding for file upoads + * @author Andreas Gohr + */ + function _postEncode($data){ + foreach($data as $key => $val){ + if($url) $url .= '&'; + $url .= $key.'='.urlencode($val); + } + return $url; + } +} + + +/** + * Adds DokuWiki specific configs to the HTTP client + * + * @author Andreas Goetz + */ +class DokuHTTPClient extends HTTPClient { + + /** + * Constructor. + * + * @author Andreas Gohr + */ + function __construct(){ + global $conf; + + // call parent constructor + parent::__construct(); + + // set some values from the config + $this->proxy_host = $conf['proxy']['host']; + $this->proxy_port = $conf['proxy']['port']; + $this->proxy_user = $conf['proxy']['user']; + $this->proxy_pass = $conf['proxy']['pass']; + $this->proxy_ssl = $conf['proxy']['ssl']; + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/JpegMeta.php b/plugins/dokuwiki/inc/JpegMeta.php new file mode 100644 index 0000000..5f9c331 --- /dev/null +++ b/plugins/dokuwiki/inc/JpegMeta.php @@ -0,0 +1,2982 @@ + + * @author Andreas Gohr + * @todo Add support for Maker Notes, Extend for GIF and PNG metadata + */ + +// This class is a modified and enhanced version of the JPEG class by +// Sebastian Delmont. Original Copyright notice follows: +// +// +----------------------------------------------------------------------+ +// | PHP version 4.0 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.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. | +// +----------------------------------------------------------------------+ +// | Authors: Sebastian Delmont | +// +----------------------------------------------------------------------+ + +class JpegMeta +{ + var $_fileName; + var $_fp = null; + var $_type = 'unknown'; + + var $_markers; + var $_info; + + + /** + * Constructor + * + * @author Sebastian Delmont + */ + function __construct($fileName) + { + + $this->_fileName = $fileName; + + $this->_fp = null; + $this->_type = 'unknown'; + + unset($this->_info); + unset($this->_markers); + } + + /** + * Returns all gathered info as multidim array + * + * @author Sebastian Delmont + */ + function & getRawInfo() + { + $this->_parseAll(); + + if ($this->_markers == null) { + return false; + } + + return $this->_info; + } + + /** + * Returns basic image info + * + * @author Sebastian Delmont + */ + function & getBasicInfo() + { + $this->_parseAll(); + + $info = array(); + + if ($this->_markers == null) { + return false; + } + + $info['Name'] = $this->_info['file']['Name']; + if (isset($this->_info['file']['Url'])) { + $info['Url'] = $this->_info['file']['Url']; + $info['NiceSize'] = "???KB"; + } + else { + $info['Size'] = $this->_info['file']['Size']; + $info['NiceSize'] = $this->_info['file']['NiceSize']; + } + + if (@isset($this->_info['sof']['Format'])) { + $info['Format'] = $this->_info['sof']['Format'] . " JPEG"; + } + else { + $info['Format'] = $this->_info['sof']['Format'] . " JPEG"; + } + + if (@isset($this->_info['sof']['ColorChannels'])) { + $info['ColorMode'] = ($this->_info['sof']['ColorChannels'] > 1) ? "Color" : "B&W"; + } + + $info['Width'] = $this->getWidth(); + $info['Height'] = $this->getHeight(); + $info['DimStr'] = $this->getDimStr(); + + $dates = $this->getDates(); + + $info['DateTime'] = $dates['EarliestTime']; + $info['DateTimeStr'] = $dates['EarliestTimeStr']; + + $info['HasThumbnail'] = $this->hasThumbnail(); + + return $info; + } + + + /** + * Convinience function to access nearly all available Data + * through one function + * + * @author Andreas Gohr + */ + function getField($fields) + { + if(!is_array($fields)) $fields = array($fields); + $info = false; + foreach($fields as $field){ + if(strtolower(substr($field,0,5)) == 'iptc.'){ + $info = $this->getIPTCField(substr($field,5)); + }elseif(strtolower(substr($field,0,5)) == 'exif.'){ + $info = $this->getExifField(substr($field,5)); + }elseif(strtolower(substr($field,0,5)) == 'file.'){ + $info = $this->getFileField(substr($field,5)); + }elseif(strtolower(substr($field,0,5)) == 'date.'){ + $info = $this->getDateField(substr($field,5)); + }elseif(strtolower($field) == 'simple.camera'){ + $info = $this->getCamera(); + }elseif(strtolower($field) == 'simple.raw'){ + return $this->getRawInfo(); + }elseif(strtolower($field) == 'simple.title'){ + $info = $this->getTitle(); + }elseif(strtolower($field) == 'simple.shutterspeed'){ + $info = $this->getShutterSpeed(); + }else{ + $info = $this->getExifField($field); + } + if($info != false) break; + } + + if($info === false) $info = $alt; + if(is_array($info)){ + if(isset($info['val'])){ + $info = $info['val']; + }else{ + $info = join(', ',$info); + } + } + return trim($info); + } + + /** + * Convinience function to set nearly all available Data + * through one function + * + * @author Andreas Gohr + */ + function setField($field, $value) + { + if(strtolower(substr($field,0,5)) == 'iptc.'){ + return $this->setIPTCField(substr($field,5),$value); + }elseif(strtolower(substr($field,0,5)) == 'exif.'){ + return $this->setExifField(substr($field,5),$value); + }else{ + return $this->setExifField($field,$value); + } + } + + /** + * Convinience function to delete nearly all available Data + * through one function + * + * @author Andreas Gohr + */ + function deleteField($field) + { + if(strtolower(substr($field,0,5)) == 'iptc.'){ + return $this->deleteIPTCField(substr($field,5)); + }elseif(strtolower(substr($field,0,5)) == 'exif.'){ + return $this->deleteExifField(substr($field,5)); + }else{ + return $this->deleteExifField($field); + } + } + + /** + * Return a date field + * + * @author Andreas Gohr + */ + function getDateField($field) + { + if (!isset($this->_info['dates'])) { + $this->_info['dates'] = $this->getDates(); + } + + if (isset($this->_info['dates'][$field])) { + return $this->_info['dates'][$field]; + } + + return false; + } + + /** + * Return a file info field + * + * @author Andreas Gohr + */ + function getFileField($field) + { + if (!isset($this->_info['file'])) { + $this->_parseFileInfo(); + } + + if (isset($this->_info['file'][$field])) { + return $this->_info['file'][$field]; + } + + return false; + } + + /** + * Return the camera info (Maker and Model) + * + * @author Andreas Gohr + * @todo handle makernotes + */ + function getCamera(){ + $make = $this->getField(array('Exif.Make','Exif.TIFFMake')); + $model = $this->getField(array('Exif.Model','Exif.TIFFModel')); + $cam = trim("$make $model"); + if(empty($cam)) return false; + return $cam; + } + + /** + * Return shutter speed as a ratio + * + * @author Joe Lapp + */ + function getShutterSpeed() + { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + if(!isset($this->_info['exif']['ExposureTime'])){ + return ''; + } + + $field = $this->_info['exif']['ExposureTime']; + if($field['den'] == 1) return $field['num']; + return $field['num'].'/'.$field['den']; + } + + /** + * Return an EXIF field + * + * @author Sebastian Delmont + */ + function getExifField($field) + { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['exif'][$field])) { + return $this->_info['exif'][$field]; + } + + return false; + } + + /** + * Return an Adobe Field + * + * @author Sebastian Delmont + */ + function getAdobeField($field) + { + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['adobe'][$field])) { + return $this->_info['adobe'][$field]; + } + + return false; + } + + /** + * Return an IPTC field + * + * @author Sebastian Delmont + */ + function getIPTCField($field) + { + if (!isset($this->_info['iptc'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['iptc'][$field])) { + return $this->_info['iptc'][$field]; + } + + return false; + } + + /** + * Set an EXIF field + * + * @author Sebastian Delmont + * @author Joe Lapp + */ + function setExifField($field, $value) + { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['exif'] == false) { + $this->_info['exif'] = array(); + } + + // make sure datetimes are in correct format + if(strlen($field) >= 8 && strtolower(substr($field, 0, 8)) == 'datetime') { + if(strlen($value) < 8 || $value{4} != ':' || $value{7} != ':') { + $value = date('Y:m:d H:i:s', strtotime($value)); + } + } + + $this->_info['exif'][$field] = $value; + + return true; + } + + /** + * Set an Adobe Field + * + * @author Sebastian Delmont + */ + function setAdobeField($field, $value) + { + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['adobe'] == false) { + $this->_info['adobe'] = array(); + } + + $this->_info['adobe'][$field] = $value; + + return true; + } + + /** + * Calculates the multiplier needed to resize the image to the given + * dimensions + * + * @author Andreas Gohr + */ + function getResizeRatio($maxwidth,$maxheight=0){ + if(!$maxheight) $maxheight = $maxwidth; + + $w = $this->getField('File.Width'); + $h = $this->getField('File.Height'); + + $ratio = 1; + if($w >= $h){ + if($w >= $maxwidth){ + $ratio = $maxwidth/$w; + }elseif($h > $maxheight){ + $ratio = $maxheight/$h; + } + }else{ + if($h >= $maxheight){ + $ratio = $maxheight/$h; + }elseif($w > $maxwidth){ + $ratio = $maxwidth/$w; + } + } + return $ratio; + } + + + /** + * Set an IPTC field + * + * @author Sebastian Delmont + */ + function setIPTCField($field, $value) + { + if (!isset($this->_info['iptc'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['iptc'] == false) { + $this->_info['iptc'] = array(); + } + + $this->_info['iptc'][$field] = $value; + + return true; + } + + /** + * Delete an EXIF field + * + * @author Sebastian Delmont + */ + function deleteExifField($field) + { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['exif'] != false) { + unset($this->_info['exif'][$field]); + } + + return true; + } + + /** + * Delete an Adobe field + * + * @author Sebastian Delmont + */ + function deleteAdobeField($field) + { + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['adobe'] != false) { + unset($this->_info['adobe'][$field]); + } + + return true; + } + + /** + * Delete an IPTC field + * + * @author Sebastian Delmont + */ + function deleteIPTCField($field) + { + if (!isset($this->_info['iptc'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if ($this->_info['iptc'] != false) { + unset($this->_info['iptc'][$field]); + } + + return true; + } + + /** + * Get the image's title, tries various fields + * + * @param int $max maximum number chars (keeps words) + * @author Andreas Gohr + */ + function getTitle($max=80){ + $cap = ''; + + // try various fields + $cap = $this->getField(array('Iptc.Headline', + 'Iptc.Caption', + 'Exif.UserComment', + 'Exif.TIFFUserComment', + 'Exif.TIFFImageDescription', + 'File.Name')); + if (empty($cap)) return false; + + if(!$max) return $cap; + // Shorten to 80 chars (keeping words) + $new = preg_replace('/\n.+$/','',wordwrap($cap, $max)); + if($new != $cap) $new .= '...'; + + return $new; + } + + /** + * Gather various date fields + * + * @author Sebastian Delmont + */ + function getDates() + { + $this->_parseAll(); + + if ($this->_markers == null) { + return false; + } + + $dates = array(); + + $latestTime = 0; + $latestTimeSource = ""; + $earliestTime = time(); + $earliestTimeSource = ""; + + if (@isset($this->_info['exif']['DateTime'])) { + $dates['ExifDateTime'] = $this->_info['exif']['DateTime']; + + $aux = $this->_info['exif']['DateTime']; + $aux{4} = "-"; + $aux{7} = "-"; + $t = strtotime($aux); + + if ($t > $latestTime) { + $latestTime = $t; + $latestTimeSource = "ExifDateTime"; + } + + if ($t < $earliestTime) { + $earliestTime = $t; + $earliestTimeSource = "ExifDateTime"; + } + } + + if (@isset($this->_info['exif']['DateTimeOriginal'])) { + $dates['ExifDateTimeOriginal'] = $this->_info['exif']['DateTime']; + + $aux = $this->_info['exif']['DateTimeOriginal']; + $aux{4} = "-"; + $aux{7} = "-"; + $t = strtotime($aux); + + if ($t > $latestTime) { + $latestTime = $t; + $latestTimeSource = "ExifDateTimeOriginal"; + } + + if ($t < $earliestTime) { + $earliestTime = $t; + $earliestTimeSource = "ExifDateTimeOriginal"; + } + } + + if (@isset($this->_info['exif']['DateTimeDigitized'])) { + $dates['ExifDateTimeDigitized'] = $this->_info['exif']['DateTime']; + + $aux = $this->_info['exif']['DateTimeDigitized']; + $aux{4} = "-"; + $aux{7} = "-"; + $t = strtotime($aux); + + if ($t > $latestTime) { + $latestTime = $t; + $latestTimeSource = "ExifDateTimeDigitized"; + } + + if ($t < $earliestTime) { + $earliestTime = $t; + $earliestTimeSource = "ExifDateTimeDigitized"; + } + } + + if (@isset($this->_info['iptc']['DateCreated'])) { + $dates['IPTCDateCreated'] = $this->_info['iptc']['DateCreated']; + + $aux = $this->_info['iptc']['DateCreated']; + $aux = substr($aux, 0, 4) . "-" . substr($aux, 4, 2) . "-" . substr($aux, 6, 2); + $t = strtotime($aux); + + if ($t > $latestTime) { + $latestTime = $t; + $latestTimeSource = "IPTCDateCreated"; + } + + if ($t < $earliestTime) { + $earliestTime = $t; + $earliestTimeSource = "IPTCDateCreated"; + } + } + + if (@isset($this->_info['file']['UnixTime'])) { + $dates['FileModified'] = $this->_info['file']['UnixTime']; + + $t = $this->_info['file']['UnixTime']; + + if ($t > $latestTime) { + $latestTime = $t; + $latestTimeSource = "FileModified"; + } + + if ($t < $earliestTime) { + $earliestTime = $t; + $earliestTimeSource = "FileModified"; + } + } + + $dates['Time'] = $earliestTime; + $dates['TimeSource'] = $earliestTimeSource; + $dates['TimeStr'] = date("Y-m-d H:i:s", $earliestTime); + $dates['EarliestTime'] = $earliestTime; + $dates['EarliestTimeSource'] = $earliestTimeSource; + $dates['EarliestTimeStr'] = date("Y-m-d H:i:s", $earliestTime); + $dates['LatestTime'] = $latestTime; + $dates['LatestTimeSource'] = $latestTimeSource; + $dates['LatestTimeStr'] = date("Y-m-d H:i:s", $latestTime); + + return $dates; + } + + /** + * Get the image width, tries various fields + * + * @author Sebastian Delmont + */ + function getWidth() + { + if (!isset($this->_info['sof'])) { + $this->_parseMarkerSOF(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['sof']['ImageWidth'])) { + return $this->_info['sof']['ImageWidth']; + } + + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if (isset($this->_info['exif']['PixelXDimension'])) { + return $this->_info['exif']['PixelXDimension']; + } + + return false; + } + + /** + * Get the image height, tries various fields + * + * @author Sebastian Delmont + */ + function getHeight() + { + if (!isset($this->_info['sof'])) { + $this->_parseMarkerSOF(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['sof']['ImageHeight'])) { + return $this->_info['sof']['ImageHeight']; + } + + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if (isset($this->_info['exif']['PixelYDimension'])) { + return $this->_info['exif']['PixelYDimension']; + } + + return false; + } + + /** + * Get an dimension string for use in img tag + * + * @author Sebastian Delmont + */ + function getDimStr() + { + if ($this->_markers == null) { + return false; + } + + $w = $this->getWidth(); + $h = $this->getHeight(); + + return "width='" . $w . "' height='" . $h . "'"; + } + + /** + * Checks for an embedded thumbnail + * + * @author Sebastian Delmont + */ + function hasThumbnail($which = 'any') + { + if (($which == 'any') || ($which == 'exif')) { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['exif']) && is_array($this->_info['exif'])) { + if (isset($this->_info['exif']['JFIFThumbnail'])) { + return 'exif'; + } + } + } + + if ($which == 'adobe') { + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['adobe']) && is_array($this->_info['adobe'])) { + if (isset($this->_info['adobe']['ThumbnailData'])) { + return 'exif'; + } + } + } + + return false; + } + + /** + * Send embedded thumbnail to browser + * + * @author Sebastian Delmont + */ + function sendThumbnail($which = 'any') + { + $data = null; + + if (($which == 'any') || ($which == 'exif')) { + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['exif']) && is_array($this->_info['exif'])) { + if (isset($this->_info['exif']['JFIFThumbnail'])) { + $data =& $this->_info['exif']['JFIFThumbnail']; + } + } + } + + if (($which == 'adobe') || ($data == null)){ + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + + if ($this->_markers == null) { + return false; + } + + if (isset($this->_info['adobe']) && is_array($this->_info['adobe'])) { + if (isset($this->_info['adobe']['ThumbnailData'])) { + $data =& $this->_info['adobe']['ThumbnailData']; + } + } + } + + if ($data != null) { + header("Content-type: image/jpeg"); + echo $data; + return true; + } + + return false; + } + + /** + * Save changed Metadata + * + * @author Sebastian Delmont + * @author Andreas Gohr + */ + function save($fileName = "") { + if ($fileName == "") { + $tmpName = tempnam(dirname($this->_fileName),'_metatemp_'); + $this->_writeJPEG($tmpName); + if (@file_exists($tmpName)) { + return io_rename($tmpName, $this->_fileName); + } + } else { + return $this->_writeJPEG($fileName); + } + return false; + } + + /*************************************************************/ + /* PRIVATE FUNCTIONS (Internal Use Only!) */ + /*************************************************************/ + + /*************************************************************/ + function _dispose() + { + $this->_fileName = $fileName; + + $this->_fp = null; + $this->_type = 'unknown'; + + unset($this->_markers); + unset($this->_info); + } + + /*************************************************************/ + function _readJPEG() + { + unset($this->_markers); + unset($this->_info); + $this->_markers = array(); + $this->_info = array(); + + $this->_fp = @fopen($this->_fileName, 'rb'); + if ($this->_fp) { + if (file_exists($this->_fileName)) { + $this->_type = 'file'; + } + else { + $this->_type = 'url'; + } + } + else { + $this->_fp = null; + return false; // ERROR: Can't open file + } + + // Check for the JPEG signature + $c1 = ord(fgetc($this->_fp)); + $c2 = ord(fgetc($this->_fp)); + + if ($c1 != 0xFF || $c2 != 0xD8) { // (0xFF + SOI) + $this->_markers = null; + return false; // ERROR: File is not a JPEG + } + + $count = 0; + + $done = false; + $ok = true; + + while (!$done) { + $capture = false; + + // First, skip any non 0xFF bytes + $discarded = 0; + $c = ord(fgetc($this->_fp)); + while (!feof($this->_fp) && ($c != 0xFF)) { + $discarded++; + $c = ord(fgetc($this->_fp)); + } + // Then skip all 0xFF until the marker byte + do { + $marker = ord(fgetc($this->_fp)); + } while (!feof($this->_fp) && ($marker == 0xFF)); + + if (feof($this->_fp)) { + return false; // ERROR: Unexpected EOF + } + if ($discarded != 0) { + return false; // ERROR: Extraneous data + } + + $length = ord(fgetc($this->_fp)) * 256 + ord(fgetc($this->_fp)); + if (feof($this->_fp)) { + return false; // ERROR: Unexpected EOF + } + if ($length < 2) { + return false; // ERROR: Extraneous data + } + $length = $length - 2; // The length we got counts itself + + switch ($marker) { + case 0xC0: // SOF0 + case 0xC1: // SOF1 + case 0xC2: // SOF2 + case 0xC9: // SOF9 + case 0xE0: // APP0: JFIF data + case 0xE1: // APP1: EXIF data + case 0xED: // APP13: IPTC / Photoshop data + $capture = true; + break; + case 0xDA: // SOS: Start of scan... the image itself and the last block on the file + $capture = false; + $length = -1; // This field has no length... it includes all data until EOF + $done = true; + break; + default: + $capture = true;//false; + break; + } + + $this->_markers[$count] = array(); + $this->_markers[$count]['marker'] = $marker; + $this->_markers[$count]['length'] = $length; + + if ($capture) { + $this->_markers[$count]['data'] =& fread($this->_fp, $length); + } + elseif (!$done) { + $result = @fseek($this->_fp, $length, SEEK_CUR); + // fseek doesn't seem to like HTTP 'files', but fgetc has no problem + if (!($result === 0)) { + for ($i = 0; $i < $length; $i++) { + fgetc($this->_fp); + } + } + } + $count++; + } + + if ($this->_fp) { + fclose($this->_fp); + $this->_fp = null; + } + + return $ok; + } + + /*************************************************************/ + function _parseAll() + { + if (!isset($this->_markers)) { + $this->_readJPEG(); + } + + if ($this->_markers == null) { + return false; + } + + if (!isset($this->_info['jfif'])) { + $this->_parseMarkerJFIF(); + } + if (!isset($this->_info['jpeg'])) { + $this->_parseMarkerSOF(); + } + if (!isset($this->_info['exif'])) { + $this->_parseMarkerExif(); + } + if (!isset($this->_info['adobe'])) { + $this->_parseMarkerAdobe(); + } + if (!isset($this->_info['file'])) { + $this->_parseFileInfo(); + } + } + + /*************************************************************/ + function _writeJPEG($outputName) + { + $this->_parseAll(); + + $wroteEXIF = false; + $wroteAdobe = false; + + $this->_fp = @fopen($this->_fileName, 'r'); + if ($this->_fp) { + if (file_exists($this->_fileName)) { + $this->_type = 'file'; + } + else { + $this->_type = 'url'; + } + } + else { + $this->_fp = null; + return false; // ERROR: Can't open file + } + + $this->_fpout = fopen($outputName, 'wb'); + if ($this->_fpout) { + } + else { + $this->_fpout = null; + fclose($this->_fp); + $this->_fp = null; + return false; // ERROR: Can't open output file + } + + // Check for the JPEG signature + $c1 = ord(fgetc($this->_fp)); + $c2 = ord(fgetc($this->_fp)); + + if ($c1 != 0xFF || $c2 != 0xD8) { // (0xFF + SOI) + return false; // ERROR: File is not a JPEG + } + + fputs($this->_fpout, chr(0xFF), 1); + fputs($this->_fpout, chr(0xD8), 1); // (0xFF + SOI) + + $count = 0; + + $done = false; + $ok = true; + + while (!$done) { + // First, skip any non 0xFF bytes + $discarded = 0; + $c = ord(fgetc($this->_fp)); + while (!feof($this->_fp) && ($c != 0xFF)) { + $discarded++; + $c = ord(fgetc($this->_fp)); + } + // Then skip all 0xFF until the marker byte + do { + $marker = ord(fgetc($this->_fp)); + } while (!feof($this->_fp) && ($marker == 0xFF)); + + if (feof($this->_fp)) { + $ok = false; + break; // ERROR: Unexpected EOF + } + if ($discarded != 0) { + $ok = false; + break; // ERROR: Extraneous data + } + + $length = ord(fgetc($this->_fp)) * 256 + ord(fgetc($this->_fp)); + if (feof($this->_fp)) { + $ok = false; + break; // ERROR: Unexpected EOF + } + if ($length < 2) { + $ok = false; + break; // ERROR: Extraneous data + } + $length = $length - 2; // The length we got counts itself + + unset($data); + if ($marker == 0xE1) { // APP1: EXIF data + $data =& $this->_createMarkerEXIF(); + $wroteEXIF = true; + } + elseif ($marker == 0xED) { // APP13: IPTC / Photoshop data + $data =& $this->_createMarkerAdobe(); + $wroteAdobe = true; + } + elseif ($marker == 0xDA) { // SOS: Start of scan... the image itself and the last block on the file + $done = true; + } + + if (!$wroteEXIF && (($marker < 0xE0) || ($marker > 0xEF))) { + if (isset($this->_info['exif']) && is_array($this->_info['exif'])) { + $exif =& $this->_createMarkerEXIF(); + $this->_writeJPEGMarker(0xE1, strlen($exif), $exif, 0); + unset($exif); + } + $wroteEXIF = true; + } + + if (!$wroteAdobe && (($marker < 0xE0) || ($marker > 0xEF))) { + if ((isset($this->_info['adobe']) && is_array($this->_info['adobe'])) + || (isset($this->_info['iptc']) && is_array($this->_info['iptc']))) { + $adobe =& $this->_createMarkerAdobe(); + $this->_writeJPEGMarker(0xED, strlen($adobe), $adobe, 0); + unset($adobe); + } + $wroteAdobe = true; + } + + $origLength = $length; + if (isset($data)) { + $length = strlen($data); + } + + if ($marker != -1) { + $this->_writeJPEGMarker($marker, $length, $data, $origLength); + } + } + + if ($this->_fp) { + fclose($this->_fp); + $this->_fp = null; + } + + if ($this->_fpout) { + fclose($this->_fpout); + $this->_fpout = null; + } + + return $ok; + } + + /*************************************************************/ + function _writeJPEGMarker($marker, $length, &$data, $origLength) + { + if ($length <= 0) { + return false; + } + + fputs($this->_fpout, chr(0xFF), 1); + fputs($this->_fpout, chr($marker), 1); + fputs($this->_fpout, chr((($length + 2) & 0x0000FF00) >> 8), 1); + fputs($this->_fpout, chr((($length + 2) & 0x000000FF) >> 0), 1); + + if (isset($data)) { + // Copy the generated data + fputs($this->_fpout, $data, $length); + + if ($origLength > 0) { // Skip the original data + $result = @fseek($this->_fp, $origLength, SEEK_CUR); + // fseek doesn't seem to like HTTP 'files', but fgetc has no problem + if ($result != 0) { + for ($i = 0; $i < $origLength; $i++) { + fgetc($this->_fp); + } + } + } + } + else { + if ($marker == 0xDA) { // Copy until EOF + while (!feof($this->_fp)) { + $data =& fread($this->_fp, 1024 * 16); + fputs($this->_fpout, $data, strlen($data)); + } + } + else { // Copy only $length bytes + $data =& fread($this->_fp, $length); + fputs($this->_fpout, $data, $length); + } + } + + return true; + } + + /** + * Gets basic info from the file - should work with non-JPEGs + * + * @author Sebastian Delmont + * @author Andreas Gohr + */ + function _parseFileInfo() + { + if (file_exists($this->_fileName)) { + $this->_info['file'] = array(); + $this->_info['file']['Name'] = basename($this->_fileName); + $this->_info['file']['Path'] = realpath($this->_fileName); + $this->_info['file']['Size'] = filesize($this->_fileName); + if ($this->_info['file']['Size'] < 1024) { + $this->_info['file']['NiceSize'] = $this->_info['file']['Size'] . 'B'; + } + elseif ($this->_info['file']['Size'] < (1024 * 1024)) { + $this->_info['file']['NiceSize'] = round($this->_info['file']['Size'] / 1024) . 'KB'; + } + elseif ($this->_info['file']['Size'] < (1024 * 1024 * 1024)) { + $this->_info['file']['NiceSize'] = round($this->_info['file']['Size'] / 1024) . 'MB'; + } + else { + $this->_info['file']['NiceSize'] = $this->_info['file']['Size'] . 'B'; + } + $this->_info['file']['UnixTime'] = filemtime($this->_fileName); + + // get image size directly from file + $size = getimagesize($this->_fileName); + $this->_info['file']['Width'] = $size[0]; + $this->_info['file']['Height'] = $size[1]; + // set mime types and formats + // http://www.php.net/manual/en/function.getimagesize.php + // http://www.php.net/manual/en/function.image-type-to-mime-type.php + switch ($size[2]){ + case 1: + $this->_info['file']['Mime'] = 'image/gif'; + $this->_info['file']['Format'] = 'GIF'; + break; + case 2: + $this->_info['file']['Mime'] = 'image/jpeg'; + $this->_info['file']['Format'] = 'JPEG'; + break; + case 3: + $this->_info['file']['Mime'] = 'image/png'; + $this->_info['file']['Format'] = 'PNG'; + break; + case 4: + $this->_info['file']['Mime'] = 'application/x-shockwave-flash'; + $this->_info['file']['Format'] = 'SWF'; + break; + case 5: + $this->_info['file']['Mime'] = 'image/psd'; + $this->_info['file']['Format'] = 'PSD'; + break; + case 6: + $this->_info['file']['Mime'] = 'image/bmp'; + $this->_info['file']['Format'] = 'BMP'; + break; + case 7: + $this->_info['file']['Mime'] = 'image/tiff'; + $this->_info['file']['Format'] = 'TIFF (Intel)'; + break; + case 8: + $this->_info['file']['Mime'] = 'image/tiff'; + $this->_info['file']['Format'] = 'TIFF (Motorola)'; + break; + case 9: + $this->_info['file']['Mime'] = 'application/octet-stream'; + $this->_info['file']['Format'] = 'JPC'; + break; + case 10: + $this->_info['file']['Mime'] = 'image/jp2'; + $this->_info['file']['Format'] = 'JP2'; + break; + case 11: + $this->_info['file']['Mime'] = 'application/octet-stream'; + $this->_info['file']['Format'] = 'JPX'; + break; + case 12: + $this->_info['file']['Mime'] = 'application/octet-stream'; + $this->_info['file']['Format'] = 'JB2'; + break; + case 13: + $this->_info['file']['Mime'] = 'application/x-shockwave-flash'; + $this->_info['file']['Format'] = 'SWC'; + break; + case 14: + $this->_info['file']['Mime'] = 'image/iff'; + $this->_info['file']['Format'] = 'IFF'; + break; + case 15: + $this->_info['file']['Mime'] = 'image/vnd.wap.wbmp'; + $this->_info['file']['Format'] = 'WBMP'; + break; + case 16: + $this->_info['file']['Mime'] = 'image/xbm'; + $this->_info['file']['Format'] = 'XBM'; + break; + default: + $this->_info['file']['Mime'] = 'image/unknown'; + } + } + else { + $this->_info['file'] = array(); + $this->_info['file']['Name'] = basename($this->_fileName); + $this->_info['file']['Url'] = $this->_fileName; + } + + return true; + } + + /*************************************************************/ + function _parseMarkerJFIF() + { + if (!isset($this->_markers)) { + $this->_readJPEG(); + } + + if ($this->_markers == null) { + return false; + } + + $data = null; + $count = count($this->_markers); + for ($i = 0; $i < $count; $i++) { + if ($this->_markers[$i]['marker'] == 0xE0) { + $signature = $this->_getFixedString($this->_markers[$i]['data'], 0, 4); + if ($signature == 'JFIF') { + $data =& $this->_markers[$i]['data']; + break; + } + } + } + + if ($data == null) { + $this->_info['jfif'] = false; + return false; + } + + $pos = 0; + $this->_info['jfif'] = array(); + + + $vmaj = $this->_getByte($data, 5); + $vmin = $this->_getByte($data, 6); + + $this->_info['jfif']['Version'] = sprintf('%d.%02d', $vmaj, $vmin); + + $units = $this->_getByte($data, 7); + switch ($units) { + case 0: + $this->_info['jfif']['Units'] = 'pixels'; + break; + case 1: + $this->_info['jfif']['Units'] = 'dpi'; + break; + case 2: + $this->_info['jfif']['Units'] = 'dpcm'; + break; + default: + $this->_info['jfif']['Units'] = 'unknown'; + break; + } + + $xdens = $this->_getShort($data, 8); + $ydens = $this->_getShort($data, 10); + + $this->_info['jfif']['XDensity'] = $xdens; + $this->_info['jfif']['YDensity'] = $ydens; + + $thumbx = $this->_getByte($data, 12); + $thumby = $this->_getByte($data, 13); + + $this->_info['jfif']['ThumbnailWidth'] = $thumbx; + $this->_info['jfif']['ThumbnailHeight'] = $thumby; + + return true; + } + + /*************************************************************/ + function _parseMarkerSOF() + { + if (!isset($this->_markers)) { + $this->_readJPEG(); + } + + if ($this->_markers == null) { + return false; + } + + $data = null; + $count = count($this->_markers); + for ($i = 0; $i < $count; $i++) { + switch ($this->_markers[$i]['marker']) { + case 0xC0: // SOF0 + case 0xC1: // SOF1 + case 0xC2: // SOF2 + case 0xC9: // SOF9 + $data =& $this->_markers[$i]['data']; + $marker = $this->_markers[$i]['marker']; + break; + } + } + + if ($data == null) { + $this->_info['sof'] = false; + return false; + } + + $pos = 0; + $this->_info['sof'] = array(); + + + switch ($marker) { + case 0xC0: // SOF0 + $format = 'Baseline'; + break; + case 0xC1: // SOF1 + $format = 'Progessive'; + break; + case 0xC2: // SOF2 + $format = 'Non-baseline'; + break; + case 0xC9: // SOF9 + $format = 'Arithmetic'; + break; + default: + return false; + break; + } + + + $this->_info['sof']['Format'] = $format; + + $this->_info['sof']['SamplePrecision'] = $this->_getByte($data, $pos + 0); + $this->_info['sof']['ImageHeight'] = $this->_getShort($data, $pos + 1); + $this->_info['sof']['ImageWidth'] = $this->_getShort($data, $pos + 3); + $this->_info['sof']['ColorChannels'] = $this->_getByte($data, $pos + 5); + + return true; + } + + /*************************************************************/ + function _parseMarkerExif() + { + if (!isset($this->_markers)) { + $this->_readJPEG(); + } + + if ($this->_markers == null) { + return false; + } + + $data = null; + $count = count($this->_markers); + for ($i = 0; $i < $count; $i++) { + if ($this->_markers[$i]['marker'] == 0xE1) { + $signature = $this->_getFixedString($this->_markers[$i]['data'], 0, 6); + if ($signature == "Exif\0\0") { + $data =& $this->_markers[$i]['data']; + break; + } + } + } + + if ($data == null) { + $this->_info['exif'] = false; + return false; + } + $pos = 6; + $this->_info['exif'] = array(); + + // We don't increment $pos after this because Exif uses offsets relative to this point + + $byteAlign = $this->_getShort($data, $pos + 0); + + if ($byteAlign == 0x4949) { // "II" + $isBigEndian = false; + } + elseif ($byteAlign == 0x4D4D) { // "MM" + $isBigEndian = true; + } + else { + return false; // Unexpected data + } + + $alignCheck = $this->_getShort($data, $pos + 2, $isBigEndian); + if ($alignCheck != 0x002A) // That's the expected value + return false; // Unexpected data + + if ($isBigEndian) { + $this->_info['exif']['ByteAlign'] = "Big Endian"; + } + else { + $this->_info['exif']['ByteAlign'] = "Little Endian"; + } + + $offsetIFD0 = $this->_getLong($data, $pos + 4, $isBigEndian); + if ($offsetIFD0 < 8) + return false; // Unexpected data + + $offsetIFD1 = $this->_readIFD($data, $pos, $offsetIFD0, $isBigEndian, 'ifd0'); + if ($offsetIFD1 != 0) + $this->_readIFD($data, $pos, $offsetIFD1, $isBigEndian, 'ifd1'); + + return true; + } + + /*************************************************************/ + function _readIFD($data, $base, $offset, $isBigEndian, $mode) + { + $EXIFTags = $this->_exifTagNames($mode); + + $numEntries = $this->_getShort($data, $base + $offset, $isBigEndian); + $offset += 2; + + $exifTIFFOffset = 0; + $exifTIFFLength = 0; + $exifThumbnailOffset = 0; + $exifThumbnailLength = 0; + + for ($i = 0; $i < $numEntries; $i++) { + $tag = $this->_getShort($data, $base + $offset, $isBigEndian); + $offset += 2; + $type = $this->_getShort($data, $base + $offset, $isBigEndian); + $offset += 2; + $count = $this->_getLong($data, $base + $offset, $isBigEndian); + $offset += 4; + + if (($type < 1) || ($type > 12)) + return false; // Unexpected Type + + $typeLengths = array( -1, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 ); + + $dataLength = $typeLengths[$type] * $count; + if ($dataLength > 4) { + $dataOffset = $this->_getLong($data, $base + $offset, $isBigEndian); + $rawValue = $this->_getFixedString($data, $base + $dataOffset, $dataLength); + } + else { + $rawValue = $this->_getFixedString($data, $base + $offset, $dataLength); + } + $offset += 4; + + switch ($type) { + case 1: // UBYTE + if ($count == 1) { + $value = $this->_getByte($rawValue, 0); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getByte($rawValue, $j); + } + break; + case 2: // ASCII + $value = $rawValue; + break; + case 3: // USHORT + if ($count == 1) { + $value = $this->_getShort($rawValue, 0, $isBigEndian); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getShort($rawValue, $j * 2, $isBigEndian); + } + break; + case 4: // ULONG + if ($count == 1) { + $value = $this->_getLong($rawValue, 0, $isBigEndian); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getLong($rawValue, $j * 4, $isBigEndian); + } + break; + case 5: // URATIONAL + if ($count == 1) { + $a = $this->_getLong($rawValue, 0, $isBigEndian); + $b = $this->_getLong($rawValue, 4, $isBigEndian); + $value = array(); + $value['val'] = 0; + $value['num'] = $a; + $value['den'] = $b; + if (($a != 0) && ($b != 0)) { + $value['val'] = $a / $b; + } + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) { + $a = $this->_getLong($rawValue, $j * 8, $isBigEndian); + $b = $this->_getLong($rawValue, ($j * 8) + 4, $isBigEndian); + $value = array(); + $value[$j]['val'] = 0; + $value[$j]['num'] = $a; + $value[$j]['den'] = $b; + if (($a != 0) && ($b != 0)) + $value[$j]['val'] = $a / $b; + } + } + break; + case 6: // SBYTE + if ($count == 1) { + $value = $this->_getByte($rawValue, 0); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getByte($rawValue, $j); + } + break; + case 7: // UNDEFINED + $value = $rawValue; + break; + case 8: // SSHORT + if ($count == 1) { + $value = $this->_getShort($rawValue, 0, $isBigEndian); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getShort($rawValue, $j * 2, $isBigEndian); + } + break; + case 9: // SLONG + if ($count == 1) { + $value = $this->_getLong($rawValue, 0, $isBigEndian); + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) + $value[$j] = $this->_getLong($rawValue, $j * 4, $isBigEndian); + } + break; + case 10: // SRATIONAL + if ($count == 1) { + $a = $this->_getLong($rawValue, 0, $isBigEndian); + $b = $this->_getLong($rawValue, 4, $isBigEndian); + $value = array(); + $value['val'] = 0; + $value['num'] = $a; + $value['den'] = $b; + if (($a != 0) && ($b != 0)) + $value['val'] = $a / $b; + } + else { + $value = array(); + for ($j = 0; $j < $count; $j++) { + $a = $this->_getLong($rawValue, $j * 8, $isBigEndian); + $b = $this->_getLong($rawValue, ($j * 8) + 4, $isBigEndian); + $value = array(); + $value[$j]['val'] = 0; + $value[$j]['num'] = $a; + $value[$j]['den'] = $b; + if (($a != 0) && ($b != 0)) + $value[$j]['val'] = $a / $b; + } + } + break; + case 11: // FLOAT + $value = $rawValue; + break; + + case 12: // DFLOAT + $value = $rawValue; + break; + default: + return false; // Unexpected Type + } + + $tagName = ''; + if (($mode == 'ifd0') && ($tag == 0x8769)) { // ExifIFDOffset + $this->_readIFD($data, $base, $value, $isBigEndian, 'exif'); + } + elseif (($mode == 'ifd0') && ($tag == 0x8825)) { // GPSIFDOffset + $this->_readIFD($data, $base, $value, $isBigEndian, 'gps'); + } + elseif (($mode == 'ifd1') && ($tag == 0x0111)) { // TIFFStripOffsets + $exifTIFFOffset = $value; + } + elseif (($mode == 'ifd1') && ($tag == 0x0117)) { // TIFFStripByteCounts + $exifTIFFLength = $value; + } + elseif (($mode == 'ifd1') && ($tag == 0x0201)) { // TIFFJFIFOffset + $exifThumbnailOffset = $value; + } + elseif (($mode == 'ifd1') && ($tag == 0x0202)) { // TIFFJFIFLength + $exifThumbnailLength = $value; + } + elseif (($mode == 'exif') && ($tag == 0xA005)) { // InteropIFDOffset + $this->_readIFD($data, $base, $value, $isBigEndian, 'interop'); + } + // elseif (($mode == 'exif') && ($tag == 0x927C)) { // MakerNote + // } + else { + if (isset($EXIFTags[$tag])) { + $tagName = $EXIFTags[$tag]; + if (isset($this->_info['exif'][$tagName])) { + if (!is_array($this->_info['exif'][$tagName])) { + $aux = array(); + $aux[0] = $this->_info['exif'][$tagName]; + $this->_info['exif'][$tagName] = $aux; + } + + $this->_info['exif'][$tagName][count($this->_info['exif'][$tagName])] = $value; + } + else { + $this->_info['exif'][$tagName] = $value; + } + } + else { +#echo sprintf("

Unknown tag %02x (t: %d l: %d) %s in %s

", $tag, $type, $count, $mode, $this->_fileName); + // Unknown Tags will be ignored!!! + // That's because the tag might be a pointer (like the Exif tag) + // and saving it without saving the data it points to might + // create an invalid file. + } + } + } + + if (($exifThumbnailOffset > 0) && ($exifThumbnailLength > 0)) { + $this->_info['exif']['JFIFThumbnail'] = $this->_getFixedString($data, $base + $exifThumbnailOffset, $exifThumbnailLength); + } + + if (($exifTIFFOffset > 0) && ($exifTIFFLength > 0)) { + $this->_info['exif']['TIFFStrips'] = $this->_getFixedString($data, $base + $exifTIFFOffset, $exifTIFFLength); + } + + $nextOffset = $this->_getLong($data, $base + $offset, $isBigEndian); + return $nextOffset; + } + + /*************************************************************/ + function & _createMarkerExif() + { + $data = null; + $count = count($this->_markers); + for ($i = 0; $i < $count; $i++) { + if ($this->_markers[$i]['marker'] == 0xE1) { + $signature = $this->_getFixedString($this->_markers[$i]['data'], 0, 6); + if ($signature == "Exif\0\0") { + $data =& $this->_markers[$i]['data']; + break; + } + } + } + + if (!isset($this->_info['exif'])) { + return false; + } + + $data = "Exif\0\0"; + $pos = 6; + $offsetBase = 6; + + if (isset($this->_info['exif']['ByteAlign']) && ($this->_info['exif']['ByteAlign'] == "Big Endian")) { + $isBigEndian = true; + $aux = "MM"; + $pos = $this->_putString($data, $pos, $aux); + } + else { + $isBigEndian = false; + $aux = "II"; + $pos = $this->_putString($data, $pos, $aux); + } + $pos = $this->_putShort($data, $pos, 0x002A, $isBigEndian); + $pos = $this->_putLong($data, $pos, 0x00000008, $isBigEndian); // IFD0 Offset is always 8 + + $ifd0 =& $this->_getIFDEntries($isBigEndian, 'ifd0'); + $ifd1 =& $this->_getIFDEntries($isBigEndian, 'ifd1'); + + $pos = $this->_writeIFD($data, $pos, $offsetBase, $ifd0, $isBigEndian, true); + $pos = $this->_writeIFD($data, $pos, $offsetBase, $ifd1, $isBigEndian, false); + + return $data; + } + + /*************************************************************/ + function _writeIFD(&$data, $pos, $offsetBase, &$entries, $isBigEndian, $hasNext) + { + $tiffData = null; + $tiffDataOffsetPos = -1; + + $entryCount = count($entries); + + $dataPos = $pos + 2 + ($entryCount * 12) + 4; + $pos = $this->_putShort($data, $pos, $entryCount, $isBigEndian); + + for ($i = 0; $i < $entryCount; $i++) { + $tag = $entries[$i]['tag']; + $type = $entries[$i]['type']; + + if ($type == -99) { // SubIFD + $pos = $this->_putShort($data, $pos, $tag, $isBigEndian); + $pos = $this->_putShort($data, $pos, 0x04, $isBigEndian); // LONG + $pos = $this->_putLong($data, $pos, 0x01, $isBigEndian); // Count = 1 + $pos = $this->_putLong($data, $pos, $dataPos - $offsetBase, $isBigEndian); + + $dataPos = $this->_writeIFD($data, $dataPos, $offsetBase, $entries[$i]['value'], $isBigEndian, false); + } + elseif ($type == -98) { // TIFF Data + $pos = $this->_putShort($data, $pos, $tag, $isBigEndian); + $pos = $this->_putShort($data, $pos, 0x04, $isBigEndian); // LONG + $pos = $this->_putLong($data, $pos, 0x01, $isBigEndian); // Count = 1 + $tiffDataOffsetPos = $pos; + $pos = $this->_putLong($data, $pos, 0x00, $isBigEndian); // For Now + $tiffData =& $entries[$i]['value'] ; + } + else { // Regular Entry + $pos = $this->_putShort($data, $pos, $tag, $isBigEndian); + $pos = $this->_putShort($data, $pos, $type, $isBigEndian); + $pos = $this->_putLong($data, $pos, $entries[$i]['count'], $isBigEndian); + if (strlen($entries[$i]['value']) > 4) { + $pos = $this->_putLong($data, $pos, $dataPos - $offsetBase, $isBigEndian); + $dataPos = $this->_putString($data, $dataPos, $entries[$i]['value']); + } + else { + $val = str_pad($entries[$i]['value'], 4, "\0"); + $pos = $this->_putString($data, $pos, $val); + } + } + } + + if ($tiffData != null) { + $this->_putLong($data, $tiffDataOffsetPos, $dataPos - $offsetBase, $isBigEndian); + $dataPos = $this->_putString($data, $dataPos, $tiffData); + } + + if ($hasNext) { + $pos = $this->_putLong($data, $pos, $dataPos - $offsetBase, $isBigEndian); + } + else { + $pos = $this->_putLong($data, $pos, 0, $isBigEndian); + } + + return $dataPos; + } + + /*************************************************************/ + function & _getIFDEntries($isBigEndian, $mode) + { + $EXIFNames = $this->_exifTagNames($mode); + $EXIFTags = $this->_exifNameTags($mode); + $EXIFTypeInfo = $this->_exifTagTypes($mode); + + $ifdEntries = array(); + $entryCount = 0; + + reset($EXIFNames); + while (list($tag, $name) = each($EXIFNames)) { + $type = $EXIFTypeInfo[$tag][0]; + $count = $EXIFTypeInfo[$tag][1]; + $value = null; + + if (($mode == 'ifd0') && ($tag == 0x8769)) { // ExifIFDOffset + if (isset($this->_info['exif']['EXIFVersion'])) { + $value =& $this->_getIFDEntries($isBigEndian, "exif"); + $type = -99; + } + else { + $value = null; + } + } + elseif (($mode == 'ifd0') && ($tag == 0x8825)) { // GPSIFDOffset + if (isset($this->_info['exif']['GPSVersionID'])) { + $value =& $this->_getIFDEntries($isBigEndian, "gps"); + $type = -99; + } + else { + $value = null; + } + } + elseif (($mode == 'ifd1') && ($tag == 0x0111)) { // TIFFStripOffsets + if (isset($this->_info['exif']['TIFFStrips'])) { + $value =& $this->_info['exif']['TIFFStrips']; + $type = -98; + } + else { + $value = null; + } + } + elseif (($mode == 'ifd1') && ($tag == 0x0117)) { // TIFFStripByteCounts + if (isset($this->_info['exif']['TIFFStrips'])) { + $value = strlen($this->_info['exif']['TIFFStrips']); + } + else { + $value = null; + } + } + elseif (($mode == 'ifd1') && ($tag == 0x0201)) { // TIFFJFIFOffset + if (isset($this->_info['exif']['JFIFThumbnail'])) { + $value =& $this->_info['exif']['JFIFThumbnail']; + $type = -98; + } + else { + $value = null; + } + } + elseif (($mode == 'ifd1') && ($tag == 0x0202)) { // TIFFJFIFLength + if (isset($this->_info['exif']['JFIFThumbnail'])) { + $value = strlen($this->_info['exif']['JFIFThumbnail']); + } + else { + $value = null; + } + } + elseif (($mode == 'exif') && ($tag == 0xA005)) { // InteropIFDOffset + if (isset($this->_info['exif']['InteroperabilityIndex'])) { + $value =& $this->_getIFDEntries($isBigEndian, "interop"); + $type = -99; + } + else { + $value = null; + } + } + elseif (isset($this->_info['exif'][$name])) { + $origValue =& $this->_info['exif'][$name]; + + // This makes it easier to process variable size elements + if (!is_array($origValue) || isset($origValue['val'])) { + unset($origValue); // Break the reference + $origValue = array($this->_info['exif'][$name]); + } + $origCount = count($origValue); + + if ($origCount == 0 ) { + $type = -1; // To ignore this field + } + + $value = " "; + + switch ($type) { + case 1: // UBYTE + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + + $this->_putByte($value, $j, $origValue[$j]); + $j++; + } + + while ($j < $count) { + $this->_putByte($value, $j, 0); + $j++; + } + break; + case 2: // ASCII + $v = strval($origValue[0]); + if (($count != 0) && (strlen($v) > $count)) { + $v = substr($v, 0, $count); + } + elseif (($count > 0) && (strlen($v) < $count)) { + $v = str_pad($v, $count, "\0"); + } + + $count = strlen($v); + + $this->_putString($value, 0, $v); + break; + case 3: // USHORT + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $this->_putShort($value, $j * 2, $origValue[$j], $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putShort($value, $j * 2, 0, $isBigEndian); + $j++; + } + break; + case 4: // ULONG + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $this->_putLong($value, $j * 4, $origValue[$j], $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putLong($value, $j * 4, 0, $isBigEndian); + $j++; + } + break; + case 5: // URATIONAL + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $v = $origValue[$j]; + if (is_array($v)) { + $a = $v['num']; + $b = $v['den']; + } + else { + $a = 0; + $b = 0; + // TODO: Allow other types and convert them + } + $this->_putLong($value, $j * 8, $a, $isBigEndian); + $this->_putLong($value, ($j * 8) + 4, $b, $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putLong($value, $j * 8, 0, $isBigEndian); + $this->_putLong($value, ($j * 8) + 4, 0, $isBigEndian); + $j++; + } + break; + case 6: // SBYTE + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $this->_putByte($value, $j, $origValue[$j]); + $j++; + } + + while ($j < $count) { + $this->_putByte($value, $j, 0); + $j++; + } + break; + case 7: // UNDEFINED + $v = strval($origValue[0]); + if (($count != 0) && (strlen($v) > $count)) { + $v = substr($v, 0, $count); + } + elseif (($count > 0) && (strlen($v) < $count)) { + $v = str_pad($v, $count, "\0"); + } + + $count = strlen($v); + + $this->_putString($value, 0, $v); + break; + case 8: // SSHORT + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $this->_putShort($value, $j * 2, $origValue[$j], $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putShort($value, $j * 2, 0, $isBigEndian); + $j++; + } + break; + case 9: // SLONG + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $this->_putLong($value, $j * 4, $origValue[$j], $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putLong($value, $j * 4, 0, $isBigEndian); + $j++; + } + break; + case 10: // SRATIONAL + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $v = $origValue[$j]; + if (is_array($v)) { + $a = $v['num']; + $b = $v['den']; + } + else { + $a = 0; + $b = 0; + // TODO: Allow other types and convert them + } + + $this->_putLong($value, $j * 8, $a, $isBigEndian); + $this->_putLong($value, ($j * 8) + 4, $b, $isBigEndian); + $j++; + } + + while ($j < $count) { + $this->_putLong($value, $j * 8, 0, $isBigEndian); + $this->_putLong($value, ($j * 8) + 4, 0, $isBigEndian); + $j++; + } + break; + case 11: // FLOAT + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $v = strval($origValue[$j]); + if (strlen($v) > 4) { + $v = substr($v, 0, 4); + } + elseif (strlen($v) < 4) { + $v = str_pad($v, 4, "\0"); + } + $this->_putString($value, $j * 4, $v); + $j++; + } + + while ($j < $count) { + $this->_putString($value, $j * 4, "\0\0\0\0"); + $j++; + } + break; + case 12: // DFLOAT + if ($count == 0) { + $count = $origCount; + } + + $j = 0; + while (($j < $count) && ($j < $origCount)) { + $v = strval($origValue[$j]); + if (strlen($v) > 8) { + $v = substr($v, 0, 8); + } + elseif (strlen($v) < 8) { + $v = str_pad($v, 8, "\0"); + } + $this->_putString($value, $j * 8, $v); + $j++; + } + + while ($j < $count) { + $this->_putString($value, $j * 8, "\0\0\0\0\0\0\0\0"); + $j++; + } + break; + default: + $value = null; + break; + } + } + + if ($value != null) { + $ifdEntries[$entryCount] = array(); + $ifdEntries[$entryCount]['tag'] = $tag; + $ifdEntries[$entryCount]['type'] = $type; + $ifdEntries[$entryCount]['count'] = $count; + $ifdEntries[$entryCount]['value'] = $value; + + $entryCount++; + } + } + + return $ifdEntries; + } + + /*************************************************************/ + function _parseMarkerAdobe() + { + if (!isset($this->_markers)) { + $this->_readJPEG(); + } + + if ($this->_markers == null) { + return false; + } + + $data = null; + $count = count($this->_markers); + for ($i = 0; $i < $count; $i++) { + if ($this->_markers[$i]['marker'] == 0xED) { + $signature = $this->_getFixedString($this->_markers[$i]['data'], 0, 14); + if ($signature == "Photoshop 3.0\0") { + $data =& $this->_markers[$i]['data']; + break; + } + } + } + + if ($data == null) { + $this->_info['adobe'] = false; + $this->_info['iptc'] = false; + return false; + } + $pos = 14; + $this->_info['adobe'] = array(); + $this->_info['adobe']['raw'] = array(); + $this->_info['iptc'] = array(); + + $datasize = strlen($data); + + while ($pos < $datasize) { + $signature = $this->_getFixedString($data, $pos, 4); + if ($signature != '8BIM') + return false; + $pos += 4; + + $type = $this->_getShort($data, $pos); + $pos += 2; + + $strlen = $this->_getByte($data, $pos); + $pos += 1; + $header = ''; + for ($i = 0; $i < $strlen; $i++) { + $header .= $data{$pos + $i}; + } + $pos += $strlen + 1 - ($strlen % 2); // The string is padded to even length, counting the length byte itself + + $length = $this->_getLong($data, $pos); + $pos += 4; + + $basePos = $pos; + + switch ($type) { + case 0x0404: // Caption (IPTC Data) + $pos = $this->_readIPTC($data, $pos); + if ($pos == false) + return false; + break; + case 0x040A: // CopyrightFlag + $this->_info['adobe']['CopyrightFlag'] = $this->_getByte($data, $pos); + $pos += $length; + break; + case 0x040B: // ImageURL + $this->_info['adobe']['ImageURL'] = $this->_getFixedString($data, $pos, $length); + $pos += $length; + break; + case 0x040C: // Thumbnail + $aux = $this->_getLong($data, $pos); + $pos += 4; + if ($aux == 1) { + $this->_info['adobe']['ThumbnailWidth'] = $this->_getLong($data, $pos); + $pos += 4; + $this->_info['adobe']['ThumbnailHeight'] = $this->_getLong($data, $pos); + $pos += 4; + + $pos += 16; // Skip some data + + $this->_info['adobe']['ThumbnailData'] = $this->_getFixedString($data, $pos, $length - 28); + $pos += $length - 28; + } + break; + default: + break; + } + + // We save all blocks, even those we recognized + $label = sprintf('8BIM_0x%04x', $type); + $this->_info['adobe']['raw'][$label] = array(); + $this->_info['adobe']['raw'][$label]['type'] = $type; + $this->_info['adobe']['raw'][$label]['header'] = $header; + $this->_info['adobe']['raw'][$label]['data'] =& $this->_getFixedString($data, $basePos, $length); + + $pos = $basePos + $length + ($length % 2); // Even padding + } + + } + + /*************************************************************/ + function _readIPTC(&$data, $pos = 0) + { + $totalLength = strlen($data); + + $IPTCTags =& $this->_iptcTagNames(); + + while ($pos < ($totalLength - 5)) { + $signature = $this->_getShort($data, $pos); + if ($signature != 0x1C02) + return $pos; + $pos += 2; + + $type = $this->_getByte($data, $pos); + $pos += 1; + $length = $this->_getShort($data, $pos); + $pos += 2; + + $basePos = $pos; + $label = ''; + + if (isset($IPTCTags[$type])) { + $label = $IPTCTags[$type]; + } + else { + $label = sprintf('IPTC_0x%02x', $type); + } + + if ($label != '') { + if (isset($this->_info['iptc'][$label])) { + if (!is_array($this->_info['iptc'][$label])) { + $aux = array(); + $aux[0] = $this->_info['iptc'][$label]; + $this->_info['iptc'][$label] = $aux; + } + $this->_info['iptc'][$label][ count($this->_info['iptc'][$label]) ] = $this->_getFixedString($data, $pos, $length); + } + else { + $this->_info['iptc'][$label] = $this->_getFixedString($data, $pos, $length); + } + } + + $pos = $basePos + $length; // No padding + } + return $pos; + } + + /*************************************************************/ + function & _createMarkerAdobe() + { + if (isset($this->_info['iptc'])) { + if (!isset($this->_info['adobe'])) { + $this->_info['adobe'] = array(); + } + if (!isset($this->_info['adobe']['raw'])) { + $this->_info['adobe']['raw'] = array(); + } + if (!isset($this->_info['adobe']['raw']['8BIM_0x0404'])) { + $this->_info['adobe']['raw']['8BIM_0x0404'] = array(); + } + $this->_info['adobe']['raw']['8BIM_0x0404']['type'] = 0x0404; + $this->_info['adobe']['raw']['8BIM_0x0404']['header'] = "Caption"; + $this->_info['adobe']['raw']['8BIM_0x0404']['data'] =& $this->_writeIPTC(); + } + + if (isset($this->_info['adobe']['raw']) && (count($this->_info['adobe']['raw']) > 0)) { + $data = "Photoshop 3.0\0"; + $pos = 14; + + reset($this->_info['adobe']['raw']); + while (list($key) = each($this->_info['adobe']['raw'])) { + $pos = $this->_write8BIM( + $data, + $pos, + $this->_info['adobe']['raw'][$key]['type'], + $this->_info['adobe']['raw'][$key]['header'], + $this->_info['adobe']['raw'][$key]['data'] ); + } + } + + return $data; + } + + /*************************************************************/ + function _write8BIM(&$data, $pos, $type, $header, &$value) + { + $signature = "8BIM"; + + $pos = $this->_putString($data, $pos, $signature); + $pos = $this->_putShort($data, $pos, $type); + + $len = strlen($header); + + $pos = $this->_putByte($data, $pos, $len); + $pos = $this->_putString($data, $pos, $header); + if (($len % 2) == 0) { // Even padding, including the length byte + $pos = $this->_putByte($data, $pos, 0); + } + + $len = strlen($value); + $pos = $this->_putLong($data, $pos, $len); + $pos = $this->_putString($data, $pos, $value); + if (($len % 2) != 0) { // Even padding + $pos = $this->_putByte($data, $pos, 0); + } + return $pos; + } + + /*************************************************************/ + function & _writeIPTC() + { + $data = " "; + $pos = 0; + + $IPTCNames =& $this->_iptcNameTags(); + + reset($this->_info['iptc']); + + + while (list($label) = each($this->_info['iptc'])) { + $value =& $this->_info['iptc'][$label]; + $type = -1; + + if (isset($IPTCNames[$label])) { + $type = $IPTCNames[$label]; + } + elseif (substr($label, 0, 7) == "IPTC_0x") { + $type = hexdec(substr($label, 7, 2)); + } + + if ($type != -1) { + if (is_array($value)) { + for ($i = 0; $i < count($value); $i++) { + $pos = $this->_writeIPTCEntry($data, $pos, $type, $value[$i]); + } + } + else { + $pos = $this->_writeIPTCEntry($data, $pos, $type, $value); + } + } + } + + return $data; + } + + /*************************************************************/ + function _writeIPTCEntry(&$data, $pos, $type, &$value) + { + $pos = $this->_putShort($data, $pos, 0x1C02); + $pos = $this->_putByte($data, $pos, $type); + $pos = $this->_putShort($data, $pos, strlen($value)); + $pos = $this->_putString($data, $pos, $value); + + return $pos; + } + + /*************************************************************/ + function _exifTagNames($mode) + { + $tags = array(); + + if ($mode == 'ifd0') { + $tags[0x010E] = 'ImageDescription'; + $tags[0x010F] = 'Make'; + $tags[0x0110] = 'Model'; + $tags[0x0112] = 'Orientation'; + $tags[0x011A] = 'XResolution'; + $tags[0x011B] = 'YResolution'; + $tags[0x0128] = 'ResolutionUnit'; + $tags[0x0131] = 'Software'; + $tags[0x0132] = 'DateTime'; + $tags[0x013B] = 'Artist'; + $tags[0x013E] = 'WhitePoint'; + $tags[0x013F] = 'PrimaryChromaticities'; + $tags[0x0211] = 'YCbCrCoefficients'; + $tags[0x0212] = 'YCbCrSubSampling'; + $tags[0x0213] = 'YCbCrPositioning'; + $tags[0x0214] = 'ReferenceBlackWhite'; + $tags[0x8298] = 'Copyright'; + $tags[0x8769] = 'ExifIFDOffset'; + $tags[0x8825] = 'GPSIFDOffset'; + } + if ($mode == 'ifd1') { + $tags[0x00FE] = 'TIFFNewSubfileType'; + $tags[0x00FF] = 'TIFFSubfileType'; + $tags[0x0100] = 'TIFFImageWidth'; + $tags[0x0101] = 'TIFFImageHeight'; + $tags[0x0102] = 'TIFFBitsPerSample'; + $tags[0x0103] = 'TIFFCompression'; + $tags[0x0106] = 'TIFFPhotometricInterpretation'; + $tags[0x0107] = 'TIFFThreshholding'; + $tags[0x0108] = 'TIFFCellWidth'; + $tags[0x0109] = 'TIFFCellLength'; + $tags[0x010A] = 'TIFFFillOrder'; + $tags[0x010E] = 'TIFFImageDescription'; + $tags[0x010F] = 'TIFFMake'; + $tags[0x0110] = 'TIFFModel'; + $tags[0x0111] = 'TIFFStripOffsets'; + $tags[0x0112] = 'TIFFOrientation'; + $tags[0x0115] = 'TIFFSamplesPerPixel'; + $tags[0x0116] = 'TIFFRowsPerStrip'; + $tags[0x0117] = 'TIFFStripByteCounts'; + $tags[0x0118] = 'TIFFMinSampleValue'; + $tags[0x0119] = 'TIFFMaxSampleValue'; + $tags[0x011A] = 'TIFFXResolution'; + $tags[0x011B] = 'TIFFYResolution'; + $tags[0x011C] = 'TIFFPlanarConfiguration'; + $tags[0x0122] = 'TIFFGrayResponseUnit'; + $tags[0x0123] = 'TIFFGrayResponseCurve'; + $tags[0x0128] = 'TIFFResolutionUnit'; + $tags[0x0131] = 'TIFFSoftware'; + $tags[0x0132] = 'TIFFDateTime'; + $tags[0x013B] = 'TIFFArtist'; + $tags[0x013C] = 'TIFFHostComputer'; + $tags[0x0140] = 'TIFFColorMap'; + $tags[0x0152] = 'TIFFExtraSamples'; + $tags[0x0201] = 'TIFFJFIFOffset'; + $tags[0x0202] = 'TIFFJFIFLength'; + $tags[0x0211] = 'TIFFYCbCrCoefficients'; + $tags[0x0212] = 'TIFFYCbCrSubSampling'; + $tags[0x0213] = 'TIFFYCbCrPositioning'; + $tags[0x0214] = 'TIFFReferenceBlackWhite'; + $tags[0x8298] = 'TIFFCopyright'; + $tags[0x9286] = 'TIFFUserComment'; + } + elseif ($mode == 'exif') { + $tags[0x829A] = 'ExposureTime'; + $tags[0x829D] = 'FNumber'; + $tags[0x8822] = 'ExposureProgram'; + $tags[0x8824] = 'SpectralSensitivity'; + $tags[0x8827] = 'ISOSpeedRatings'; + $tags[0x8828] = 'OECF'; + $tags[0x9000] = 'EXIFVersion'; + $tags[0x9003] = 'DatetimeOriginal'; + $tags[0x9004] = 'DatetimeDigitized'; + $tags[0x9101] = 'ComponentsConfiguration'; + $tags[0x9102] = 'CompressedBitsPerPixel'; + $tags[0x9201] = 'ShutterSpeedValue'; + $tags[0x9202] = 'ApertureValue'; + $tags[0x9203] = 'BrightnessValue'; + $tags[0x9204] = 'ExposureBiasValue'; + $tags[0x9205] = 'MaxApertureValue'; + $tags[0x9206] = 'SubjectDistance'; + $tags[0x9207] = 'MeteringMode'; + $tags[0x9208] = 'LightSource'; + $tags[0x9209] = 'Flash'; + $tags[0x920A] = 'FocalLength'; + $tags[0x927C] = 'MakerNote'; + $tags[0x9286] = 'UserComment'; + $tags[0x9290] = 'SubSecTime'; + $tags[0x9291] = 'SubSecTimeOriginal'; + $tags[0x9292] = 'SubSecTimeDigitized'; + $tags[0xA000] = 'FlashPixVersion'; + $tags[0xA001] = 'ColorSpace'; + $tags[0xA002] = 'PixelXDimension'; + $tags[0xA003] = 'PixelYDimension'; + $tags[0xA004] = 'RelatedSoundFile'; + $tags[0xA005] = 'InteropIFDOffset'; + $tags[0xA20B] = 'FlashEnergy'; + $tags[0xA20C] = 'SpatialFrequencyResponse'; + $tags[0xA20E] = 'FocalPlaneXResolution'; + $tags[0xA20F] = 'FocalPlaneYResolution'; + $tags[0xA210] = 'FocalPlaneResolutionUnit'; + $tags[0xA214] = 'SubjectLocation'; + $tags[0xA215] = 'ExposureIndex'; + $tags[0xA217] = 'SensingMethod'; + $tags[0xA300] = 'FileSource'; + $tags[0xA301] = 'SceneType'; + $tags[0xA302] = 'CFAPattern'; + } + elseif ($mode == 'interop') { + $tags[0x0001] = 'InteroperabilityIndex'; + $tags[0x0002] = 'InteroperabilityVersion'; + $tags[0x1000] = 'RelatedImageFileFormat'; + $tags[0x1001] = 'RelatedImageWidth'; + $tags[0x1002] = 'RelatedImageLength'; + } + elseif ($mode == 'gps') { + $tags[0x0000] = 'GPSVersionID'; + $tags[0x0001] = 'GPSLatitudeRef'; + $tags[0x0002] = 'GPSLatitude'; + $tags[0x0003] = 'GPSLongitudeRef'; + $tags[0x0004] = 'GPSLongitude'; + $tags[0x0005] = 'GPSAltitudeRef'; + $tags[0x0006] = 'GPSAltitude'; + $tags[0x0007] = 'GPSTimeStamp'; + $tags[0x0008] = 'GPSSatellites'; + $tags[0x0009] = 'GPSStatus'; + $tags[0x000A] = 'GPSMeasureMode'; + $tags[0x000B] = 'GPSDOP'; + $tags[0x000C] = 'GPSSpeedRef'; + $tags[0x000D] = 'GPSSpeed'; + $tags[0x000E] = 'GPSTrackRef'; + $tags[0x000F] = 'GPSTrack'; + $tags[0x0010] = 'GPSImgDirectionRef'; + $tags[0x0011] = 'GPSImgDirection'; + $tags[0x0012] = 'GPSMapDatum'; + $tags[0x0013] = 'GPSDestLatitudeRef'; + $tags[0x0014] = 'GPSDestLatitude'; + $tags[0x0015] = 'GPSDestLongitudeRef'; + $tags[0x0016] = 'GPSDestLongitude'; + $tags[0x0017] = 'GPSDestBearingRef'; + $tags[0x0018] = 'GPSDestBearing'; + $tags[0x0019] = 'GPSDestDistanceRef'; + $tags[0x001A] = 'GPSDestDistance'; + } + + return $tags; + } + + /*************************************************************/ + function _exifTagTypes($mode) + { + $tags = array(); + + if ($mode == 'ifd0') { + $tags[0x010E] = array(2, 0); // ImageDescription -> ASCII, Any + $tags[0x010F] = array(2, 0); // Make -> ASCII, Any + $tags[0x0110] = array(2, 0); // Model -> ASCII, Any + $tags[0x0112] = array(3, 1); // Orientation -> SHORT, 1 + $tags[0x011A] = array(5, 1); // XResolution -> RATIONAL, 1 + $tags[0x011B] = array(5, 1); // YResolution -> RATIONAL, 1 + $tags[0x0128] = array(3, 1); // ResolutionUnit -> SHORT + $tags[0x0131] = array(2, 0); // Software -> ASCII, Any + $tags[0x0132] = array(2, 20); // DateTime -> ASCII, 20 + $tags[0x013B] = array(2, 0); // Artist -> ASCII, Any + $tags[0x013E] = array(5, 2); // WhitePoint -> RATIONAL, 2 + $tags[0x013F] = array(5, 6); // PrimaryChromaticities -> RATIONAL, 6 + $tags[0x0211] = array(5, 3); // YCbCrCoefficients -> RATIONAL, 3 + $tags[0x0212] = array(3, 2); // YCbCrSubSampling -> SHORT, 2 + $tags[0x0213] = array(3, 1); // YCbCrPositioning -> SHORT, 1 + $tags[0x0214] = array(5, 6); // ReferenceBlackWhite -> RATIONAL, 6 + $tags[0x8298] = array(2, 0); // Copyright -> ASCII, Any + $tags[0x8769] = array(4, 1); // ExifIFDOffset -> LONG, 1 + $tags[0x8825] = array(4, 1); // GPSIFDOffset -> LONG, 1 + } + if ($mode == 'ifd1') { + $tags[0x00FE] = array(4, 1); // TIFFNewSubfileType -> LONG, 1 + $tags[0x00FF] = array(3, 1); // TIFFSubfileType -> SHORT, 1 + $tags[0x0100] = array(4, 1); // TIFFImageWidth -> LONG (or SHORT), 1 + $tags[0x0101] = array(4, 1); // TIFFImageHeight -> LONG (or SHORT), 1 + $tags[0x0102] = array(3, 3); // TIFFBitsPerSample -> SHORT, 3 + $tags[0x0103] = array(3, 1); // TIFFCompression -> SHORT, 1 + $tags[0x0106] = array(3, 1); // TIFFPhotometricInterpretation -> SHORT, 1 + $tags[0x0107] = array(3, 1); // TIFFThreshholding -> SHORT, 1 + $tags[0x0108] = array(3, 1); // TIFFCellWidth -> SHORT, 1 + $tags[0x0109] = array(3, 1); // TIFFCellLength -> SHORT, 1 + $tags[0x010A] = array(3, 1); // TIFFFillOrder -> SHORT, 1 + $tags[0x010E] = array(2, 0); // TIFFImageDescription -> ASCII, Any + $tags[0x010F] = array(2, 0); // TIFFMake -> ASCII, Any + $tags[0x0110] = array(2, 0); // TIFFModel -> ASCII, Any + $tags[0x0111] = array(4, 0); // TIFFStripOffsets -> LONG (or SHORT), Any (one per strip) + $tags[0x0112] = array(3, 1); // TIFFOrientation -> SHORT, 1 + $tags[0x0115] = array(3, 1); // TIFFSamplesPerPixel -> SHORT, 1 + $tags[0x0116] = array(4, 1); // TIFFRowsPerStrip -> LONG (or SHORT), 1 + $tags[0x0117] = array(4, 0); // TIFFStripByteCounts -> LONG (or SHORT), Any (one per strip) + $tags[0x0118] = array(3, 0); // TIFFMinSampleValue -> SHORT, Any (SamplesPerPixel) + $tags[0x0119] = array(3, 0); // TIFFMaxSampleValue -> SHORT, Any (SamplesPerPixel) + $tags[0x011A] = array(5, 1); // TIFFXResolution -> RATIONAL, 1 + $tags[0x011B] = array(5, 1); // TIFFYResolution -> RATIONAL, 1 + $tags[0x011C] = array(3, 1); // TIFFPlanarConfiguration -> SHORT, 1 + $tags[0x0122] = array(3, 1); // TIFFGrayResponseUnit -> SHORT, 1 + $tags[0x0123] = array(3, 0); // TIFFGrayResponseCurve -> SHORT, Any (2^BitsPerSample) + $tags[0x0128] = array(3, 1); // TIFFResolutionUnit -> SHORT, 1 + $tags[0x0131] = array(2, 0); // TIFFSoftware -> ASCII, Any + $tags[0x0132] = array(2, 20); // TIFFDateTime -> ASCII, 20 + $tags[0x013B] = array(2, 0); // TIFFArtist -> ASCII, Any + $tags[0x013C] = array(2, 0); // TIFFHostComputer -> ASCII, Any + $tags[0x0140] = array(3, 0); // TIFFColorMap -> SHORT, Any (3 * 2^BitsPerSample) + $tags[0x0152] = array(3, 0); // TIFFExtraSamples -> SHORT, Any (SamplesPerPixel - 3) + $tags[0x0201] = array(4, 1); // TIFFJFIFOffset -> LONG, 1 + $tags[0x0202] = array(4, 1); // TIFFJFIFLength -> LONG, 1 + $tags[0x0211] = array(5, 3); // TIFFYCbCrCoefficients -> RATIONAL, 3 + $tags[0x0212] = array(3, 2); // TIFFYCbCrSubSampling -> SHORT, 2 + $tags[0x0213] = array(3, 1); // TIFFYCbCrPositioning -> SHORT, 1 + $tags[0x0214] = array(5, 6); // TIFFReferenceBlackWhite -> RATIONAL, 6 + $tags[0x8298] = array(2, 0); // TIFFCopyright -> ASCII, Any + $tags[0x9286] = array(2, 0); // TIFFUserComment -> ASCII, Any + } + elseif ($mode == 'exif') { + $tags[0x829A] = array(5, 1); // ExposureTime -> RATIONAL, 1 + $tags[0x829D] = array(5, 1); // FNumber -> RATIONAL, 1 + $tags[0x8822] = array(3, 1); // ExposureProgram -> SHORT, 1 + $tags[0x8824] = array(2, 0); // SpectralSensitivity -> ASCII, Any + $tags[0x8827] = array(3, 0); // ISOSpeedRatings -> SHORT, Any + $tags[0x8828] = array(7, 0); // OECF -> UNDEFINED, Any + $tags[0x9000] = array(7, 4); // EXIFVersion -> UNDEFINED, 4 + $tags[0x9003] = array(2, 20); // DatetimeOriginal -> ASCII, 20 + $tags[0x9004] = array(2, 20); // DatetimeDigitized -> ASCII, 20 + $tags[0x9101] = array(7, 4); // ComponentsConfiguration -> UNDEFINED, 4 + $tags[0x9102] = array(5, 1); // CompressedBitsPerPixel -> RATIONAL, 1 + $tags[0x9201] = array(10, 1); // ShutterSpeedValue -> SRATIONAL, 1 + $tags[0x9202] = array(5, 1); // ApertureValue -> RATIONAL, 1 + $tags[0x9203] = array(10, 1); // BrightnessValue -> SRATIONAL, 1 + $tags[0x9204] = array(10, 1); // ExposureBiasValue -> SRATIONAL, 1 + $tags[0x9205] = array(5, 1); // MaxApertureValue -> RATIONAL, 1 + $tags[0x9206] = array(5, 1); // SubjectDistance -> RATIONAL, 1 + $tags[0x9207] = array(3, 1); // MeteringMode -> SHORT, 1 + $tags[0x9208] = array(3, 1); // LightSource -> SHORT, 1 + $tags[0x9209] = array(3, 1); // Flash -> SHORT, 1 + $tags[0x920A] = array(5, 1); // FocalLength -> RATIONAL, 1 + $tags[0x927C] = array(7, 0); // MakerNote -> UNDEFINED, Any + $tags[0x9286] = array(7, 0); // UserComment -> UNDEFINED, Any + $tags[0x9290] = array(2, 0); // SubSecTime -> ASCII, Any + $tags[0x9291] = array(2, 0); // SubSecTimeOriginal -> ASCII, Any + $tags[0x9292] = array(2, 0); // SubSecTimeDigitized -> ASCII, Any + $tags[0xA000] = array(7, 4); // FlashPixVersion -> UNDEFINED, 4 + $tags[0xA001] = array(3, 1); // ColorSpace -> SHORT, 1 + $tags[0xA002] = array(4, 1); // PixelXDimension -> LONG (or SHORT), 1 + $tags[0xA003] = array(4, 1); // PixelYDimension -> LONG (or SHORT), 1 + $tags[0xA004] = array(2, 13); // RelatedSoundFile -> ASCII, 13 + $tags[0xA005] = array(4, 1); // InteropIFDOffset -> LONG, 1 + $tags[0xA20B] = array(5, 1); // FlashEnergy -> RATIONAL, 1 + $tags[0xA20C] = array(7, 0); // SpatialFrequencyResponse -> UNDEFINED, Any + $tags[0xA20E] = array(5, 1); // FocalPlaneXResolution -> RATIONAL, 1 + $tags[0xA20F] = array(5, 1); // FocalPlaneYResolution -> RATIONAL, 1 + $tags[0xA210] = array(3, 1); // FocalPlaneResolutionUnit -> SHORT, 1 + $tags[0xA214] = array(3, 2); // SubjectLocation -> SHORT, 2 + $tags[0xA215] = array(5, 1); // ExposureIndex -> RATIONAL, 1 + $tags[0xA217] = array(3, 1); // SensingMethod -> SHORT, 1 + $tags[0xA300] = array(7, 1); // FileSource -> UNDEFINED, 1 + $tags[0xA301] = array(7, 1); // SceneType -> UNDEFINED, 1 + $tags[0xA302] = array(7, 0); // CFAPattern -> UNDEFINED, Any + } + elseif ($mode == 'interop') { + $tags[0x0001] = array(2, 0); // InteroperabilityIndex -> ASCII, Any + $tags[0x0002] = array(7, 4); // InteroperabilityVersion -> UNKNOWN, 4 + $tags[0x1000] = array(2, 0); // RelatedImageFileFormat -> ASCII, Any + $tags[0x1001] = array(4, 1); // RelatedImageWidth -> LONG (or SHORT), 1 + $tags[0x1002] = array(4, 1); // RelatedImageLength -> LONG (or SHORT), 1 + } + elseif ($mode == 'gps') { + $tags[0x0000] = array(1, 4); // GPSVersionID -> BYTE, 4 + $tags[0x0001] = array(2, 2); // GPSLatitudeRef -> ASCII, 2 + $tags[0x0002] = array(5, 3); // GPSLatitude -> RATIONAL, 3 + $tags[0x0003] = array(2, 2); // GPSLongitudeRef -> ASCII, 2 + $tags[0x0004] = array(5, 3); // GPSLongitude -> RATIONAL, 3 + $tags[0x0005] = array(2, 2); // GPSAltitudeRef -> ASCII, 2 + $tags[0x0006] = array(5, 1); // GPSAltitude -> RATIONAL, 1 + $tags[0x0007] = array(5, 3); // GPSTimeStamp -> RATIONAL, 3 + $tags[0x0008] = array(2, 0); // GPSSatellites -> ASCII, Any + $tags[0x0009] = array(2, 2); // GPSStatus -> ASCII, 2 + $tags[0x000A] = array(2, 2); // GPSMeasureMode -> ASCII, 2 + $tags[0x000B] = array(5, 1); // GPSDOP -> RATIONAL, 1 + $tags[0x000C] = array(2, 2); // GPSSpeedRef -> ASCII, 2 + $tags[0x000D] = array(5, 1); // GPSSpeed -> RATIONAL, 1 + $tags[0x000E] = array(2, 2); // GPSTrackRef -> ASCII, 2 + $tags[0x000F] = array(5, 1); // GPSTrack -> RATIONAL, 1 + $tags[0x0010] = array(2, 2); // GPSImgDirectionRef -> ASCII, 2 + $tags[0x0011] = array(5, 1); // GPSImgDirection -> RATIONAL, 1 + $tags[0x0012] = array(2, 0); // GPSMapDatum -> ASCII, Any + $tags[0x0013] = array(2, 2); // GPSDestLatitudeRef -> ASCII, 2 + $tags[0x0014] = array(5, 3); // GPSDestLatitude -> RATIONAL, 3 + $tags[0x0015] = array(2, 2); // GPSDestLongitudeRef -> ASCII, 2 + $tags[0x0016] = array(5, 3); // GPSDestLongitude -> RATIONAL, 3 + $tags[0x0017] = array(2, 2); // GPSDestBearingRef -> ASCII, 2 + $tags[0x0018] = array(5, 1); // GPSDestBearing -> RATIONAL, 1 + $tags[0x0019] = array(2, 2); // GPSDestDistanceRef -> ASCII, 2 + $tags[0x001A] = array(5, 1); // GPSDestDistance -> RATIONAL, 1 + } + + return $tags; + } + + /*************************************************************/ + function _exifNameTags($mode) + { + $tags = $this->_exifTagNames($mode); + return $this->_names2Tags($tags); + } + + /*************************************************************/ + function _iptcTagNames() + { + $tags = array(); + $tags[0x14] = 'SuplementalCategories'; + $tags[0x19] = 'Keywords'; + $tags[0x78] = 'Caption'; + $tags[0x7A] = 'CaptionWriter'; + $tags[0x69] = 'Headline'; + $tags[0x28] = 'SpecialInstructions'; + $tags[0x0F] = 'Category'; + $tags[0x50] = 'Byline'; + $tags[0x55] = 'BylineTitle'; + $tags[0x6E] = 'Credit'; + $tags[0x73] = 'Source'; + $tags[0x74] = 'CopyrightNotice'; + $tags[0x05] = 'ObjectName'; + $tags[0x5A] = 'City'; + $tags[0x5C] = 'Sublocation'; + $tags[0x5F] = 'ProvinceState'; + $tags[0x65] = 'CountryName'; + $tags[0x67] = 'OriginalTransmissionReference'; + $tags[0x37] = 'DateCreated'; + $tags[0x0A] = 'CopyrightFlag'; + + return $tags; + } + + /*************************************************************/ + function & _iptcNameTags() + { + $tags = $this->_iptcTagNames(); + return $this->_names2Tags($tags); + } + + /*************************************************************/ + function _names2Tags($tags2Names) + { + $names2Tags = array(); + reset($tags2Names); + while (list($tag, $name) = each($tags2Names)) { + $names2Tags[$name] = $tag; + } + + return $names2Tags; + } + + /*************************************************************/ + function _getByte(&$data, $pos) + { + return ord($data{$pos}); + } + + /*************************************************************/ + function _putByte(&$data, $pos, $val) + { + $val = intval($val); + + $data{$pos} = chr($val); + + return $pos + 1; + } + + /*************************************************************/ + function _getShort(&$data, $pos, $bigEndian = true) + { + if ($bigEndian) { + return (ord($data{$pos}) << 8) + + ord($data{$pos + 1}); + } + else { + return ord($data{$pos}) + + (ord($data{$pos + 1}) << 8); + } + } + + /*************************************************************/ + function _putShort(&$data, $pos = 0, $val, $bigEndian = true) + { + $val = intval($val); + + if ($bigEndian) { + $data{$pos + 0} = chr(($val & 0x0000FF00) >> 8); + $data{$pos + 1} = chr(($val & 0x000000FF) >> 0); + } + else { + $data{$pos + 0} = chr(($val & 0x00FF) >> 0); + $data{$pos + 1} = chr(($val & 0xFF00) >> 8); + } + + return $pos + 2; + } + + /*************************************************************/ + function _getLong(&$data, $pos, $bigEndian = true) + { + if ($bigEndian) { + return (ord($data{$pos}) << 24) + + (ord($data{$pos + 1}) << 16) + + (ord($data{$pos + 2}) << 8) + + ord($data{$pos + 3}); + } + else { + return ord($data{$pos}) + + (ord($data{$pos + 1}) << 8) + + (ord($data{$pos + 2}) << 16) + + (ord($data{$pos + 3}) << 24); + } + } + + /*************************************************************/ + function _putLong(&$data, $pos, $val, $bigEndian = true) + { + $val = intval($val); + + if ($bigEndian) { + $data{$pos + 0} = chr(($val & 0xFF000000) >> 24); + $data{$pos + 1} = chr(($val & 0x00FF0000) >> 16); + $data{$pos + 2} = chr(($val & 0x0000FF00) >> 8); + $data{$pos + 3} = chr(($val & 0x000000FF) >> 0); + } + else { + $data{$pos + 0} = chr(($val & 0x000000FF) >> 0); + $data{$pos + 1} = chr(($val & 0x0000FF00) >> 8); + $data{$pos + 2} = chr(($val & 0x00FF0000) >> 16); + $data{$pos + 3} = chr(($val & 0xFF000000) >> 24); + } + + return $pos + 4; + } + + /*************************************************************/ + function & _getNullString(&$data, $pos) + { + $str = ''; + $max = strlen($data); + + while ($pos < $max) { + if (ord($data{$pos}) == 0) { + return $str; + } + else { + $str .= $data{$pos}; + } + $pos++; + } + + return $str; + } + + /*************************************************************/ + function & _getFixedString(&$data, $pos, $length = -1) + { + if ($length == -1) { + $length = strlen($data) - $pos; + } + + return substr($data, $pos, $length); + } + + /*************************************************************/ + function _putString(&$data, $pos, &$str) + { + $len = strlen($str); + for ($i = 0; $i < $len; $i++) { + $data{$pos + $i} = $str{$i}; + } + + return $pos + $len; + } + + /*************************************************************/ + function _hexDump(&$data, $start = 0, $length = -1) + { + if (($length == -1) || (($length + $start) > strlen($data))) { + $end = strlen($data); + } + else { + $end = $start + $length; + } + + $ascii = ''; + $count = 0; + + echo "\n"; + + while ($start < $end) { + if (($count % 16) == 0) { + echo sprintf('%04d', $count) . ': '; + } + + $c = ord($data{$start}); + $count++; + $start++; + + $aux = dechex($c); + if (strlen($aux) == 1) + echo '0'; + echo $aux . ' '; + + if ($c == 60) + $ascii .= '<'; + elseif ($c == 62) + $ascii .= '>'; + elseif ($c == 32) + $ascii .= ' '; + elseif ($c > 32) + $ascii .= chr($c); + else + $ascii .= '.'; + + if (($count % 4) == 0) { + echo ' - '; + } + + if (($count % 16) == 0) { + echo ': ' . $ascii . "
\n"; + $ascii = ''; + } + } + + if ($ascii != '') { + while (($count % 16) != 0) { + echo '-- '; + $count++; + if (($count % 4) == 0) { + echo ' - '; + } + } + echo ': ' . $ascii . "
\n"; + } + + echo "
\n"; + } + +/*****************************************************************/ +} + +/* vim: set expandtab tabstop=4 shiftwidth=4: */ + diff --git a/plugins/dokuwiki/inc/cache.php b/plugins/dokuwiki/inc/cache.php new file mode 100644 index 0000000..4de19be --- /dev/null +++ b/plugins/dokuwiki/inc/cache.php @@ -0,0 +1,291 @@ + + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + +require_once(DOKU_INC.'inc/io.php'); +require_once(DOKU_INC.'inc/pageutils.php'); +require_once(DOKU_INC.'inc/parserutils.php'); + +class cache { + var $key = ''; // primary identifier for this item + var $ext = ''; // file ext for cache data, secondary identifier for this item + var $cache = ''; // cache file name + var $depends = array(); // array containing cache dependency information, + // used by _useCache to determine cache validity + + var $_event = ''; // event to be triggered during useCache + + function __construct($key,$ext) { + $this->key = $key; + $this->ext = $ext; + $this->cache = getCacheName($key,$ext); + } + + /** + * public method to determine whether the cache can be used + * + * to assist in cetralisation of event triggering and calculation of cache statistics, + * don't override this function override _useCache() + * + * @param array $depends array of cache dependencies, support dependecies: + * 'age' => max age of the cache in seconds + * 'files' => cache must be younger than mtime of each file + * (nb. dependency passes if file doesn't exist) + * + * @return bool true if cache can be used, false otherwise + */ + function useCache($depends=array()) { + $this->depends = $depends; + $this->_addDependencies(); + + if ($this->_event) { + return $this->_stats(trigger_event($this->_event,$this,array($this,'_useCache'))); + } else { + return $this->_stats($this->_useCache()); + } + } + + /** + * private method containing cache use decision logic + * + * this function processes the following keys in the depends array + * purge - force a purge on any non empty value + * age - expire cache if older than age (seconds) + * files - expire cache if any file in this array was updated more recently than the cache + * + * can be overridden + * + * @return bool see useCache() + */ + function _useCache() { + + if (!empty($this->depends['purge'])) return false; // purge requested? + if (!($this->_time = @filemtime($this->cache))) return false; // cache exists? + + // cache too old? + if (!empty($this->depends['age']) && ((time() - $this->_time) > $this->depends['age'])) return false; + + if (!empty($this->depends['files'])) { + foreach ($this->depends['files'] as $file) { + if ($this->_time < @filemtime($file)) return false; // cache older than files it depends on? + } + } + + return true; + } + + /** + * add dependencies to the depends array + * + * this method should only add dependencies, + * it should not remove any existing dependencies and + * it should only overwrite a dependency when the new value is more stringent than the old + */ + function _addDependencies() { + if (isset($_REQUEST['purge'])) $this->depends['purge'] = true; // purge requested + } + + /** + * retrieve the cached data + * + * @param bool $clean true to clean line endings, false to leave line endings alone + * @return string cache contents + */ + function retrieveCache($clean=true) { + return io_readFile($this->cache, $clean); + } + + /** + * cache $data + * + * @param string $data the data to be cached + * @return none + */ + function storeCache($data) { + io_savefile($this->cache, $data); + } + + /** + * remove any cached data associated with this cache instance + */ + function removeCache() { + @unlink($this->cache); + } + + /** + * Record cache hits statistics. + * (Only when debugging allowed, to reduce overhead.) + * + * @param bool $success result of this cache use attempt + * @return bool pass-thru $success value + */ + function _stats($success) { + global $conf; + static $stats = NULL; + static $file; + + if (!$conf['allowdebug']) { return $success; } + + if (is_null($stats)) { + $file = $conf['cachedir'].'/cache_stats.txt'; + $lines = explode("\n",io_readFile($file)); + + foreach ($lines as $line) { + $i = strpos($line,','); + $stats[substr($line,0,$i)] = $line; + } + } + + if (isset($stats[$this->ext])) { + list($ext,$count,$hits) = explode(',',$stats[$this->ext]); + } else { + $ext = $this->ext; + $count = 0; + $hits = 0; + } + + $count++; + if ($success) $hits++; + $stats[$this->ext] = "$ext,$count,$hits"; + + io_saveFile($file,join("\n",$stats)); + + return $success; + } +} + +class cache_parser extends cache { + + var $file = ''; // source file for cache + var $mode = ''; // input mode (represents the processing the input file will undergo) + + var $_event = 'PARSER_CACHE_USE'; + + function __construct($id, $file, $mode) { + if ($id) $this->page = $id; + $this->file = $file; + $this->mode = $mode; + + parent::__construct($file.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.'.$mode); + } + + function _useCache() { + + if (!@file_exists($this->file)) return false; // source exists? + return parent::_useCache(); + } + + function _addDependencies() { + global $conf; + + $this->depends['age'] = isset($this->depends['age']) ? + min($this->depends['age'],$conf['cachetime']) : $conf['cachetime']; + + // parser cache file dependencies ... + $files = array($this->file, // ... source + DOKU_CONF.'dokuwiki.php', // ... config + DOKU_CONF.'local.php', // ... local config + DOKU_INC.'inc/parser/parser.php', // ... parser + DOKU_INC.'inc/parser/handler.php', // ... handler + ); + + $this->depends['files'] = !empty($this->depends['files']) ? array_merge($files, $this->depends['files']) : $files; + parent::_addDependencies(); + } + +} + +class cache_renderer extends cache_parser { + + function useCache($depends=array()) { + $use = parent::useCache($depends); + + // meta data needs to be kept in step with the cache + if (!$use && isset($this->page)) { + p_set_metadata($this->page,array(),true); + } + + return $use; + } + + function _useCache() { + global $conf; + + if (!parent::_useCache()) return false; + + // for wiki pages, check metadata dependencies + if (isset($this->page)) { + $metadata = p_get_metadata($this->page); + + // check currnent link existence is consistent with cache version + // first check the purgefile + // - if the cache is more recent that the purgefile we know no links can have been updated + if ($this->_time < @filemtime($conf['cachedir'].'/purgefile')) { + +# $links = p_get_metadata($this->page,"relation references"); + $links = $metadata['relation']['references']; + + if (!empty($links)) { + foreach ($links as $id => $exists) { + if ($exists != @file_exists(wikiFN($id,'',false))) return false; + } + } + } + } + + return true; + } + + function _addDependencies() { + + // renderer cache file dependencies ... + $files = array( + DOKU_INC.'inc/parser/'.$this->mode.'.php', // ... the renderer + ); + + // page implies metadata and possibly some other dependencies + if (isset($this->page)) { + + $metafile = metaFN($this->page,'.meta'); + if (@file_exists($metafile)) { + $files[] = $metafile; // ... the page's own metadata + $files[] = DOKU_INC.'inc/parser/metadata.php'; // ... the metadata renderer + + $valid = p_get_metadata($this->page, 'date valid'); + if (!empty($valid['age'])) { + $this->depends['age'] = isset($this->depends['age']) ? + min($this->depends['age'],$valid['age']) : $valid['age']; + } + + } else { + $this->depends['purge'] = true; // ... purging cache will generate metadata + return; + } + } + + $this->depends['files'] = !empty($this->depends['files']) ? array_merge($files, $this->depends['files']) : $files; + parent::_addDependencies(); + } +} + +class cache_instructions extends cache_parser { + + function __construct($id, $file) { + parent::__construct($id, $file, 'i'); + } + + function retrieveCache($clean=true) { + $contents = io_readFile($this->cache, false); + return !empty($contents) ? unserialize($contents) : array(); + } + + function storeCache($instructions) { + io_savefile($this->cache,serialize($instructions)); + } +} diff --git a/plugins/dokuwiki/inc/common.php b/plugins/dokuwiki/inc/common.php new file mode 100644 index 0000000..dd4fa31 --- /dev/null +++ b/plugins/dokuwiki/inc/common.php @@ -0,0 +1,1009 @@ + + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +require_once(DOKU_CONF.'dokuwiki.php'); +require_once(DOKU_INC.'inc/io.php'); +require_once(DOKU_INC.'inc/utf8.php'); +require_once(DOKU_INC.'inc/parserutils.php'); +require_once(DOKU_INC.'inc/infoutils.php'); + +/** + * These constants are used with the recents function + */ +define('RECENTS_SKIP_DELETED',2); +define('RECENTS_SKIP_MINORS',4); +define('RECENTS_SKIP_SUBSPACES',8); + +/** + * Wrapper around htmlspecialchars() + * + * @author Andreas Gohr + * @see htmlspecialchars() + */ +function hsc($string){ + return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); +} + +/** + * print a newline terminated string + * + * You can give an indention as optional parameter + * + * @author Andreas Gohr + */ +function ptln($string,$intend=0){ + for($i=0; $i<$intend; $i++) print ' '; + echo "$string\n"; +} + +/** + * strips control characters (<32) from the given string + * + * @author Andreas Gohr + */ +function stripctl($string){ + return preg_replace('/[\x00-\x1F]+/s','',$string); +} + +/** + * Return info about the current document as associative + * array. + * + * @author Andreas Gohr + */ +function pageinfo(){ + global $ID; + global $REV; + global $USERINFO; + global $conf; + + // include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml + // FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary + $info['id'] = $ID; + $info['rev'] = $REV; + + if($_SERVER['REMOTE_USER']){ + $info['userinfo'] = $USERINFO; + $info['perm'] = auth_quickaclcheck($ID); + $info['subscribed'] = is_subscribed($ID,$_SERVER['REMOTE_USER']); + $info['client'] = $_SERVER['REMOTE_USER']; + + // if some outside auth were used only REMOTE_USER is set + if(!$info['userinfo']['name']){ + $info['userinfo']['name'] = $_SERVER['REMOTE_USER']; + } + + }else{ + $info['perm'] = auth_aclcheck($ID,'',null); + $info['subscribed'] = false; + $info['client'] = clientIP(true); + } + + $info['namespace'] = getNS($ID); + $info['locked'] = checklock($ID); + $info['filepath'] = realpath(wikiFN($ID)); + $info['exists'] = @file_exists($info['filepath']); + if($REV){ + //check if current revision was meant + if($info['exists'] && (@filemtime($info['filepath'])==$REV)){ + $REV = ''; + }else{ + //really use old revision + $info['filepath'] = realpath(wikiFN($ID,$REV)); + $info['exists'] = @file_exists($info['filepath']); + } + } + $info['rev'] = $REV; + if($info['exists']){ + $info['writable'] = (is_writable($info['filepath']) && + ($info['perm'] >= AUTH_EDIT)); + }else{ + $info['writable'] = ($info['perm'] >= AUTH_CREATE); + } + $info['editable'] = ($info['writable'] && empty($info['lock'])); + $info['lastmod'] = @filemtime($info['filepath']); + + //load page meta data + $info['meta'] = p_get_metadata($ID); + + //who's the editor + if($REV){ + $revinfo = getRevisionInfo($ID, $REV, 1024); + }else{ + $revinfo = isset($info['meta']['last_change']) ? $info['meta']['last_change'] : getRevisionInfo($ID,$info['lastmod'],1024); + } + + $info['ip'] = $revinfo['ip']; + $info['user'] = $revinfo['user']; + $info['sum'] = $revinfo['sum']; + // See also $INFO['meta']['last_change'] which is the most recent log line for page $ID. + // Use $INFO['meta']['last_change']['type']==='e' in place of $info['minor']. + + if($revinfo['user']){ + $info['editor'] = $revinfo['user']; + }else{ + $info['editor'] = $revinfo['ip']; + } + + // draft + $draft = getCacheName($info['client'].$ID,'.draft'); + if(@file_exists($draft)){ + if(@filemtime($draft) < @filemtime(wikiFN($ID))){ + // remove stale draft + @unlink($draft); + }else{ + $info['draft'] = $draft; + } + } + + return $info; +} + +/** + * Build an string of URL parameters + * + * @author Andreas Gohr + */ +function buildURLparams($params, $sep='&'){ + $url = ''; + $amp = false; + foreach($params as $key => $val){ + if($amp) $url .= $sep; + + $url .= $key.'='; + $url .= rawurlencode($val); + $amp = true; + } + return $url; +} + +/** + * Build an string of html tag attributes + * + * Skips keys starting with '_', values get HTML encoded + * + * @author Andreas Gohr + */ +function buildAttributes($params){ + $url = ''; + foreach($params as $key => $val){ + if($key{0} == '_') continue; + + $url .= $key.'="'; + $url .= htmlspecialchars ($val); + $url .= '" '; + } + return $url; +} + + +/** + * This builds the breadcrumb trail and returns it as array + * + * @author Andreas Gohr + */ +function breadcrumbs(){ + // we prepare the breadcrumbs early for quick session closing + static $crumbs = null; + if($crumbs != null) return $crumbs; + + global $ID; + global $ACT; + global $conf; + $crumbs = $_SESSION[DOKU_COOKIE]['bc']; + + //first visit? + if (!is_array($crumbs)){ + $crumbs = array(); + } + //we only save on show and existing wiki documents + $file = wikiFN($ID); + if($ACT != 'show' || !@file_exists($file)){ + $_SESSION[DOKU_COOKIE]['bc'] = $crumbs; + return $crumbs; + } + + // page names + $name = noNS($ID); + if ($conf['useheading']) { + // get page title + $title = p_get_first_heading($ID); + if ($title) { + $name = $title; + } + } + + //remove ID from array + if (isset($crumbs[$ID])) { + unset($crumbs[$ID]); + } + + //add to array + $crumbs[$ID] = $name; + //reduce size + while(count($crumbs) > $conf['breadcrumbs']){ + array_shift($crumbs); + } + //save to session + $_SESSION[DOKU_COOKIE]['bc'] = $crumbs; + return $crumbs; +} + +/** + * Filter for page IDs + * + * This is run on a ID before it is outputted somewhere + * currently used to replace the colon with something else + * on Windows systems and to have proper URL encoding + * + * Urlencoding is ommitted when the second parameter is false + * + * @author Andreas Gohr + */ +function idfilter($id,$ue=true){ + global $conf; + if ($conf['useslash'] && $conf['userewrite']){ + $id = strtr($id,':','/'); + }elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && + $conf['userewrite']) { + $id = strtr($id,':',';'); + } + if($ue){ + $id = rawurlencode($id); + $id = str_replace('%3A',':',$id); //keep as colon + $id = str_replace('%2F','/',$id); //keep as slash + } + return $id; +} + +/** + * This builds a link to a wikipage + * + * It handles URL rewriting and adds additional parameter if + * given in $more + * + * @author Andreas Gohr + */ +function wl($id='',$more='',$abs=false,$sep='&'){ + global $conf; + if(is_array($more)){ + $more = buildURLparams($more,$sep); + }else{ + $more = str_replace(',',$sep,$more); + } + + $id = idfilter($id); + if($abs){ + $xlink = DOKU_URL; + }else{ + $xlink = DOKU_BASE; + } + + if($conf['userewrite'] == 2){ + $xlink .= DOKU_SCRIPT.'/'.$id; + if($more) $xlink .= '?'.$more; + }elseif($conf['userewrite']){ + $xlink .= $id; + if($more) $xlink .= '?'.$more; + }else{ + $xlink .= DOKU_SCRIPT.'?id='.$id; + if($more) $xlink .= $sep.$more; + } + + return $xlink; +} + +/** + * This builds a link to an alternate page format + * + * Handles URL rewriting if enabled. Follows the style of wl(). + * + * @author Ben Coburn + */ +function exportlink($id='',$format='raw',$more='',$abs=false,$sep='&'){ + global $conf; + if(is_array($more)){ + $more = buildURLparams($more,$sep); + }else{ + $more = str_replace(',',$sep,$more); + } + + $format = rawurlencode($format); + $id = idfilter($id); + if($abs){ + $xlink = DOKU_URL; + }else{ + $xlink = DOKU_BASE; + } + + if($conf['userewrite'] == 2){ + $xlink .= DOKU_SCRIPT.'/'.$id.'?do=export_'.$format; + if($more) $xlink .= $sep.$more; + }elseif($conf['userewrite'] == 1){ + $xlink .= '_export/'.$format.'/'.$id; + if($more) $xlink .= '?'.$more; + }else{ + $xlink .= DOKU_SCRIPT.'?do=export_'.$format.$sep.'id='.$id; + if($more) $xlink .= $sep.$more; + } + + return $xlink; +} + +/** + * Build a link to a media file + * + * Will return a link to the detail page if $direct is false + */ +function ml($id='',$more='',$direct=true,$sep='&'){ + global $conf; + if(is_array($more)){ + $more = buildURLparams($more,$sep); + }else{ + $more = str_replace(',',$sep,$more); + } + + $xlink = DOKU_BASE; + + // external URLs are always direct without rewriting + if(preg_match('#^(https?|ftp)://#i',$id)){ + $xlink .= 'lib/exe/fetch.php'; + if($more){ + $xlink .= '?'.$more; + $xlink .= $sep.'media='.rawurlencode($id); + }else{ + $xlink .= '?media='.rawurlencode($id); + } + return $xlink; + } + + $id = idfilter($id); + + // decide on scriptname + if($direct){ + if($conf['userewrite'] == 1){ + $script = '_media'; + }else{ + $script = 'lib/exe/fetch.php'; + } + }else{ + if($conf['userewrite'] == 1){ + $script = '_detail'; + }else{ + $script = 'lib/exe/detail.php'; + } + } + + // build URL based on rewrite mode + if($conf['userewrite']){ + $xlink .= $script.'/'.$id; + if($more) $xlink .= '?'.$more; + }else{ + if($more){ + $xlink .= $script.'?'.$more; + $xlink .= $sep.'media='.$id; + }else{ + $xlink .= $script.'?media='.$id; + } + } + + return $xlink; +} + + + +/** + * Just builds a link to a script + * + * @todo maybe obsolete + * @author Andreas Gohr + */ +function script($script='doku.php'){ +# $link = getBaseURL(); +# $link .= $script; +# return $link; + return DOKU_BASE.DOKU_SCRIPT; +} + +/** + * Spamcheck against wordlist + * + * Checks the wikitext against a list of blocked expressions + * returns true if the text contains any bad words + * + * @author Andreas Gohr + */ +function checkwordblock(){ + global $TEXT; + global $conf; + + if(!$conf['usewordblock']) return false; + + // we prepare the text a tiny bit to prevent spammers circumventing URL checks + $text = preg_replace('!(\b)(www\.[\w.:?\-;,]+?\.[\w.:?\-;,]+?[\w/\#~:.?+=&%@\!\-.:?\-;,]+?)([.:?\-;,]*[^\w/\#~:.?+=&%@\!\-.:?\-;,])!i','\1http://\2 \2\3',$TEXT); + + $wordblocks = getWordblocks(); + //how many lines to read at once (to work around some PCRE limits) + if(version_compare(phpversion(),'4.3.0','<')){ + //old versions of PCRE define a maximum of parenthesises even if no + //backreferences are used - the maximum is 99 + //this is very bad performancewise and may even be too high still + $chunksize = 40; + }else{ + //read file in chunks of 200 - this should work around the + //MAX_PATTERN_SIZE in modern PCRE + $chunksize = 200; + } + while($blocks = array_splice($wordblocks,0,$chunksize)){ + $re = array(); + #build regexp from blocks + foreach($blocks as $block){ + $block = preg_replace('/#.*$/','',$block); + $block = trim($block); + if(empty($block)) continue; + $re[] = $block; + } + if(preg_match('#('.join('|',$re).')#si',$text, $match=array())) { + return true; + } + } + return false; +} + +/** + * Return the IP of the client + * + * Honours X-Forwarded-For and X-Real-IP Proxy Headers + * + * It returns a comma separated list of IPs if the above mentioned + * headers are set. If the single parameter is set, it tries to return + * a routable public address, prefering the ones suplied in the X + * headers + * + * @param boolean $single If set only a single IP is returned + * @author Andreas Gohr + */ +function clientIP($single=false){ + $ip = array(); + $ip[] = $_SERVER['REMOTE_ADDR']; + if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) + $ip = array_merge($ip,explode(',',$_SERVER['HTTP_X_FORWARDED_FOR'])); + if(!empty($_SERVER['HTTP_X_REAL_IP'])) + $ip = array_merge($ip,explode(',',$_SERVER['HTTP_X_REAL_IP'])); + + // remove any non-IP stuff + $cnt = count($ip); + $match = array(); + for($i=0; $i<$cnt; $i++){ + if(preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/',$ip[$i],$match)) { + $ip[$i] = $match[0]; + } else { + $ip[$i] = ''; + } + if(empty($ip[$i])) unset($ip[$i]); + } + $ip = array_values(array_unique($ip)); + if(!$ip[0]) $ip[0] = '0.0.0.0'; // for some strange reason we don't have a IP + + if(!$single) return join(',',$ip); + + // decide which IP to use, trying to avoid local addresses + $ip = array_reverse($ip); + foreach($ip as $i){ + if(preg_match('/^(127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/',$i)){ + continue; + }else{ + return $i; + } + } + // still here? just use the first (last) address + return $ip[0]; +} + +/** + * Checks if a given page is currently locked. + * + * removes stale lockfiles + * + * @author Andreas Gohr + */ +function checklock($id){ + global $conf; + $lock = wikiLockFN($id); + + //no lockfile + if(!@file_exists($lock)) return false; + + //lockfile expired + if((time() - filemtime($lock)) > $conf['locktime']){ + @unlink($lock); + return false; + } + + //my own lock + $ip = io_readFile($lock); + if( ($ip == clientIP()) || ($ip == $_SERVER['REMOTE_USER']) ){ + return false; + } + + return $ip; +} + +/** + * Lock a page for editing + * + * @author Andreas Gohr + */ +function lock($id){ + $lock = wikiLockFN($id); + if($_SERVER['REMOTE_USER']){ + io_saveFile($lock,$_SERVER['REMOTE_USER']); + }else{ + io_saveFile($lock,clientIP()); + } +} + +/** + * Unlock a page if it was locked by the user + * + * @author Andreas Gohr + * @return bool true if a lock was removed + */ +function unlock($id){ + $lock = wikiLockFN($id); + if(@file_exists($lock)){ + $ip = io_readFile($lock); + if( ($ip == clientIP()) || ($ip == $_SERVER['REMOTE_USER']) ){ + @unlink($lock); + return true; + } + } + return false; +} + +/** + * convert line ending to unix format + * + * @see formText() for 2crlf conversion + * @author Andreas Gohr + */ +function cleanText($text){ + $text = preg_replace("/(\015\012)|(\015)/","\012",$text); + return $text; +} + +/** + * Prepares text for print in Webforms by encoding special chars. + * It also converts line endings to Windows format which is + * pseudo standard for webforms. + * + * @see cleanText() for 2unix conversion + * @author Andreas Gohr + */ +function formText($text){ + $text = preg_replace("/\012/","\015\012",$text); + return htmlspecialchars($text); +} + +/** + * Returns the specified local text in raw format + * + * @author Andreas Gohr + */ +function rawLocale($id){ + return io_readFile(localeFN($id)); +} + +/** + * Returns the raw WikiText + * + * @author Andreas Gohr + */ +function rawWiki($id,$rev=''){ + return io_readWikiPage(wikiFN($id, $rev), $id, $rev); +} + +/** + * Returns the pagetemplate contents for the ID's namespace + * + * @author Andreas Gohr + */ +function pageTemplate($data){ + $id = $data[0]; + global $conf; + global $INFO; + $tpl = io_readFile(dirname(wikiFN($id)).'/_template.txt'); + $tpl = str_replace('@ID@',$id,$tpl); + $tpl = str_replace('@NS@',getNS($id),$tpl); + $tpl = str_replace('@PAGE@',strtr(noNS($id),'_',' '),$tpl); + $tpl = str_replace('@USER@',$_SERVER['REMOTE_USER'],$tpl); + $tpl = str_replace('@NAME@',$INFO['userinfo']['name'],$tpl); + $tpl = str_replace('@MAIL@',$INFO['userinfo']['mail'],$tpl); + $tpl = str_replace('@DATE@',date($conf['dformat']),$tpl); + return $tpl; +} + + +/** + * Returns the raw Wiki Text in three slices. + * + * The range parameter needs to have the form "from-to" + * and gives the range of the section in bytes - no + * UTF-8 awareness is needed. + * The returned order is prefix, section and suffix. + * + * @author Andreas Gohr + */ +function rawWikiSlices($range,$id,$rev=''){ + list($from,$to) = explode('-',$range,2); + $text = io_readWikiPage(wikiFN($id, $rev), $id, $rev); + if(!$from) $from = 0; + if(!$to) $to = strlen($text)+1; + + $slices[0] = substr($text,0,$from-1); + $slices[1] = substr($text,$from-1,$to-$from); + $slices[2] = substr($text,$to); + + return $slices; +} + +/** + * Joins wiki text slices + * + * function to join the text slices with correct lineendings again. + * When the pretty parameter is set to true it adds additional empty + * lines between sections if needed (used on saving). + * + * @author Andreas Gohr + */ +function con($pre,$text,$suf,$pretty=false){ + + if($pretty){ + if($pre && substr($pre,-1) != "\n") $pre .= "\n"; + if($suf && substr($text,-1) != "\n") $text .= "\n"; + } + + if($pre) $pre .= "\n"; + if($suf) $text .= "\n"; + return $pre.$text.$suf; +} + +/** + * Saves a wikitext by calling io_writeWikiPage. + * Also directs changelog and attic updates. + * + * @author Andreas Gohr + * @author Ben Coburn + */ +function saveWikiText($id,$text,$summary,$minor=false){ + /* Note to developers: + This code is subtle and delicate. Test the behavior of + the attic and changelog with dokuwiki and external edits + after any changes. External edits change the wiki page + directly without using php or dokuwiki. + */ + global $conf; + global $lang; + global $REV; + // ignore if no changes were made + if($text == rawWiki($id,'')){ + return; + } + + $file = wikiFN($id); + $old = @filemtime($file); // from page + $wasRemoved = empty($text); + $wasCreated = !@file_exists($file); + $wasReverted = ($REV==true); + $newRev = false; + $oldRev = getRevisions($id, -1, 1, 1024); // from changelog + $oldRev = (int)(empty($oldRev)?0:$oldRev[0]); + if(!@file_exists(wikiFN($id, $old)) && @file_exists($file) && $old>=$oldRev) { + // add old revision to the attic if missing + saveOldRevision($id); + // add a changelog entry if this edit came from outside dokuwiki + if ($old>$oldRev) { + addLogEntry($old, $id); + // send notify mails + notify($id,'admin',$oldRev,'',false); + notify($id,'subscribers',$oldRev,'',false); + // remove soon to be stale instructions + $cache = new cache_instructions($id, $file); + $cache->removeCache(); + } + } + + if ($wasRemoved){ + // pre-save deleted revision + @touch($file); + clearstatcache(); + $newRev = saveOldRevision($id); + // remove empty file + @unlink($file); + // remove old meta info... + $mfiles = metaFiles($id); + $changelog = metaFN($id, '.changes'); + foreach ($mfiles as $mfile) { + // but keep per-page changelog to preserve page history + if (@file_exists($mfile) && $mfile!==$changelog) { @unlink($mfile); } + } + $del = true; + // autoset summary on deletion + if(empty($summary)) $summary = $lang['deleted']; + // remove empty namespaces + io_sweepNS($id, 'datadir'); + io_sweepNS($id, 'mediadir'); + }else{ + // save file (namespace dir is created in io_writeWikiPage) + io_writeWikiPage($file, $text, $id); + // pre-save the revision, to keep the attic in sync + $newRev = saveOldRevision($id); + $del = false; + } + + // select changelog line type + $extra = ''; + $type = 'E'; + if ($wasReverted) { + $type = 'R'; + $extra = $REV; + } + else if ($wasCreated) { $type = 'C'; } + else if ($wasRemoved) { $type = 'D'; } + else if ($minor && $conf['useacl'] && $_SERVER['REMOTE_USER']) { $type = 'e'; } //minor edits only for logged in users + + addLogEntry($newRev, $id, $type, $summary, $extra); + // send notify mails + notify($id,'admin',$old,$summary,$minor); + notify($id,'subscribers',$old,$summary,$minor); + + // update the purgefile (timestamp of the last time anything within the wiki was changed) + io_saveFile($conf['cachedir'].'/purgefile',time()); +} + +/** + * moves the current version to the attic and returns its + * revision date + * + * @author Andreas Gohr + */ +function saveOldRevision($id){ + global $conf; + $oldf = wikiFN($id); + if(!@file_exists($oldf)) return ''; + $date = filemtime($oldf); + $newf = wikiFN($id,$date); + io_writeWikiPage($newf, rawWiki($id), $id, $date); + return $date; +} + +/** + * Sends a notify mail on page change + * + * @param string $id The changed page + * @param string $who Who to notify (admin|subscribers) + * @param int $rev Old page revision + * @param string $summary What changed + * @param boolean $minor Is this a minor edit? + * @param array $replace Additional string substitutions, @KEY@ to be replaced by value + * + * @author Andreas Gohr + */ +function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ + global $lang; + global $conf; + + // decide if there is something to do + if($who == 'admin'){ + if(empty($conf['notify'])) return; //notify enabled? + $text = rawLocale('mailtext'); + $to = $conf['notify']; + $bcc = ''; + }elseif($who == 'subscribers'){ + if(!$conf['subscribers']) return; //subscribers enabled? + if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors + $bcc = subscriber_addresslist($id); + if(empty($bcc)) return; + $to = ''; + $text = rawLocale('subscribermail'); + }elseif($who == 'register'){ + if(empty($conf['registernotify'])) return; + $text = rawLocale('registermail'); + $to = $conf['registernotify']; + $bcc = ''; + }else{ + return; //just to be safe + } + + $text = str_replace('@DATE@',date($conf['dformat']),$text); + $text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text); + $text = str_replace('@IPADDRESS@',$_SERVER['REMOTE_ADDR'],$text); + $text = str_replace('@HOSTNAME@',gethostbyaddr($_SERVER['REMOTE_ADDR']),$text); + $text = str_replace('@NEWPAGE@',wl($id,'',true),$text); + $text = str_replace('@PAGE@',$id,$text); + $text = str_replace('@TITLE@',$conf['title'],$text); + $text = str_replace('@DOKUWIKIURL@',DOKU_URL,$text); + $text = str_replace('@SUMMARY@',$summary,$text); + $text = str_replace('@USER@',$_SERVER['REMOTE_USER'],$text); + + foreach ($replace as $key => $substitution) { + $text = str_replace('@'.strtoupper($key).'@',$substitution, $text); + } + + if($who == 'register'){ + $subject = $lang['mail_new_user'].' '.$summary; + }elseif($rev){ + $subject = $lang['mail_changed'].' '.$id; + $text = str_replace('@OLDPAGE@',wl($id,"rev=$rev",true),$text); + require_once(DOKU_INC.'inc/DifferenceEngine.php'); + $df = new Diff(preg_split('/\n/',rawWiki($id,$rev)), + preg_split('/\n/',rawWiki($id))); + $dformat = new UnifiedDiffFormatter(); + $diff = $dformat->format($df); + }else{ + $subject=$lang['mail_newpage'].' '.$id; + $text = str_replace('@OLDPAGE@','none',$text); + $diff = rawWiki($id); + } + $text = str_replace('@DIFF@',$diff,$text); + $subject = '['.$conf['title'].'] '.$subject; + + mail_send($to,$subject,$text,$conf['mailfrom'],'',$bcc); +} + +/** + * extracts the query from a google referer + * + * @todo should be more generic and support yahoo et al + * @author Andreas Gohr + */ +function getGoogleQuery(){ + $url = parse_url($_SERVER['HTTP_REFERER']); + if(!$url) return ''; + + if(!preg_match("#google\.#i",$url['host'])) return ''; + $query = array(); + parse_str($url['query'],$query); + + return $query['q']; +} + +/** + * Try to set correct locale + * + * @deprecated No longer used + * @author Andreas Gohr + */ +function setCorrectLocale(){ + global $conf; + global $lang; + + $enc = strtoupper($lang['encoding']); + foreach ($lang['locales'] as $loc){ + //try locale + if(@setlocale(LC_ALL,$loc)) return; + //try loceale with encoding + if(@setlocale(LC_ALL,"$loc.$enc")) return; + } + //still here? try to set from environment + @setlocale(LC_ALL,""); +} + +/** + * Return the human readable size of a file + * + * @param int $size A file size + * @param int $dec A number of decimal places + * @author Martin Benjamin + * @author Aidan Lister + * @version 1.0.0 + */ +function filesize_h($size, $dec = 1){ + $sizes = array('B', 'KB', 'MB', 'GB'); + $count = count($sizes); + $i = 0; + + while ($size >= 1024 && ($i < $count - 1)) { + $size /= 1024; + $i++; + } + + return round($size, $dec) . ' ' . $sizes[$i]; +} + +/** + * return an obfuscated email address in line with $conf['mailguard'] setting + * + * @author Harry Fuecks + * @author Christopher Smith + */ +function obfuscate($email) { + global $conf; + + switch ($conf['mailguard']) { + case 'visible' : + $obfuscate = array('@' => ' [at] ', '.' => ' [dot] ', '-' => ' [dash] '); + return strtr($email, $obfuscate); + + case 'hex' : + $encode = ''; + for ($x=0; $x < strlen($email); $x++) $encode .= '&#x' . bin2hex($email{$x}).';'; + return $encode; + + case 'none' : + default : + return $email; + } +} + +/** + * Let us know if a user is tracking a page + * + * @author Andreas Gohr + */ +function is_subscribed($id,$uid){ + $file=metaFN($id,'.mlist'); + if (@file_exists($file)) { + $mlist = file($file); + $pos = array_search($uid."\n",$mlist); + return is_int($pos); + } + + return false; +} + +/** + * Return a string with the email addresses of all the + * users subscribed to a page + * + * @author Steven Danz + */ +function subscriber_addresslist($id){ + global $conf; + global $auth; + + $emails = ''; + + if (!$conf['subscribers']) return; + + $mlist = array(); + $file=metaFN($id,'.mlist'); + if (@file_exists($file)) { + $mlist = file($file); + } + if(count($mlist) > 0) { + foreach ($mlist as $who) { + $who = rtrim($who); + $info = $auth->getUserData($who); + $level = auth_aclcheck($id,$who,$info['grps']); + if ($level >= AUTH_READ) { + if (strcasecmp($info['mail'],$conf['notify']) != 0) { + if (empty($emails)) { + $emails = $info['mail']; + } else { + $emails = "$emails,".$info['mail']; + } + } + } + } + } + + return $emails; +} + +/** + * Removes quoting backslashes + * + * @author Andreas Gohr + */ +function unslash($string,$char="'"){ + return str_replace('\\'.$char,$char,$string); +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/confutils.php b/plugins/dokuwiki/inc/confutils.php new file mode 100644 index 0000000..c668e80 --- /dev/null +++ b/plugins/dokuwiki/inc/confutils.php @@ -0,0 +1,189 @@ + + */ + + if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + +/** + * Returns the (known) extension and mimetype of a given filename + * + * @author Andreas Gohr + */ +function mimetype($file){ + $ret = array(false,false); // return array + $mtypes = getMimeTypes(); // known mimetypes + $exts = join('|',array_keys($mtypes)); // known extensions (regexp) + if(preg_match('#\.('.$exts.')$#i',$file,$matches)){ + $ext = strtolower($matches[1]); + } + + if($ext && $mtypes[$ext]){ + $ret = array($ext, $mtypes[$ext]); + } + + return $ret; +} + +/** + * returns a hash of mimetypes + * + * @author Andreas Gohr + */ +function getMimeTypes() { + static $mime = NULL; + if ( !$mime ) { + $mime = confToHash(DOKU_CONF.'mime.conf'); + if (@file_exists(DOKU_CONF.'mime.local.conf')) { + $local = confToHash(DOKU_CONF.'mime.local.conf'); + $mime = array_merge($mime, $local); + } + } + return $mime; +} + +/** + * returns a hash of acronyms + * + * @author Harry Fuecks + */ +function getAcronyms() { + static $acronyms = NULL; + if ( !$acronyms ) { + $acronyms = confToHash(DOKU_CONF.'acronyms.conf'); + if (@file_exists(DOKU_CONF.'acronyms.local.conf')) { + $local = confToHash(DOKU_CONF.'acronyms.local.conf'); + $acronyms = array_merge($acronyms, $local); + } + } + return $acronyms; +} + +/** + * returns a hash of smileys + * + * @author Harry Fuecks + */ +function getSmileys() { + static $smileys = NULL; + if ( !$smileys ) { + $smileys = confToHash(DOKU_CONF.'smileys.conf'); + if (@file_exists(DOKU_CONF.'smileys.local.conf')) { + $local = confToHash(DOKU_CONF.'smileys.local.conf'); + $smileys = array_merge($smileys, $local); + } + } + return $smileys; +} + +/** + * returns a hash of entities + * + * @author Harry Fuecks + */ +function getEntities() { + static $entities = NULL; + if ( !$entities ) { + $entities = confToHash(DOKU_CONF.'entities.conf'); + if (@file_exists(DOKU_CONF.'entities.local.conf')) { + $local = confToHash(DOKU_CONF.'entities.local.conf'); + $entities = array_merge($entities, $local); + } + } + return $entities; +} + +/** + * returns a hash of interwikilinks + * + * @author Harry Fuecks + */ +function getInterwiki() { + static $wikis = NULL; + if ( !$wikis ) { + $wikis = confToHash(DOKU_CONF.'interwiki.conf',true); + if (@file_exists(DOKU_CONF.'interwiki.local.conf')) { + $local = confToHash(DOKU_CONF.'interwiki.local.conf'); + $wikis = array_merge($wikis, $local); + } + } + //add sepecial case 'this' + $wikis['this'] = DOKU_URL.'{NAME}'; + return $wikis; +} + +/** + * returns array of wordblock patterns + * + */ +function getWordblocks() { + static $wordblocks = NULL; + if ( !$wordblocks ) { + $wordblocks = file(DOKU_CONF.'wordblock.conf'); + if (@file_exists(DOKU_CONF.'wordblock.local.conf')) { + $local = file(DOKU_CONF.'wordblock.local.conf'); + $wordblocks = array_merge($wordblocks, $local); + } + } + return $wordblocks; +} + + +/** + * Builds a hash from a configfile + * + * If $lower is set to true all hash keys are converted to + * lower case. + * + * @author Harry Fuecks + * @author Andreas Gohr + */ +function confToHash($file,$lower=false) { + $conf = array(); + $lines = @file( $file ); + if ( !$lines ) return $conf; + + foreach ( $lines as $line ) { + //ignore comments + $line = preg_replace('/(? + * @returns boolean true if enabled, false if disabled + */ +function actionOK($action){ + static $disabled = null; + if(is_null($disabled)){ + global $conf; + + // prepare disabled actions array and handle legacy options + $disabled = explode(',',$conf['disableactions']); + $disabled = array_map('trim',$disabled); + if(isset($conf['openregister']) && !$conf['openregister']) $disabled[] = 'register'; + if(isset($conf['resendpasswd']) && !$conf['resendpasswd']) $disabled[] = 'resendpwd'; + $disabled = array_unique($disabled); + } + + return !in_array($action,$disabled); +} + + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/events.php b/plugins/dokuwiki/inc/events.php new file mode 100644 index 0000000..1231f4c --- /dev/null +++ b/plugins/dokuwiki/inc/events.php @@ -0,0 +1,202 @@ + + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +require_once(DOKU_INC.'inc/pluginutils.php'); + +class Doku_Event { + + // public properties + var $name = ''; // READONLY event name, objects must register against this name to see the event + var $data = NULL; // READWRITE data relevant to the event, no standardised format (YET!) + var $result = NULL; // READWRITE the results of the event action, only relevant in "_AFTER" advise + // event handlers may modify this if they are preventing the default action + // to provide the after event handlers with event results + var $canPreventDefault = true; // READONLY if true, event handlers can prevent the events default action + + // private properties, event handlers can effect these through the provided methods + var $_default = true; // whether or not to carry out the default action associated with the event + var $_continue = true; // whether or not to continue propagating the event to other handlers + + /** + * event constructor + */ + function __construct($name, &$data) { + + $this->name = $name; + $this->data =& $data; + + } + + /** + * advise functions + * + * advise all registered handlers of this event + * + * if these methods are used by functions outside of this object, they must + * properly handle correct processing of any default action and issue an + * advise_after() signal. e.g. + * $evt = new Doku_Event(name, data); + * if ($evt->advise_before(canPreventDefault) { + * // default action code block + * } + * $evt->advise_after(); + * unset($evt); + * + * @return results of processing the event, usually $this->_default + */ + function advise_before($enablePreventDefault=true) { + global $EVENT_HANDLER; + + $this->canPreventDefault = $enablePreventDefault; + $EVENT_HANDLER->process_event($this,'BEFORE'); + + return (!$enablePreventDefault || $this->_default); + } + + function advise_after() { + global $EVENT_HANDLER; + + $this->_continue = true; + $EVENT_HANDLER->process_event($this,'AFTER'); + } + + /** + * trigger + * + * - advise all registered (_BEFORE) handlers that this event is about to take place + * - carry out the default action using $this->data based on $enablePrevent and + * $this->_default, all of which may have been modified by the event handlers. + * - advise all registered (_AFTER) handlers that the event has taken place + * + * @return $event->results + * the value set by any _before or handlers if the default action is prevented + * or the results of the default action (as modified by _after handlers) + * or NULL no action took place and no handler modified the value + */ + function trigger($action=NULL, $enablePrevent=true) { + + if (!is_callable($action)) $enablePrevent = false; + + if ($this->advise_before($enablePrevent) && is_callable($action)) { + if (is_array($action)) { + list($obj,$method) = $action; + $this->result = $obj->$method($this->data); + } else { + $this->result = $action($this->data); + } + } + + $this->advise_after(); + + return $this->result; + } + + /** + * stopPropagation + * + * stop any further processing of the event by event handlers + * this function does not prevent the default action taking place + */ + function stopPropagation() { $this->_continue = false; } + + /** + * preventDefault + * + * prevent the default action taking place + */ + function preventDefault() { $this->_default = false; } +} + +class Doku_Event_Handler { + + // public properties: none + + // private properties + var $_hooks = array(); // array of events and their registered handlers + + /** + * event_handler + * + * constructor, loads all action plugins and calls their register() method giving them + * an opportunity to register any hooks they require + */ + function __construct() { + + // load action plugins + $plugin = NULL; + $pluginlist = plugin_list('action'); + + foreach ($pluginlist as $plugin_name) { + $plugin =& plugin_load('action',$plugin_name); + + if ($plugin !== NULL) $plugin->register($this); + } + } + + /** + * register_hook + * + * register a hook for an event + * + * @PARAM $event (string) name used by the event, (incl '_before' or '_after' for triggers) + * @PARAM $obj (obj) object in whose scope method is to be executed, + * if NULL, method is assumed to be a globally available function + * @PARAM $method (function) event handler function + * @PARAM $param (mixed) data passed to the event handler + */ + function register_hook($event, $advise, &$obj, $method, $param=NULL) { + $this->_hooks[$event.'_'.$advise][] = array(&$obj, $method, $param); + } + + function process_event(&$event,$advise='') { + + $evt_name = $event->name . ($advise ? '_'.$advise : '_BEFORE'); + + if (!empty($this->_hooks[$evt_name])) { + $hook = reset($this->_hooks[$evt_name]); + do { +// list($obj, $method, $param) = $hook; + $obj =& $hook[0]; + $method = $hook[1]; + $param = $hook[2]; + + if (is_null($obj)) { + $method($event, $param); + } else { + $obj->$method($event, $param); + } + + } while ($event->_continue && $hook = next($this->_hooks[$evt_name])); + } + } +} + +/** + * trigger_event + * + * function wrapper to process (create, trigger and destroy) an event + * + * @PARAM $name (string) name for the event + * @PARAM $data (mixed) event data + * @PARAM $action (callback) (optional, default=NULL) default action, a php callback function + * @PARAM $canPreventDefault (bool) (optional, default=true) can hooks prevent the default action + * + * @RETURN (mixed) the event results value after all event processing is complete + * by default this is the return value of the default action however + * it can be set or modified by event handler hooks + */ +function trigger_event($name, &$data, $action=NULL, $canPreventDefault=true) { + + $evt = new Doku_Event($name, $data); + return $evt->trigger($action, $canPreventDefault); +} + +// create the event handler +global $EVENT_HANDLER; +$EVENT_HANDLER = new Doku_Event_Handler(); diff --git a/plugins/dokuwiki/inc/geshi.php b/plugins/dokuwiki/inc/geshi.php new file mode 100644 index 0000000..1a3bc25 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi.php @@ -0,0 +1,4775 @@ +, Benny Baumann + * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann + * @license http://gnu.org/copyleft/gpl.html GNU GPL + * + */ + +// +// GeSHi Constants +// You should use these constant names in your programs instead of +// their values - you never know when a value may change in a future +// version +// + +/** The version of this GeSHi file */ +/** + * peterdd: Took the easybook/geshi fork ( https://github.com/easybook/geshi ) + * and corrected/adapted their version here. + * easybook/geshi release date of 1.0.8.17: 2016-03-29 +*/ +define('GESHI_VERSION', '1.0.8.17'); + +// Define the root directory for the GeSHi code tree +if (!defined('GESHI_ROOT')) { + /** The root directory for GeSHi */ + define('GESHI_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR); +} +/** The language file directory for GeSHi + @access private */ +define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR); + +// Define if GeSHi should be paranoid about security +if (!defined('GESHI_SECURITY_PARANOID')) { + /** Tells GeSHi to be paranoid about security settings */ + define('GESHI_SECURITY_PARANOID', false); +} + +// Line numbers - use with enable_line_numbers() +/** Use no line numbers when building the result */ +define('GESHI_NO_LINE_NUMBERS', 0); +/** Use normal line numbers when building the result */ +define('GESHI_NORMAL_LINE_NUMBERS', 1); +/** Use fancy line numbers when building the result */ +define('GESHI_FANCY_LINE_NUMBERS', 2); + +// Container HTML type +/** Use nothing to surround the source */ +define('GESHI_HEADER_NONE', 0); +/** Use a "div" to surround the source */ +define('GESHI_HEADER_DIV', 1); +/** Use a "pre" to surround the source */ +define('GESHI_HEADER_PRE', 2); +/** Use a pre to wrap lines when line numbers are enabled or to wrap the whole code. */ +define('GESHI_HEADER_PRE_VALID', 3); +/** + * Use a "table" to surround the source: + * + * + * + * + * + *
$header
$linenumbers
$code>
$footer
+ * + * this is essentially only a workaround for Firefox, see sf#1651996 or take a look at + * https://bugzilla.mozilla.org/show_bug.cgi?id=365805 + * @note when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE + */ +define('GESHI_HEADER_PRE_TABLE', 4); + +// Capatalisation constants +/** Lowercase keywords found */ +define('GESHI_CAPS_NO_CHANGE', 0); +/** Uppercase keywords found */ +define('GESHI_CAPS_UPPER', 1); +/** Leave keywords found as the case that they are */ +define('GESHI_CAPS_LOWER', 2); + +// Link style constants +/** Links in the source in the :link state */ +define('GESHI_LINK', 0); +/** Links in the source in the :hover state */ +define('GESHI_HOVER', 1); +/** Links in the source in the :active state */ +define('GESHI_ACTIVE', 2); +/** Links in the source in the :visited state */ +define('GESHI_VISITED', 3); + +// Important string starter/finisher +// Note that if you change these, they should be as-is: i.e., don't +// write them as if they had been run through htmlentities() +/** The starter for important parts of the source */ +define('GESHI_START_IMPORTANT', ''); +/** The ender for important parts of the source */ +define('GESHI_END_IMPORTANT', ''); + +/**#@+ + * @access private + */ +// When strict mode applies for a language +/** Strict mode never applies (this is the most common) */ +define('GESHI_NEVER', 0); +/** Strict mode *might* apply, and can be enabled or + disabled by {@link GeSHi->enable_strict_mode()} */ +define('GESHI_MAYBE', 1); +/** Strict mode always applies */ +define('GESHI_ALWAYS', 2); + +// Advanced regexp handling constants, used in language files +/** The key of the regex array defining what to search for */ +define('GESHI_SEARCH', 0); +/** The key of the regex array defining what bracket group in a + matched search to use as a replacement */ +define('GESHI_REPLACE', 1); +/** The key of the regex array defining any modifiers to the regular expression */ +define('GESHI_MODIFIERS', 2); +/** The key of the regex array defining what bracket group in a + matched search to put before the replacement */ +define('GESHI_BEFORE', 3); +/** The key of the regex array defining what bracket group in a + matched search to put after the replacement */ +define('GESHI_AFTER', 4); +/** The key of the regex array defining a custom keyword to use + for this regexp's html tag class */ +define('GESHI_CLASS', 5); + +/** Used in language files to mark comments */ +define('GESHI_COMMENTS', 0); + +/** Used to work around missing PHP features **/ +define('GESHI_PHP_PRE_433', !(version_compare(PHP_VERSION, '4.3.3') === 1)); + +/** make sure we can call stripos **/ +if (!function_exists('stripos')) { + // the offset param of preg_match is not supported below PHP 4.3.3 + if (GESHI_PHP_PRE_433) { + /** + * @ignore + */ + function stripos($haystack, $needle, $offset = null) { + if (!is_null($offset)) { + $haystack = substr($haystack, $offset); + } + if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE)) { + return $match[0][1]; + } + return false; + } + } + else { + /** + * @ignore + */ + function stripos($haystack, $needle, $offset = null) { + if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE, $offset)) { + return $match[0][1]; + } + return false; + } + } +} + +/** some old PHP / PCRE subpatterns only support up to xxx subpatterns in + regular expressions. Set this to false if your PCRE lib is up to date + @see GeSHi->optimize_regexp_list() + **/ +define('GESHI_MAX_PCRE_SUBPATTERNS', 500); +/** it's also important not to generate too long regular expressions + be generous here... but keep in mind, that when reaching this limit we + still have to close open patterns. 12k should do just fine on a 16k limit. + @see GeSHi->optimize_regexp_list() + **/ +define('GESHI_MAX_PCRE_LENGTH', 12288); + +//Number format specification +/** Basic number format for integers */ +define('GESHI_NUMBER_INT_BASIC', 1); //Default integers \d+ +/** Enhanced number format for integers like seen in C */ +define('GESHI_NUMBER_INT_CSTYLE', 2); //Default C-Style \d+[lL]? +/** Number format to highlight binary numbers with a suffix "b" */ +define('GESHI_NUMBER_BIN_SUFFIX', 16); //[01]+[bB] +/** Number format to highlight binary numbers with a prefix % */ +define('GESHI_NUMBER_BIN_PREFIX_PERCENT', 32); //%[01]+ +/** Number format to highlight binary numbers with a prefix 0b (C) */ +define('GESHI_NUMBER_BIN_PREFIX_0B', 64); //0b[01]+ +/** Number format to highlight octal numbers with a leading zero */ +define('GESHI_NUMBER_OCT_PREFIX', 256); //0[0-7]+ +/** Number format to highlight octal numbers with a prefix 0o (logtalk) */ +define('GESHI_NUMBER_OCT_PREFIX_0O', 512); //0[0-7]+ +/** Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series). */ +define('GESHI_NUMBER_OCT_PREFIX_AT', 1024); //@[0-7]+ +/** Number format to highlight octal numbers with a suffix of o */ +define('GESHI_NUMBER_OCT_SUFFIX', 2048); //[0-7]+[oO] +/** Number format to highlight hex numbers with a prefix 0x */ +define('GESHI_NUMBER_HEX_PREFIX', 4096); //0x[0-9a-fA-F]+ +/** Number format to highlight hex numbers with a prefix $ */ +define('GESHI_NUMBER_HEX_PREFIX_DOLLAR', 8192); //$[0-9a-fA-F]+ +/** Number format to highlight hex numbers with a suffix of h */ +define('GESHI_NUMBER_HEX_SUFFIX', 16384); //[0-9][0-9a-fA-F]*h +/** Number format to highlight floating-point numbers without support for scientific notation */ +define('GESHI_NUMBER_FLT_NONSCI', 65536); //\d+\.\d+ +/** Number format to highlight floating-point numbers without support for scientific notation */ +define('GESHI_NUMBER_FLT_NONSCI_F', 131072); //\d+(\.\d+)?f +/** Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero */ +define('GESHI_NUMBER_FLT_SCI_SHORT', 262144); //\.\d+e\d+ +/** Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit */ +define('GESHI_NUMBER_FLT_SCI_ZERO', 524288); //\d+(\.\d+)?e\d+ +//Custom formats are passed by RX array + +// Error detection - use these to analyse faults +/** No sourcecode to highlight was specified + * @deprecated + */ +define('GESHI_ERROR_NO_INPUT', 1); +/** The language specified does not exist */ +define('GESHI_ERROR_NO_SUCH_LANG', 2); +/** GeSHi could not open a file for reading (generally a language file) */ +define('GESHI_ERROR_FILE_NOT_READABLE', 3); +/** The header type passed to {@link GeSHi->set_header_type()} was invalid */ +define('GESHI_ERROR_INVALID_HEADER_TYPE', 4); +/** The line number type passed to {@link GeSHi->enable_line_numbers()} was invalid */ +define('GESHI_ERROR_INVALID_LINE_NUMBER_TYPE', 5); +/**#@-*/ + + +/** + * The GeSHi Class. + * + * Please refer to the documentation for GeSHi 1.0.X that is available + * at http://qbnz.com/highlighter/documentation.php for more information + * about how to use this class. + * + * @package geshi + * @author Nigel McNie , Benny Baumann + * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann + */ +class GeSHi { + /**#@+ + * @access private + */ + /** + * The source code to highlight + * @var string + */ + var $source = ''; + + /** + * The language to use when highlighting + * @var string + */ + var $language = ''; + + /** + * The data for the language used + * @var array + */ + var $language_data = array(); + + /** + * The path to the language files + * @var string + */ + var $language_path = GESHI_LANG_ROOT; + + /** + * The error message associated with an error + * @var string + * @todo check err reporting works + */ + var $error = false; + + /** + * Possible error messages + * @var array + */ + var $error_messages = array( + GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})', + GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable', + GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid', + GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid' + ); + + /** + * Whether highlighting is strict or not + * @var boolean + */ + var $strict_mode = false; + + /** + * Whether to use CSS classes in output + * @var boolean + */ + var $use_classes = false; + + /** + * The type of header to use. Can be one of the following + * values: + * + * - GESHI_HEADER_PRE: Source is outputted in a "pre" HTML element. + * - GESHI_HEADER_DIV: Source is outputted in a "div" HTML element. + * - GESHI_HEADER_NONE: No header is outputted. + * + * @var int + */ + var $header_type = GESHI_HEADER_PRE; + + /** + * Array of permissions for which lexics should be highlighted + * @var array + */ + var $lexic_permissions = array( + 'KEYWORDS' => array(), + 'COMMENTS' => array('MULTI' => true), + 'REGEXPS' => array(), + 'ESCAPE_CHAR' => true, + 'BRACKETS' => true, + 'SYMBOLS' => false, + 'STRINGS' => true, + 'NUMBERS' => true, + 'METHODS' => true, + 'SCRIPT' => true + ); + + /** + * The time it took to parse the code + * @var double + */ + var $time = 0; + + /** + * The content of the header block + * @var string + */ + var $header_content = ''; + + /** + * The content of the footer block + * @var string + */ + var $footer_content = ''; + + /** + * The style of the header block + * @var string + */ + var $header_content_style = ''; + + /** + * The style of the footer block + * @var string + */ + var $footer_content_style = ''; + + /** + * Tells if a block around the highlighted source should be forced + * if not using line numbering + * @var boolean + */ + var $force_code_block = false; + + /** + * The styles for hyperlinks in the code + * @var array + */ + var $link_styles = array(); + + /** + * Whether important blocks should be recognised or not + * @var boolean + * @deprecated + * @todo REMOVE THIS FUNCTIONALITY! + */ + var $enable_important_blocks = false; + + /** + * Styles for important parts of the code + * @var string + * @deprecated + * @todo As above - rethink the whole idea of important blocks as it is buggy and + * will be hard to implement in 1.2 + */ + var $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code + + /** + * Whether CSS IDs should be added to the code + * @var boolean + */ + var $add_ids = false; + + /** + * Lines that should be highlighted extra + * @var array + */ + var $highlight_extra_lines = array(); + + /** + * Styles of lines that should be highlighted extra + * @var array + */ + var $highlight_extra_lines_styles = array(); + + /** + * Styles of extra-highlighted lines + * @var string + */ + var $highlight_extra_lines_style = 'background-color: #ffc;'; + + /** + * The line ending + * If null, nl2br() will be used on the result string. + * Otherwise, all instances of \n will be replaced with $line_ending + * @var string + */ + var $line_ending = null; + + /** + * Number at which line numbers should start at + * @var int + */ + var $line_numbers_start = 1; + + /** + * The overall style for this code block + * @var string + */ + var $overall_style = 'font-family:monospace;'; + + /** + * The style for the actual code + * @var string + */ + var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;'; + + /** + * The overall class for this code block + * @var string + */ + var $overall_class = ''; + + /** + * The overall ID for this code block + * @var string + */ + var $overall_id = ''; + + /** + * Line number styles + * @var string + */ + var $line_style1 = 'font-weight: normal; vertical-align:top;'; + + /** + * Line number styles for fancy lines + * @var string + */ + var $line_style2 = 'font-weight: bold; vertical-align:top;'; + + /** + * Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen + * @var string + */ + var $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;'; + + /** + * Flag for how line numbers are displayed + * @var boolean + */ + var $line_numbers = GESHI_NO_LINE_NUMBERS; + + /** + * Flag to decide if multi line spans are allowed. Set it to false to make sure + * each tag is closed before and reopened after each linefeed. + * @var boolean + */ + var $allow_multiline_span = true; + + /** + * The "nth" value for fancy line highlighting + * @var int + */ + var $line_nth_row = 0; + + /** + * The size of tab stops + * @var int + */ + var $tab_width = 8; + + /** + * Should we use language-defined tab stop widths? + * @var int + */ + var $use_language_tab_width = false; + + /** + * Default target for keyword links + * @var string + */ + var $link_target = ''; + + /** + * The encoding to use for entity encoding + * NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598) + * @var string + */ + var $encoding = 'utf-8'; + + /** + * Should keywords be linked? + * @var boolean + */ + var $keyword_links = true; + + /** + * Currently loaded language file + * @var string + * @since 1.0.7.22 + */ + var $loaded_language = ''; + + /** + * Wether the caches needed for parsing are built or not + * + * @var bool + * @since 1.0.8 + */ + var $parse_cache_built = false; + + /** + * Work around for Suhosin Patch with disabled /e modifier + * + * Note from suhosins author in config file: + *
+ * The /e modifier inside preg_replace() allows code execution. + * Often it is the cause for remote code execution exploits. It is wise to + * deactivate this feature and test where in the application it is used. + * The developer using the /e modifier should be made aware that he should + * use preg_replace_callback() instead + *
+ * + * @var array + * @since 1.0.8 + */ + var $_kw_replace_group = 0; + var $_rx_key = 0; + + /** + * some "callback parameters" for handle_multiline_regexps + * + * @since 1.0.8 + * @access private + * @var string + */ + var $_hmr_before = ''; + var $_hmr_replace = ''; + var $_hmr_after = ''; + var $_hmr_key = 0; + + /**#@-*/ + + /** + * Creates a new GeSHi object, with source and language + * + * @param string The source code to highlight + * @param string The language to highlight the source with + * @param string The path to the language file directory. This + * is deprecated! I've backported the auto path + * detection from the 1.1.X dev branch, so now it + * should be automatically set correctly. If you have + * renamed the language directory however, you will + * still need to set the path using this parameter or + * {@link GeSHi->set_language_path()} + * @since 1.0.0 + */ + function __construct($source = '', $language = '', $path = '') { + if (!empty($source)) { + $this->set_source($source); + } + if (!empty($language)) { + $this->set_language($language); + } + $this->set_language_path($path); + } + + /** + * Returns the version of GeSHi + * + * @return string + * @since 1 0.8.11 + */ + function get_version() + { + return GESHI_VERSION; + } + + /** + * Returns an error message associated with the last GeSHi operation, + * or false if no error has occured + * + * @return string|false An error message if there has been an error, else false + * @since 1.0.0 + */ + function error() { + if ($this->error) { + //Put some template variables for debugging here ... + $debug_tpl_vars = array( + '{LANGUAGE}' => $this->language, + '{PATH}' => $this->language_path + ); + $msg = str_replace( + array_keys($debug_tpl_vars), + array_values($debug_tpl_vars), + $this->error_messages[$this->error]); + + return "
GeSHi Error: $msg (code {$this->error})
"; + } + return false; + } + + /** + * Gets a human-readable language name (thanks to Simon Patterson + * for the idea :)) + * + * @return string The name for the current language + * @since 1.0.2 + */ + function get_language_name() { + if (GESHI_ERROR_NO_SUCH_LANG == $this->error) { + return $this->language_data['LANG_NAME'] . ' (Unknown Language)'; + } + return $this->language_data['LANG_NAME']; + } + + /** + * Sets the source code for this object + * + * @param string The source code to highlight + * @since 1.0.0 + */ + function set_source($source) { + $this->source = $source; + $this->highlight_extra_lines = array(); + } + + /** + * Sets the language for this object + * + * @note since 1.0.8 this function won't reset language-settings by default anymore! + * if you need this set $force_reset = true + * + * @param string The name of the language to use + * @since 1.0.0 + */ + function set_language($language, $force_reset = false) { + if ($force_reset) { + $this->loaded_language = false; + } + + //Clean up the language name to prevent malicious code injection + $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); + + $language = strtolower($language); + + //Retreive the full filename + $file_name = $this->language_path . $language . '.php'; + if ($file_name == $this->loaded_language) { + // this language is already loaded! + return; + } + + $this->language = $language; + + $this->error = false; + $this->strict_mode = GESHI_NEVER; + + //Check if we can read the desired file + if (!is_readable($file_name)) { + $this->error = GESHI_ERROR_NO_SUCH_LANG; + return; + } + + // Load the language for parsing + $this->load_language($file_name); + } + + /** + * Sets the path to the directory containing the language files. Note + * that this path is relative to the directory of the script that included + * geshi.php, NOT geshi.php itself. + * + * @param string The path to the language directory + * @since 1.0.0 + * @deprecated The path to the language files should now be automatically + * detected, so this method should no longer be needed. The + * 1.1.X branch handles manual setting of the path differently + * so this method will disappear in 1.2.0. + */ + function set_language_path($path) { + if(strpos($path,':')) { + //Security Fix to prevent external directories using fopen wrappers. + if(DIRECTORY_SEPARATOR == "\\") { + if(!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) { + return; + } + } else { + return; + } + } + if(preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) { + //Security Fix to prevent external directories using fopen wrappers. + return; + } + if(GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) { + //Security Fix to prevent external directories using fopen wrappers. + return; + } + if(GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) { + //Security Fix to prevent external directories using fopen wrappers. + return; + } + if ($path) { + $this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/'; + $this->set_language($this->language); // otherwise set_language_path has no effect + } + } + + /** + * Get supported langs or an associative array lang=>full_name. + * @param boolean $longnames + * @return array + */ + function get_supported_languages($full_names=false) + { + // return array + $back = array(); + + // we walk the lang root + $dir = dir($this->language_path); + + // foreach entry + while (false !== ($entry = $dir->read())) + { + $full_path = $this->language_path.$entry; + + // Skip all dirs + if (is_dir($full_path)) { + continue; + } + + // we only want lang.php files + if (!preg_match('/^([^.]+)\.php$/', $entry, $matches)) { + continue; + } + + // Raw lang name is here + $langname = $matches[1]; + + // We want the fullname too? + if ($full_names === true) + { + if (false !== ($fullname = $this->get_language_fullname($langname))) + { + $back[$langname] = $fullname; // we go associative + } + } + else + { + // just store raw langname + $back[] = $langname; + } + } + + $dir->close(); + + return $back; + } + + /** + * Get full_name for a lang or false. + * @param string $language short langname (html4strict for example) + * @return mixed + */ + function get_language_fullname($language) + { + //Clean up the language name to prevent malicious code injection + $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language); + + $language = strtolower($language); + + // get fullpath-filename for a langname + $fullpath = $this->language_path.$language.'.php'; + + // we need to get contents :S + if (false === ($data = file_get_contents($fullpath))) { + $this->error = sprintf('Geshi::get_lang_fullname() Unknown Language: %s', $language); + return false; + } + + // match the langname + if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+?)\'/', $data, $matches)) { + $this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language); + return false; + } + + // return fullname for langname + return stripcslashes($matches[1]); + } + + /** + * Sets the type of header to be used. + * + * If GESHI_HEADER_DIV is used, the code is surrounded in a "div".This + * means more source code but more control over tab width and line-wrapping. + * GESHI_HEADER_PRE means that a "pre" is used - less source, but less + * control. Default is GESHI_HEADER_PRE. + * + * From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code + * should be outputted. + * + * @param int The type of header to be used + * @since 1.0.0 + */ + function set_header_type($type) { + //Check if we got a valid header type + if (!in_array($type, array(GESHI_HEADER_NONE, GESHI_HEADER_DIV, + GESHI_HEADER_PRE, GESHI_HEADER_PRE_VALID, GESHI_HEADER_PRE_TABLE))) { + $this->error = GESHI_ERROR_INVALID_HEADER_TYPE; + return; + } + + //Set that new header type + $this->header_type = $type; + } + + /** + * Sets the styles for the code that will be outputted + * when this object is parsed. The style should be a + * string of valid stylesheet declarations + * + * @param string The overall style for the outputted code block + * @param boolean Whether to merge the styles with the current styles or not + * @since 1.0.0 + */ + function set_overall_style($style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->overall_style = $style; + } else { + $this->overall_style .= $style; + } + } + + /** + * Sets the overall classname for this block of code. This + * class can then be used in a stylesheet to style this object's + * output + * + * @param string The class name to use for this block of code + * @since 1.0.0 + */ + function set_overall_class($class) { + $this->overall_class = $class; + } + + /** + * Sets the overall id for this block of code. This id can then + * be used in a stylesheet to style this object's output + * + * @param string The ID to use for this block of code + * @since 1.0.0 + */ + function set_overall_id($id) { + $this->overall_id = $id; + } + + /** + * Sets whether CSS classes should be used to highlight the source. Default + * is off, calling this method with no arguments will turn it on + * + * @param boolean Whether to turn classes on or not + * @since 1.0.0 + */ + function enable_classes($flag = true) { + $this->use_classes = ($flag) ? true : false; + } + + /** + * Sets the style for the actual code. This should be a string + * containing valid stylesheet declarations. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * Note: Use this method to override any style changes you made to + * the line numbers if you are using line numbers, else the line of + * code will have the same style as the line number! Consult the + * GeSHi documentation for more information about this. + * + * @param string The style to use for actual code + * @param boolean Whether to merge the current styles with the new styles + * @since 1.0.2 + */ + function set_code_style($style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->code_style = $style; + } else { + $this->code_style .= $style; + } + } + + /** + * Sets the styles for the line numbers. + * + * @param string The style for the line numbers that are "normal" + * @param string|boolean If a string, this is the style of the line + * numbers that are "fancy", otherwise if boolean then this + * defines whether the normal styles should be merged with the + * new normal styles or not + * @param boolean If set, is the flag for whether to merge the "fancy" + * styles with the current styles or not + * @since 1.0.2 + */ + function set_line_style($style1, $style2 = '', $preserve_defaults = false) { + //Check if we got 2 or three parameters + if (is_bool($style2)) { + $preserve_defaults = $style2; + $style2 = ''; + } + + //Actually set the new styles + if (!$preserve_defaults) { + $this->line_style1 = $style1; + $this->line_style2 = $style2; + } else { + $this->line_style1 .= $style1; + $this->line_style2 .= $style2; + } + } + + /** + * Sets whether line numbers should be displayed. + * + * Valid values for the first parameter are: + * + * - GESHI_NO_LINE_NUMBERS: Line numbers will not be displayed + * - GESHI_NORMAL_LINE_NUMBERS: Line numbers will be displayed + * - GESHI_FANCY_LINE_NUMBERS: Fancy line numbers will be displayed + * + * For fancy line numbers, the second parameter is used to signal which lines + * are to be fancy. For example, if the value of this parameter is 5 then every + * 5th line will be fancy. + * + * @param int How line numbers should be displayed + * @param int Defines which lines are fancy + * @since 1.0.0 + */ + function enable_line_numbers($flag, $nth_row = 5) { + if (GESHI_NO_LINE_NUMBERS != $flag && GESHI_NORMAL_LINE_NUMBERS != $flag + && GESHI_FANCY_LINE_NUMBERS != $flag) { + $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE; + } + $this->line_numbers = $flag; + $this->line_nth_row = $nth_row; + } + + /** + * Sets wether spans and other HTML markup generated by GeSHi can + * span over multiple lines or not. Defaults to true to reduce overhead. + * Set it to false if you want to manipulate the output or manually display + * the code in an ordered list. + * + * @param boolean Wether multiline spans are allowed or not + * @since 1.0.7.22 + */ + function enable_multiline_span($flag) { + $this->allow_multiline_span = (bool) $flag; + } + + /** + * Get current setting for multiline spans, see GeSHi->enable_multiline_span(). + * + * @see enable_multiline_span + * @return bool + */ + function get_multiline_span() { + return $this->allow_multiline_span; + } + + /** + * Sets the style for a keyword group. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param int The key of the keyword group to change the styles of + * @param string The style to make the keywords + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + */ + function set_keyword_group_style($key, $style, $preserve_defaults = false) { + //Set the style for this keyword group + if (!$preserve_defaults) { + $this->language_data['STYLES']['KEYWORDS'][$key] = $style; + } else { + $this->language_data['STYLES']['KEYWORDS'][$key] .= $style; + } + + //Update the lexic permissions + if (!isset($this->lexic_permissions['KEYWORDS'][$key])) { + $this->lexic_permissions['KEYWORDS'][$key] = true; + } + } + + /** + * Turns highlighting on/off for a keyword group + * + * @param int The key of the keyword group to turn on or off + * @param boolean Whether to turn highlighting for that group on or off + * @since 1.0.0 + */ + function set_keyword_group_highlighting($key, $flag = true) { + $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false; + } + + /** + * Sets the styles for comment groups. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param int The key of the comment group to change the styles of + * @param string The style to make the comments + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + */ + function set_comments_style($key, $style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['COMMENTS'][$key] = $style; + } else { + $this->language_data['STYLES']['COMMENTS'][$key] .= $style; + } + } + + /** + * Turns highlighting on/off for comment groups + * + * @param int The key of the comment group to turn on or off + * @param boolean Whether to turn highlighting for that group on or off + * @since 1.0.0 + */ + function set_comments_highlighting($key, $flag = true) { + $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false; + } + + /** + * Sets the styles for escaped characters. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the escape characters + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + */ + function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style; + } else { + $this->language_data['STYLES']['ESCAPE_CHAR'][$group] .= $style; + } + } + + /** + * Turns highlighting on/off for escaped characters + * + * @param boolean Whether to turn highlighting for escape characters on or off + * @since 1.0.0 + */ + function set_escape_characters_highlighting($flag = true) { + $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false; + } + + /** + * Sets the styles for brackets. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * This method is DEPRECATED: use set_symbols_style instead. + * This method will be removed in 1.2.X + * + * @param string The style to make the brackets + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + * @deprecated In favour of set_symbols_style + */ + function set_brackets_style($style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['BRACKETS'][0] = $style; + } else { + $this->language_data['STYLES']['BRACKETS'][0] .= $style; + } + } + + /** + * Turns highlighting on/off for brackets + * + * This method is DEPRECATED: use set_symbols_highlighting instead. + * This method will be remove in 1.2.X + * + * @param boolean Whether to turn highlighting for brackets on or off + * @since 1.0.0 + * @deprecated In favour of set_symbols_highlighting + */ + function set_brackets_highlighting($flag) { + $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false; + } + + /** + * Sets the styles for symbols. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the symbols + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @param int Tells the group of symbols for which style should be set. + * @since 1.0.1 + */ + function set_symbols_style($style, $preserve_defaults = false, $group = 0) { + // Update the style of symbols + if (!$preserve_defaults) { + $this->language_data['STYLES']['SYMBOLS'][$group] = $style; + } else { + $this->language_data['STYLES']['SYMBOLS'][$group] .= $style; + } + + // For backward compatibility + if (0 == $group) { + $this->set_brackets_style ($style, $preserve_defaults); + } + } + + /** + * Turns highlighting on/off for symbols + * + * @param boolean Whether to turn highlighting for symbols on or off + * @since 1.0.0 + */ + function set_symbols_highlighting($flag) { + // Update lexic permissions for this symbol group + $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false; + + // For backward compatibility + $this->set_brackets_highlighting ($flag); + } + + /** + * Sets the styles for strings. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the escape characters + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @param int Tells the group of strings for which style should be set. + * @since 1.0.0 + */ + function set_strings_style($style, $preserve_defaults = false, $group = 0) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['STRINGS'][$group] = $style; + } else { + $this->language_data['STYLES']['STRINGS'][$group] .= $style; + } + } + + /** + * Turns highlighting on/off for strings + * + * @param boolean Whether to turn highlighting for strings on or off + * @since 1.0.0 + */ + function set_strings_highlighting($flag) { + $this->lexic_permissions['STRINGS'] = ($flag) ? true : false; + } + + /** + * Sets the styles for strict code blocks. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the script blocks + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @param int Tells the group of script blocks for which style should be set. + * @since 1.0.8.4 + */ + function set_script_style($style, $preserve_defaults = false, $group = 0) { + // Update the style of symbols + if (!$preserve_defaults) { + $this->language_data['STYLES']['SCRIPT'][$group] = $style; + } else { + $this->language_data['STYLES']['SCRIPT'][$group] .= $style; + } + } + + /** + * Sets the styles for numbers. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the numbers + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @param int Tells the group of numbers for which style should be set. + * @since 1.0.0 + */ + function set_numbers_style($style, $preserve_defaults = false, $group = 0) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['NUMBERS'][$group] = $style; + } else { + $this->language_data['STYLES']['NUMBERS'][$group] .= $style; + } + } + + /** + * Turns highlighting on/off for numbers + * + * @param boolean Whether to turn highlighting for numbers on or off + * @since 1.0.0 + */ + function set_numbers_highlighting($flag) { + $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false; + } + + /** + * Sets the styles for methods. $key is a number that references the + * appropriate "object splitter" - see the language file for the language + * you are highlighting to get this number. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param int The key of the object splitter to change the styles of + * @param string The style to make the methods + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + */ + function set_methods_style($key, $style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['METHODS'][$key] = $style; + } else { + $this->language_data['STYLES']['METHODS'][$key] .= $style; + } + } + + /** + * Turns highlighting on/off for methods + * + * @param boolean Whether to turn highlighting for methods on or off + * @since 1.0.0 + */ + function set_methods_highlighting($flag) { + $this->lexic_permissions['METHODS'] = ($flag) ? true : false; + } + + /** + * Sets the styles for regexps. If $preserve_defaults is + * true, then styles are merged with the default styles, with the + * user defined styles having priority + * + * @param string The style to make the regular expression matches + * @param boolean Whether to merge the new styles with the old or just + * to overwrite them + * @since 1.0.0 + */ + function set_regexps_style($key, $style, $preserve_defaults = false) { + if (!$preserve_defaults) { + $this->language_data['STYLES']['REGEXPS'][$key] = $style; + } else { + $this->language_data['STYLES']['REGEXPS'][$key] .= $style; + } + } + + /** + * Turns highlighting on/off for regexps + * + * @param int The key of the regular expression group to turn on or off + * @param boolean Whether to turn highlighting for the regular expression group on or off + * @since 1.0.0 + */ + function set_regexps_highlighting($key, $flag) { + $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false; + } + + /** + * Sets whether a set of keywords are checked for in a case sensitive manner + * + * @param int The key of the keyword group to change the case sensitivity of + * @param boolean Whether to check in a case sensitive manner or not + * @since 1.0.0 + */ + function set_case_sensitivity($key, $case) { + $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false; + } + + /** + * Sets the case that keywords should use when found. Use the constants: + * + * - GESHI_CAPS_NO_CHANGE: leave keywords as-is + * - GESHI_CAPS_UPPER: convert all keywords to uppercase where found + * - GESHI_CAPS_LOWER: convert all keywords to lowercase where found + * + * @param int A constant specifying what to do with matched keywords + * @since 1.0.1 + */ + function set_case_keywords($case) { + if (in_array($case, array( + GESHI_CAPS_NO_CHANGE, GESHI_CAPS_UPPER, GESHI_CAPS_LOWER))) { + $this->language_data['CASE_KEYWORDS'] = $case; + } + } + + /** + * Sets how many spaces a tab is substituted for + * + * Widths below zero are ignored + * + * @param int The tab width + * @since 1.0.0 + */ + function set_tab_width($width) { + $this->tab_width = intval($width); + + //Check if it fit's the constraints: + if ($this->tab_width < 1) { + //Return it to the default + $this->tab_width = 8; + } + } + + /** + * Sets whether or not to use tab-stop width specifed by language + * + * @param boolean Whether to use language-specific tab-stop widths + * @since 1.0.7.20 + */ + function set_use_language_tab_width($use) { + $this->use_language_tab_width = (bool) $use; + } + + /** + * Returns the tab width to use, based on the current language and user + * preference + * + * @return int Tab width + * @since 1.0.7.20 + */ + function get_real_tab_width() { + if (!$this->use_language_tab_width || + !isset($this->language_data['TAB_WIDTH'])) { + return $this->tab_width; + } else { + return $this->language_data['TAB_WIDTH']; + } + } + + /** + * Enables/disables strict highlighting. Default is off, calling this + * method without parameters will turn it on. See documentation + * for more details on strict mode and where to use it. + * + * @param boolean Whether to enable strict mode or not + * @since 1.0.0 + */ + function enable_strict_mode($mode = true) { + if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) { + $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER; + } + } + + /** + * Disables all highlighting + * + * @since 1.0.0 + * @todo Rewrite with array traversal + * @deprecated In favour of enable_highlighting + */ + function disable_highlighting() { + $this->enable_highlighting(false); + } + + /** + * Enables all highlighting + * + * The optional flag parameter was added in version 1.0.7.21 and can be used + * to enable (true) or disable (false) all highlighting. + * + * @since 1.0.0 + * @param boolean A flag specifying whether to enable or disable all highlighting + * @todo Rewrite with array traversal + */ + function enable_highlighting($flag = true) { + $flag = $flag ? true : false; + foreach ($this->lexic_permissions as $key => $value) { + if (is_array($value)) { + foreach ($value as $k => $v) { + $this->lexic_permissions[$key][$k] = $flag; + } + } else { + $this->lexic_permissions[$key] = $flag; + } + } + + // Context blocks + $this->enable_important_blocks = $flag; + } + + /** + * Given a file extension, this method returns either a valid geshi language + * name, or the empty string if it couldn't be found + * + * @param string The extension to get a language name for + * @param array A lookup array to use instead of the default one + * @since 1.0.5 + * @todo Re-think about how this method works (maybe make it private and/or make it + * a extension->lang lookup?) + * @todo static? + */ + function get_language_name_from_extension( $extension, $lookup = array() ) { + $extension = strtolower($extension); + + if ( !is_array($lookup) || empty($lookup)) { + $lookup = array( + '6502acme' => array( 'a', 's', 'asm', 'inc' ), + '6502tasm' => array( 'a', 's', 'asm', 'inc' ), + '6502kickass' => array( 'a', 's', 'asm', 'inc' ), + '68000devpac' => array( 'a', 's', 'asm', 'inc' ), + 'abap' => array('abap'), + 'actionscript' => array('as'), + 'ada' => array('a', 'ada', 'adb', 'ads'), + 'apache' => array('conf'), + 'asm' => array('ash', 'asm', 'inc'), + 'asp' => array('asp'), + 'bash' => array('sh'), + 'bf' => array('bf'), + 'c' => array('c', 'h'), + 'c_mac' => array('c', 'h'), + 'caddcl' => array(), + 'cadlisp' => array(), + 'cdfg' => array('cdfg'), + 'cobol' => array('cbl'), + 'cpp' => array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'), + 'csharp' => array('cs'), + 'css' => array('css'), + 'd' => array('d'), + 'delphi' => array('dpk', 'dpr', 'pp', 'pas'), + 'diff' => array('diff', 'patch'), + 'dos' => array('bat', 'cmd'), + 'gdb' => array('kcrash', 'crash', 'bt'), + 'gettext' => array('po', 'pot'), + 'gml' => array('gml'), + 'gnuplot' => array('plt'), + 'groovy' => array('groovy'), + 'haskell' => array('hs'), + 'haxe' => array('hx'), + 'html4strict' => array('html', 'htm'), + 'ini' => array('ini', 'desktop'), + 'java' => array('java'), + 'javascript' => array('js'), + 'klonec' => array('kl1'), + 'klonecpp' => array('klx'), + 'latex' => array('tex'), + 'lisp' => array('lisp'), + 'lua' => array('lua'), + 'matlab' => array('m'), + 'mpasm' => array(), + 'mysql' => array('sql'), + 'nsis' => array(), + 'objc' => array(), + 'oobas' => array(), + 'oracle8' => array(), + 'oracle10' => array(), + 'pascal' => array('pas'), + 'perl' => array('pl', 'pm'), + 'php' => array('php', 'php5', 'phtml', 'phps'), + 'povray' => array('pov'), + 'providex' => array('pvc', 'pvx'), + 'prolog' => array('pl'), + 'python' => array('py'), + 'qbasic' => array('bi'), + 'reg' => array('reg'), + 'ruby' => array('rb'), + 'sas' => array('sas'), + 'scala' => array('scala'), + 'scheme' => array('scm'), + 'scilab' => array('sci'), + 'smalltalk' => array('st'), + 'smarty' => array(), + 'tcl' => array('tcl'), + 'text' => array('txt'), + 'vb' => array('bas'), + 'vbnet' => array(), + 'visualfoxpro' => array(), + 'whitespace' => array('ws'), + 'xml' => array('xml', 'svg', 'xrc'), + 'z80' => array('z80', 'asm', 'inc') + ); + } + + foreach ($lookup as $lang => $extensions) { + if (in_array($extension, $extensions)) { + return $lang; + } + } + + return 'text'; + } + + /** + * Given a file name, this method loads its contents in, and attempts + * to set the language automatically. An optional lookup table can be + * passed for looking up the language name. If not specified a default + * table is used + * + * The language table is in the form + *
array(
+     *   'lang_name' => array('extension', 'extension', ...),
+     *   'lang_name' ...
+     * );
+ * + * @param string The filename to load the source from + * @param array A lookup array to use instead of the default one + * @todo Complete rethink of this and above method + * @since 1.0.5 + */ + function load_from_file($file_name, $lookup = array()) { + if (is_readable($file_name)) { + $this->set_source(file_get_contents($file_name)); + $this->set_language($this->get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $lookup)); + } else { + $this->error = GESHI_ERROR_FILE_NOT_READABLE; + } + } + + /** + * Adds a keyword to a keyword group for highlighting + * + * @param int The key of the keyword group to add the keyword to + * @param string The word to add to the keyword group + * @since 1.0.0 + */ + function add_keyword($key, $word) { + if (!is_array($this->language_data['KEYWORDS'][$key])) { + $this->language_data['KEYWORDS'][$key] = array(); + } + if (!in_array($word, $this->language_data['KEYWORDS'][$key])) { + $this->language_data['KEYWORDS'][$key][] = $word; + + //NEW in 1.0.8 don't recompile the whole optimized regexp, simply append it + if ($this->parse_cache_built) { + $subkey = count($this->language_data['CACHED_KEYWORD_LISTS'][$key]) - 1; + $this->language_data['CACHED_KEYWORD_LISTS'][$key][$subkey] .= '|' . preg_quote($word, '/'); + } + } + } + + /** + * Removes a keyword from a keyword group + * + * @param int The key of the keyword group to remove the keyword from + * @param string The word to remove from the keyword group + * @param bool Wether to automatically recompile the optimized regexp list or not. + * Note: if you set this to false and @see GeSHi->parse_code() was already called once, + * for the current language, you have to manually call @see GeSHi->optimize_keyword_group() + * or the removed keyword will stay in cache and still be highlighted! On the other hand + * it might be too expensive to recompile the regexp list for every removal if you want to + * remove a lot of keywords. + * @since 1.0.0 + */ + function remove_keyword($key, $word, $recompile = true) { + $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]); + if ($key_to_remove !== false) { + unset($this->language_data['KEYWORDS'][$key][$key_to_remove]); + + //NEW in 1.0.8, optionally recompile keyword group + if ($recompile && $this->parse_cache_built) { + $this->optimize_keyword_group($key); + } + } + } + + /** + * Creates a new keyword group + * + * @param int The key of the keyword group to create + * @param string The styles for the keyword group + * @param boolean Whether the keyword group is case sensitive ornot + * @param array The words to use for the keyword group + * @since 1.0.0 + */ + function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) { + $words = (array) $words; + if (empty($words)) { + // empty word lists mess up highlighting + return false; + } + + //Add the new keyword group internally + $this->language_data['KEYWORDS'][$key] = $words; + $this->lexic_permissions['KEYWORDS'][$key] = true; + $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive; + $this->language_data['STYLES']['KEYWORDS'][$key] = $styles; + + //NEW in 1.0.8, cache keyword regexp + if ($this->parse_cache_built) { + $this->optimize_keyword_group($key); + } + } + + /** + * Removes a keyword group + * + * @param int The key of the keyword group to remove + * @since 1.0.0 + */ + function remove_keyword_group ($key) { + //Remove the keyword group internally + unset($this->language_data['KEYWORDS'][$key]); + unset($this->lexic_permissions['KEYWORDS'][$key]); + unset($this->language_data['CASE_SENSITIVE'][$key]); + unset($this->language_data['STYLES']['KEYWORDS'][$key]); + + //NEW in 1.0.8 + unset($this->language_data['CACHED_KEYWORD_LISTS'][$key]); + } + + /** + * compile optimized regexp list for keyword group + * + * @param int The key of the keyword group to compile & optimize + * @since 1.0.8 + */ + function optimize_keyword_group($key) { + $this->language_data['CACHED_KEYWORD_LISTS'][$key] = + $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]); + $space_as_whitespace = false; + if(isset($this->language_data['PARSER_CONTROL'])) { + if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) { + if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) { + $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE']; + } + if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) { + if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) { + $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE']; + } + } + } + } + if($space_as_whitespace) { + foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) { + $this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] = + str_replace(" ", "\\s+", $rxv); + } + } + } + + /** + * Sets the content of the header block + * + * @param string The content of the header block + * @since 1.0.2 + */ + function set_header_content($content) { + $this->header_content = $content; + } + + /** + * Sets the content of the footer block + * + * @param string The content of the footer block + * @since 1.0.2 + */ + function set_footer_content($content) { + $this->footer_content = $content; + } + + /** + * Sets the style for the header content + * + * @param string The style for the header content + * @since 1.0.2 + */ + function set_header_content_style($style) { + $this->header_content_style = $style; + } + + /** + * Sets the style for the footer content + * + * @param string The style for the footer content + * @since 1.0.2 + */ + function set_footer_content_style($style) { + $this->footer_content_style = $style; + } + + /** + * Sets whether to force a surrounding block around + * the highlighted code or not + * + * @param boolean Tells whether to enable or disable this feature + * @since 1.0.7.20 + */ + function enable_inner_code_block($flag) { + $this->force_code_block = (bool)$flag; + } + + /** + * Sets the base URL to be used for keywords + * + * @param int The key of the keyword group to set the URL for + * @param string The URL to set for the group. If {FNAME} is in + * the url somewhere, it is replaced by the keyword + * that the URL is being made for + * @since 1.0.2 + */ + function set_url_for_keyword_group($group, $url) { + $this->language_data['URLS'][$group] = $url; + } + + /** + * Sets styles for links in code + * + * @param int A constant that specifies what state the style is being + * set for - e.g. :hover or :visited + * @param string The styles to use for that state + * @since 1.0.2 + */ + function set_link_styles($type, $styles) { + $this->link_styles[$type] = $styles; + } + + /** + * Sets the target for links in code + * + * @param string The target for links in the code, e.g. _blank + * @since 1.0.3 + */ + function set_link_target($target) { + if (!$target) { + $this->link_target = ''; + } else { + $this->link_target = ' target="' . $target . '"'; + } + } + + /** + * Sets styles for important parts of the code + * + * @param string The styles to use on important parts of the code + * @since 1.0.2 + */ + function set_important_styles($styles) { + $this->important_styles = $styles; + } + + /** + * Sets whether context-important blocks are highlighted + * + * @param boolean Tells whether to enable or disable highlighting of important blocks + * @todo REMOVE THIS SHIZ FROM GESHI! + * @deprecated + * @since 1.0.2 + */ + function enable_important_blocks($flag) { + $this->enable_important_blocks = ( $flag ) ? true : false; + } + + /** + * Whether CSS IDs should be added to each line + * + * @param boolean If true, IDs will be added to each line. + * @since 1.0.2 + */ + function enable_ids($flag = true) { + $this->add_ids = ($flag) ? true : false; + } + + /** + * Specifies which lines to highlight extra + * + * The extra style parameter was added in 1.0.7.21. + * + * @param mixed An array of line numbers to highlight, or just a line + * number on its own. + * @param string A string specifying the style to use for this line. + * If null is specified, the default style is used. + * If false is specified, the line will be removed from + * special highlighting + * @since 1.0.2 + * @todo Some data replication here that could be cut down on + */ + function highlight_lines_extra($lines, $style = null) { + if (is_array($lines)) { + //Split up the job using single lines at a time + foreach ($lines as $line) { + $this->highlight_lines_extra($line, $style); + } + } else { + //Mark the line as being highlighted specially + $lines = intval($lines); + $this->highlight_extra_lines[$lines] = $lines; + + //Decide on which style to use + if ($style === null) { //Check if we should use default style + unset($this->highlight_extra_lines_styles[$lines]); + } elseif ($style === false) { //Check if to remove this line + unset($this->highlight_extra_lines[$lines]); + unset($this->highlight_extra_lines_styles[$lines]); + } else { + $this->highlight_extra_lines_styles[$lines] = $style; + } + } + } + + /** + * Sets the style for extra-highlighted lines + * + * @param string The style for extra-highlighted lines + * @since 1.0.2 + */ + function set_highlight_lines_extra_style($styles) { + $this->highlight_extra_lines_style = $styles; + } + + /** + * Sets the line-ending + * + * @param string The new line-ending + * @since 1.0.2 + */ + function set_line_ending($line_ending) { + $this->line_ending = (string)$line_ending; + } + + /** + * Sets what number line numbers should start at. Should + * be a positive integer, and will be converted to one. + * + * Warning: Using this method will add the "start" + * attribute to the <ol> that is used for line numbering. + * This is not valid XHTML strict, so if that's what you + * care about then don't use this method. Firefox is getting + * support for the CSS method of doing this in 1.1 and Opera + * has support for the CSS method, but (of course) IE doesn't + * so it's not worth doing it the CSS way yet. + * + * @param int The number to start line numbers at + * @since 1.0.2 + */ + function start_line_numbers_at($number) { + $this->line_numbers_start = abs(intval($number)); + } + + /** + * Sets the encoding used for htmlspecialchars(), for international + * support. + * + * NOTE: This is not needed for now because htmlspecialchars() is not + * being used (it has a security hole in PHP4 that has not been patched). + * Maybe in a future version it may make a return for speed reasons, but + * I doubt it. + * + * @param string The encoding to use for the source + * @since 1.0.3 + */ + function set_encoding($encoding) { + if ($encoding) { + $this->encoding = strtolower($encoding); + } + } + + /** + * Turns linking of keywords on or off. + * + * @param boolean If true, links will be added to keywords + * @since 1.0.2 + */ + function enable_keyword_links($enable = true) { + $this->keyword_links = (bool) $enable; + } + + /** + * Setup caches needed for styling. This is automatically called in + * parse_code() and get_stylesheet() when appropriate. This function helps + * stylesheet generators as they rely on some style information being + * preprocessed + * + * @since 1.0.8 + * @access private + */ + function build_style_cache() { + //Build the style cache needed to highlight numbers appropriate + if($this->lexic_permissions['NUMBERS']) { + //First check what way highlighting information for numbers are given + if(!isset($this->language_data['NUMBERS'])) { + $this->language_data['NUMBERS'] = 0; + } + + if(is_array($this->language_data['NUMBERS'])) { + $this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS']; + } else { + $this->language_data['NUMBERS_CACHE'] = array(); + if(!$this->language_data['NUMBERS']) { + $this->language_data['NUMBERS'] = + GESHI_NUMBER_INT_BASIC | + GESHI_NUMBER_FLT_NONSCI; + } + + for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) { + //Rearrange style indices if required ... + if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) { + $this->language_data['STYLES']['NUMBERS'][$i] = + $this->language_data['STYLES']['NUMBERS'][1<<$i]; + unset($this->language_data['STYLES']['NUMBERS'][1<<$i]); + } + + //Check if this bit is set for highlighting + if($j&1) { + //So this bit is set ... + //Check if it belongs to group 0 or the actual stylegroup + if(isset($this->language_data['STYLES']['NUMBERS'][$i])) { + $this->language_data['NUMBERS_CACHE'][$i] = 1 << $i; + } else { + if(!isset($this->language_data['NUMBERS_CACHE'][0])) { + $this->language_data['NUMBERS_CACHE'][0] = 0; + } + $this->language_data['NUMBERS_CACHE'][0] |= 1 << $i; + } + } + } + } + } + } + + /** + * Setup caches needed for parsing. This is automatically called in parse_code() when appropriate. + * This function makes stylesheet generators much faster as they do not need these caches. + * + * @since 1.0.8 + * @access private + */ + function build_parse_cache() { + // cache symbol regexp + //As this is a costy operation, we avoid doing it for multiple groups ... + //Instead we perform it for all symbols at once. + // + //For this to work, we need to reorganize the data arrays. + if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) { + $this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) > 1; + + $this->language_data['SYMBOL_DATA'] = array(); + $symbol_preg_multi = array(); // multi char symbols + $symbol_preg_single = array(); // single char symbols + foreach ($this->language_data['SYMBOLS'] as $key => $symbols) { + if (is_array($symbols)) { + foreach ($symbols as $sym) { + $sym = $this->hsc($sym); + if (!isset($this->language_data['SYMBOL_DATA'][$sym])) { + $this->language_data['SYMBOL_DATA'][$sym] = $key; + if (isset($sym[1])) { // multiple chars + $symbol_preg_multi[] = preg_quote($sym, '/'); + } else { // single char + if ($sym == '-') { + // don't trigger range out of order error + $symbol_preg_single[] = '\-'; + } else { + $symbol_preg_single[] = preg_quote($sym, '/'); + } + } + } + } + } else { + $symbols = $this->hsc($symbols); + if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) { + $this->language_data['SYMBOL_DATA'][$symbols] = 0; + if (isset($symbols[1])) { // multiple chars + $symbol_preg_multi[] = preg_quote($symbols, '/'); + } elseif ($symbols == '-') { + // don't trigger range out of order error + $symbol_preg_single[] = '\-'; + } else { // single char + $symbol_preg_single[] = preg_quote($symbols, '/'); + } + } + } + } + + //Now we have an array with each possible symbol as the key and the style as the actual data. + //This way we can set the correct style just the moment we highlight ... + // + //Now we need to rewrite our array to get a search string that + $symbol_preg = array(); + if (!empty($symbol_preg_multi)) { + rsort($symbol_preg_multi); + $symbol_preg[] = implode('|', $symbol_preg_multi); + } + if (!empty($symbol_preg_single)) { + rsort($symbol_preg_single); + $symbol_preg[] = '[' . implode('', $symbol_preg_single) . ']'; + } + $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg); + } + + // cache optimized regexp for keyword matching + // remove old cache + $this->language_data['CACHED_KEYWORD_LISTS'] = array(); + foreach (array_keys($this->language_data['KEYWORDS']) as $key) { + if (!isset($this->lexic_permissions['KEYWORDS'][$key]) || + $this->lexic_permissions['KEYWORDS'][$key]) { + $this->optimize_keyword_group($key); + } + } + + // brackets + if ($this->lexic_permissions['BRACKETS']) { + $this->language_data['CACHE_BRACKET_MATCH'] = array('[', ']', '(', ')', '{', '}'); + if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) { + $this->language_data['CACHE_BRACKET_REPLACE'] = array( + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">[|>', + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">]|>', + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">(|>', + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">)|>', + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">{|>', + '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">}|>', + ); + } + else { + $this->language_data['CACHE_BRACKET_REPLACE'] = array( + '<| class="br0">[|>', + '<| class="br0">]|>', + '<| class="br0">(|>', + '<| class="br0">)|>', + '<| class="br0">{|>', + '<| class="br0">}|>', + ); + } + } + + //Build the parse cache needed to highlight numbers appropriate + if($this->lexic_permissions['NUMBERS']) { + //Check if the style rearrangements have been processed ... + //This also does some preprocessing to check which style groups are useable ... + if(!isset($this->language_data['NUMBERS_CACHE'])) { + $this->build_style_cache(); + } + + //Number format specification + //All this formats are matched case-insensitively! + static $numbers_format = array( + GESHI_NUMBER_INT_BASIC => + '(?:(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(? + '(?language_data['NUMBERS_RXCACHE'] = array(); + foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) { + if(is_string($rxdata)) { + $regexp = $rxdata; + } else { + //This is a bitfield of number flags to highlight: + //Build an array, implode them together and make this the actual RX + $rxuse = array(); + for($i = 1; $i <= $rxdata; $i<<=1) { + if($rxdata & $i) { + $rxuse[] = $numbers_format[$i]; + } + } + $regexp = implode("|", $rxuse); + } + + $this->language_data['NUMBERS_RXCACHE'][$key] = + "/(?)($regexp)(?!(?:|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i"; // + } + + if(!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) { + $this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#'; + } + } + + $this->parse_cache_built = true; + } + + /** + * Returns the code in $this->source, highlighted and surrounded by the + * nessecary HTML. + * + * This should only be called ONCE, cos it's SLOW! If you want to highlight + * the same source multiple times, you're better off doing a whole lot of + * str_replaces to replace the <span>s + * + * @since 1.0.0 + */ + function parse_code () { + // Start the timer + $start_time = microtime(); + + // Replace all newlines to a common form. + $code = str_replace("\r\n", "\n", $this->source); + $code = str_replace("\r", "\n", $code); + + // Firstly, if there is an error, we won't highlight + if ($this->error) { + //Escape the source for output + $result = $this->hsc($this->source); + + //This fix is related to SF#1923020, but has to be applied regardless of + //actually highlighting symbols. + $result = str_replace(array('', ''), array(';', '|'), $result); + + // Timing is irrelevant + $this->set_time($start_time, $start_time); + $this->finalise($result); + return $result; + } + + // make sure the parse cache is up2date + if (!$this->parse_cache_built) { + $this->build_parse_cache(); + } + + // Initialise various stuff + $length = strlen($code); + $COMMENT_MATCHED = false; + $stuff_to_parse = ''; + $endresult = ''; + + // "Important" selections are handled like multiline comments + // @todo GET RID OF THIS SHIZ + if ($this->enable_important_blocks) { + $this->language_data['COMMENT_MULTI'][GESHI_START_IMPORTANT] = GESHI_END_IMPORTANT; + } + + if ($this->strict_mode) { + // Break the source into bits. Each bit will be a portion of the code + // within script delimiters - for example, HTML between < and > + $k = 0; + $parts = array(); + $matches = array(); + $next_match_pointer = null; + // we use a copy to unset delimiters on demand (when they are not found) + $delim_copy = $this->language_data['SCRIPT_DELIMITERS']; + $i = 0; + while ($i < $length) { + $next_match_pos = $length + 1; // never true + foreach ($delim_copy as $dk => $delimiters) { + if(is_array($delimiters)) { + foreach ($delimiters as $open => $close) { + // make sure the cache is setup properly + if (!isset($matches[$dk][$open])) { + $matches[$dk][$open] = array( + 'next_match' => -1, + 'dk' => $dk, + + 'open' => $open, // needed for grouping of adjacent code blocks (see below) + 'open_strlen' => strlen($open), + + 'close' => $close, + 'close_strlen' => strlen($close), + ); + } + // Get the next little bit for this opening string + if ($matches[$dk][$open]['next_match'] < $i) { + // only find the next pos if it was not already cached + $open_pos = strpos($code, $open, $i); + if ($open_pos === false) { + // no match for this delimiter ever + unset($delim_copy[$dk][$open]); + continue; + } + $matches[$dk][$open]['next_match'] = $open_pos; + } + if ($matches[$dk][$open]['next_match'] < $next_match_pos) { + //So we got a new match, update the close_pos + $matches[$dk][$open]['close_pos'] = + strpos($code, $close, $matches[$dk][$open]['next_match']+1); + + $next_match_pointer =& $matches[$dk][$open]; + $next_match_pos = $matches[$dk][$open]['next_match']; + } + } + } else { + //So we should match an RegExp as Strict Block ... + /** + * The value in $delimiters is expected to be an RegExp + * containing exactly 2 matching groups: + * - Group 1 is the opener + * - Group 2 is the closer + */ + if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work. + preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) { + //We got a match ... + if(isset($matches_rx['start']) && isset($matches_rx['end'])) + { + $matches[$dk] = array( + 'next_match' => $matches_rx['start'][1], + 'dk' => $dk, + + 'close_strlen' => strlen($matches_rx['end'][0]), + 'close_pos' => $matches_rx['end'][1], + ); + } else { + $matches[$dk] = array( + 'next_match' => $matches_rx[1][1], + 'dk' => $dk, + + 'close_strlen' => strlen($matches_rx[2][0]), + 'close_pos' => $matches_rx[2][1], + ); + } + } else { + // no match for this delimiter ever + unset($delim_copy[$dk]); + continue; + } + + if ($matches[$dk]['next_match'] <= $next_match_pos) { + $next_match_pointer =& $matches[$dk]; + $next_match_pos = $matches[$dk]['next_match']; + } + } + } + + // non-highlightable text + $parts[$k] = array( + 1 => substr($code, $i, $next_match_pos - $i) + ); + ++$k; + + if ($next_match_pos > $length) { + // out of bounds means no next match was found + break; + } + + // highlightable code + $parts[$k][0] = $next_match_pointer['dk']; + + //Only combine for non-rx script blocks + if(is_array($delim_copy[$next_match_pointer['dk']])) { + // group adjacent script blocks, e.g. should be one block, not three! + $i = $next_match_pos + $next_match_pointer['open_strlen']; + while (true) { + $close_pos = strpos($code, $next_match_pointer['close'], $i); + if ($close_pos == false) { + break; + } + $i = $close_pos + $next_match_pointer['close_strlen']; + if ($i == $length) { + break; + } + if ($code[$i] == $next_match_pointer['open'][0] && ($next_match_pointer['open_strlen'] == 1 || + substr($code, $i, $next_match_pointer['open_strlen']) == $next_match_pointer['open'])) { + // merge adjacent but make sure we don't merge things like + foreach ($matches as $submatches) { + foreach ($submatches as $match) { + if ($match['next_match'] == $i) { + // a different block already matches here! + break 3; + } + } + } + } else { + break; + } + } + } else { + $close_pos = $next_match_pointer['close_pos'] + $next_match_pointer['close_strlen']; + $i = $close_pos; + } + + if ($close_pos === false) { + // no closing delimiter found! + $parts[$k][1] = substr($code, $next_match_pos); + ++$k; + break; + } else { + $parts[$k][1] = substr($code, $next_match_pos, $i - $next_match_pos); + ++$k; + } + } + unset($delim_copy, $next_match_pointer, $next_match_pos, $matches); + $num_parts = $k; + + if ($num_parts == 1 && $this->strict_mode == GESHI_MAYBE) { + // when we have only one part, we don't have anything to highlight at all. + // if we have a "maybe" strict language, this should be handled as highlightable code + $parts = array( + 0 => array( + 0 => '', + 1 => '' + ), + 1 => array( + 0 => null, + 1 => $parts[0][1] + ) + ); + $num_parts = 2; + } + + } else { + // Not strict mode - simply dump the source into + // the array at index 1 (the first highlightable block) + $parts = array( + 0 => array( + 0 => '', + 1 => '' + ), + 1 => array( + 0 => null, + 1 => $code + ) + ); + $num_parts = 2; + } + + //Unset variables we won't need any longer + unset($code); + + //Preload some repeatedly used values regarding hardquotes ... + $hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false; + $hq_strlen = strlen($hq); + + //Preload if line numbers are to be generated afterwards + //Added a check if line breaks should be forced even without line numbers, fixes SF#1727398 + $check_linenumbers = $this->line_numbers != GESHI_NO_LINE_NUMBERS || + !empty($this->highlight_extra_lines) || !$this->allow_multiline_span; + + //preload the escape char for faster checking ... + $escaped_escape_char = $this->hsc($this->language_data['ESCAPE_CHAR']); + + // this is used for single-line comments + $sc_disallowed_before = ""; + $sc_disallowed_after = ""; + + if (isset($this->language_data['PARSER_CONTROL'])) { + if (isset($this->language_data['PARSER_CONTROL']['COMMENTS'])) { + if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'])) { + $sc_disallowed_before = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE']; + } + if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'])) { + $sc_disallowed_after = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER']; + } + } + } + + //Fix for SF#1932083: Multichar Quotemarks unsupported + $is_string_starter = array(); + if ($this->lexic_permissions['STRINGS']) { + foreach ($this->language_data['QUOTEMARKS'] as $quotemark) { + if (!isset($is_string_starter[$quotemark[0]])) { + $is_string_starter[$quotemark[0]] = (string)$quotemark; + } elseif (is_string($is_string_starter[$quotemark[0]])) { + $is_string_starter[$quotemark[0]] = array( + $is_string_starter[$quotemark[0]], + $quotemark); + } else { + $is_string_starter[$quotemark[0]][] = $quotemark; + } + } + } + + // Now we go through each part. We know that even-indexed parts are + // code that shouldn't be highlighted, and odd-indexed parts should + // be highlighted + for ($key = 0; $key < $num_parts; ++$key) { + $STRICTATTRS = ''; + + // If this block should be highlighted... + if (!($key & 1)) { + // Else not a block to highlight + $endresult .= $this->hsc($parts[$key][1]); + unset($parts[$key]); + continue; + } + + $result = ''; + $part = $parts[$key][1]; + + $highlight_part = true; + if ($this->strict_mode && !is_null($parts[$key][0])) { + // get the class key for this block of code + $script_key = $parts[$key][0]; + $highlight_part = $this->language_data['HIGHLIGHT_STRICT_BLOCK'][$script_key]; + if ($this->language_data['STYLES']['SCRIPT'][$script_key] != '' && + $this->lexic_permissions['SCRIPT']) { + // Add a span element around the source to + // highlight the overall source block + if (!$this->use_classes && + $this->language_data['STYLES']['SCRIPT'][$script_key] != '') { + $attributes = ' style="' . $this->language_data['STYLES']['SCRIPT'][$script_key] . '"'; + } else { + $attributes = ' class="sc' . $script_key . '"'; + } + $result .= ""; + $STRICTATTRS = $attributes; + } + } + + if ($highlight_part) { + // Now, highlight the code in this block. This code + // is really the engine of GeSHi (along with the method + // parse_non_string_part). + + // cache comment regexps incrementally + $next_comment_regexp_key = ''; + $next_comment_regexp_pos = -1; + $next_comment_multi_pos = -1; + $next_comment_single_pos = -1; + $comment_regexp_cache_per_key = array(); + $comment_multi_cache_per_key = array(); + $comment_single_cache_per_key = array(); + $next_open_comment_multi = ''; + $next_comment_single_key = ''; + $escape_regexp_cache_per_key = array(); + $next_escape_regexp_key = ''; + $next_escape_regexp_pos = -1; + + $length = strlen($part); + for ($i = 0; $i < $length; ++$i) { + // Get the next char + $char = $part[$i]; + $char_len = 1; + + // update regexp comment cache if needed + if (isset($this->language_data['COMMENT_REGEXP']) && $next_comment_regexp_pos < $i) { + $next_comment_regexp_pos = $length; + foreach ($this->language_data['COMMENT_REGEXP'] as $comment_key => $regexp) { + $match_i = false; + if (isset($comment_regexp_cache_per_key[$comment_key]) && + ($comment_regexp_cache_per_key[$comment_key]['pos'] >= $i || + $comment_regexp_cache_per_key[$comment_key]['pos'] === false)) { + // we have already matched something + if ($comment_regexp_cache_per_key[$comment_key]['pos'] === false) { + // this comment is never matched + continue; + } + $match_i = $comment_regexp_cache_per_key[$comment_key]['pos']; + } elseif ( + //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible + (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $i), $match, PREG_OFFSET_CAPTURE)) || + (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i)) + ) { + $match_i = $match[0][1]; + if (GESHI_PHP_PRE_433) { + $match_i += $i; + } + + $comment_regexp_cache_per_key[$comment_key] = array( + 'key' => $comment_key, + 'length' => strlen($match[0][0]), + 'pos' => $match_i + ); + } else { + $comment_regexp_cache_per_key[$comment_key]['pos'] = false; + continue; + } + + if ($match_i !== false && $match_i < $next_comment_regexp_pos) { + $next_comment_regexp_pos = $match_i; + $next_comment_regexp_key = $comment_key; + if ($match_i === $i) { + break; + } + } + } + } + + $string_started = false; + + if (isset($is_string_starter[$char])) { + // Possibly the start of a new string ... + + //Check which starter it was ... + //Fix for SF#1932083: Multichar Quotemarks unsupported + if (is_array($is_string_starter[$char])) { + $char_new = ''; + foreach ($is_string_starter[$char] as $testchar) { + if ($testchar === substr($part, $i, strlen($testchar)) && + strlen($testchar) > strlen($char_new)) { + $char_new = $testchar; + $string_started = true; + } + } + if ($string_started) { + $char = $char_new; + } + } else { + $testchar = $is_string_starter[$char]; + if ($testchar === substr($part, $i, strlen($testchar))) { + $char = $testchar; + $string_started = true; + } + } + $char_len = strlen($char); + } + + if ($string_started && ($i != $next_comment_regexp_pos)) { + // Hand out the correct style information for this string + $string_key = array_search($char, $this->language_data['QUOTEMARKS']); + if (!isset($this->language_data['STYLES']['STRINGS'][$string_key]) || + !isset($this->language_data['STYLES']['ESCAPE_CHAR'][$string_key])) { + $string_key = 0; + } + + // parse the stuff before this + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + + if (!$this->use_classes) { + $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"'; + } else { + $string_attributes = ' class="st'.$string_key.'"'; + } + + // now handle the string + $string = "" . GeSHi::hsc($char); + $start = $i + $char_len; + $string_open = true; + + if(empty($this->language_data['ESCAPE_REGEXP'])) { + $next_escape_regexp_pos = $length; + } + + do { + //Get the regular ending pos ... + $close_pos = strpos($part, $char, $start); + if(false === $close_pos) { + $close_pos = $length; + } + + if($this->lexic_permissions['ESCAPE_CHAR']) { + // update escape regexp cache if needed + if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) { + $next_escape_regexp_pos = $length; + foreach ($this->language_data['ESCAPE_REGEXP'] as $escape_key => $regexp) { + $match_i = false; + if (isset($escape_regexp_cache_per_key[$escape_key]) && + ($escape_regexp_cache_per_key[$escape_key]['pos'] >= $start || + $escape_regexp_cache_per_key[$escape_key]['pos'] === false)) { + // we have already matched something + if ($escape_regexp_cache_per_key[$escape_key]['pos'] === false) { + // this comment is never matched + continue; + } + $match_i = $escape_regexp_cache_per_key[$escape_key]['pos']; + } elseif ( + //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible + (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $start), $match, PREG_OFFSET_CAPTURE)) || + (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start)) + ) { + $match_i = $match[0][1]; + if (GESHI_PHP_PRE_433) { + $match_i += $start; + } + + $escape_regexp_cache_per_key[$escape_key] = array( + 'key' => $escape_key, + 'length' => strlen($match[0][0]), + 'pos' => $match_i + ); + } else { + $escape_regexp_cache_per_key[$escape_key]['pos'] = false; + continue; + } + + if ($match_i !== false && $match_i < $next_escape_regexp_pos) { + $next_escape_regexp_pos = $match_i; + $next_escape_regexp_key = $escape_key; + if ($match_i === $start) { + break; + } + } + } + } + + //Find the next simple escape position + if('' != $this->language_data['ESCAPE_CHAR']) { + $simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start); + if(false === $simple_escape) { + $simple_escape = $length; + } + } else { + $simple_escape = $length; + } + } else { + $next_escape_regexp_pos = $length; + $simple_escape = $length; + } + + if($simple_escape < $next_escape_regexp_pos && + $simple_escape < $length && + $simple_escape < $close_pos) { + //The nexxt escape sequence is a simple one ... + $es_pos = $simple_escape; + + //Add the stuff not in the string yet ... + $string .= $this->hsc(substr($part, $start, $es_pos - $start)); + + //Get the style for this escaped char ... + if (!$this->use_classes) { + $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][0] . '"'; + } else { + $escape_char_attributes = ' class="es0"'; + } + + //Add the style for the escape char ... + $string .= "" . + GeSHi::hsc($this->language_data['ESCAPE_CHAR']); + + //Get the byte AFTER the ESCAPE_CHAR we just found + $es_char = $part[$es_pos + 1]; + if ($es_char == "\n") { + // don't put a newline around newlines + $string .= "\n"; + $start = $es_pos + 2; + } elseif (ord($es_char) >= 128) { + //This is an non-ASCII char (UTF8 or single byte) + //This code tries to work around SF#2037598 ... + if(function_exists('mb_substr')) { + $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding); + $string .= $es_char_m . ''; + } elseif (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) { + if(preg_match("/[\xC2-\xDF][\x80-\xBF]". + "|\xE0[\xA0-\xBF][\x80-\xBF]". + "|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}". + "|\xED[\x80-\x9F][\x80-\xBF]". + "|\xF0[\x90-\xBF][\x80-\xBF]{2}". + "|[\xF1-\xF3][\x80-\xBF]{3}". + "|\xF4[\x80-\x8F][\x80-\xBF]{2}/s", + $part, $es_char_m, null, $es_pos + 1)) { + $es_char_m = $es_char_m[0]; + } else { + $es_char_m = $es_char; + } + $string .= $this->hsc($es_char_m) . ''; + } else { + $es_char_m = $this->hsc($es_char); + } + $start = $es_pos + strlen($es_char_m) + 1; + } else { + $string .= $this->hsc($es_char) . ''; + $start = $es_pos + 2; + } + } elseif ($next_escape_regexp_pos < $length && + $next_escape_regexp_pos < $close_pos) { + $es_pos = $next_escape_regexp_pos; + //Add the stuff not in the string yet ... + $string .= $this->hsc(substr($part, $start, $es_pos - $start)); + + //Get the key and length of this match ... + $escape = $escape_regexp_cache_per_key[$next_escape_regexp_key]; + $escape_str = substr($part, $es_pos, $escape['length']); + $escape_key = $escape['key']; + + //Get the style for this escaped char ... + if (!$this->use_classes) { + $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][$escape_key] . '"'; + } else { + $escape_char_attributes = ' class="es' . $escape_key . '"'; + } + + //Add the style for the escape char ... + $string .= "" . + $this->hsc($escape_str) . ''; + + $start = $es_pos + $escape['length']; + } else { + //Copy the remainder of the string ... + $string .= $this->hsc(substr($part, $start, $close_pos - $start + $char_len)) . ''; + $start = $close_pos + $char_len; + $string_open = false; + } + } while($string_open); + + if ($check_linenumbers) { + // Are line numbers used? If, we should end the string before + // the newline and begin it again (so when
  • s are put in the source + // remains XHTML compliant) + // note to self: This opens up possibility of config files specifying + // that languages can/cannot have multiline strings??? + $string = str_replace("\n", "\n", $string); + } + + $result .= $string; + $string = ''; + $i = $start - 1; + continue; + } elseif ($this->lexic_permissions['STRINGS'] && $hq && $hq[0] == $char && + substr($part, $i, $hq_strlen) == $hq && ($i != $next_comment_regexp_pos)) { + // The start of a hard quoted string + if (!$this->use_classes) { + $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS']['HARD'] . '"'; + $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR']['HARD'] . '"'; + } else { + $string_attributes = ' class="st_h"'; + $escape_char_attributes = ' class="es_h"'; + } + // parse the stuff before this + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + + // now handle the string + $string = ''; + + // look for closing quote + $start = $i + $hq_strlen; + while ($close_pos = strpos($part, $this->language_data['HARDQUOTE'][1], $start)) { + $start = $close_pos + 1; + if ($this->lexic_permissions['ESCAPE_CHAR'] && $part[$close_pos - 1] == $this->language_data['HARDCHAR'] && + (($i + $hq_strlen) != ($close_pos))) { //Support empty string for HQ escapes if Starter = Escape + // make sure this quote is not escaped + foreach ($this->language_data['HARDESCAPE'] as $hardescape) { + if (substr($part, $close_pos - 1, strlen($hardescape)) == $hardescape) { + // check wether this quote is escaped or if it is something like '\\' + $escape_char_pos = $close_pos - 1; + while ($escape_char_pos > 0 + && $part[$escape_char_pos - 1] == $this->language_data['HARDCHAR']) { + --$escape_char_pos; + } + if (($close_pos - $escape_char_pos) & 1) { + // uneven number of escape chars => this quote is escaped + continue 2; + } + } + } + } + + // found closing quote + break; + } + + //Found the closing delimiter? + if (!$close_pos) { + // span till the end of this $part when no closing delimiter is found + $close_pos = $length; + } + + //Get the actual string + $string = substr($part, $i, $close_pos - $i + 1); + $i = $close_pos; + + // handle escape chars and encode html chars + // (special because when we have escape chars within our string they may not be escaped) + if ($this->lexic_permissions['ESCAPE_CHAR'] && $this->language_data['ESCAPE_CHAR']) { + $start = 0; + $new_string = ''; + while ($es_pos = strpos($string, $this->language_data['ESCAPE_CHAR'], $start)) { + // hmtl escape stuff before + $new_string .= $this->hsc(substr($string, $start, $es_pos - $start)); + // check if this is a hard escape + foreach ($this->language_data['HARDESCAPE'] as $hardescape) { + if (substr($string, $es_pos, strlen($hardescape)) == $hardescape) { + // indeed, this is a hardescape + $new_string .= "" . + $this->hsc($hardescape) . ''; + $start = $es_pos + strlen($hardescape); + continue 2; + } + } + // not a hard escape, but a normal escape + // they come in pairs of two + $c = 0; + while (isset($string[$es_pos + $c]) && isset($string[$es_pos + $c + 1]) + && $string[$es_pos + $c] == $this->language_data['ESCAPE_CHAR'] + && $string[$es_pos + $c + 1] == $this->language_data['ESCAPE_CHAR']) { + $c += 2; + } + if ($c) { + $new_string .= "" . + str_repeat($escaped_escape_char, $c) . + ''; + $start = $es_pos + $c; + } else { + // this is just a single lonely escape char... + $new_string .= $escaped_escape_char; + $start = $es_pos + 1; + } + } + $string = $new_string . $this->hsc(substr($string, $start)); + } else { + $string = $this->hsc($string); + } + + if ($check_linenumbers) { + // Are line numbers used? If, we should end the string before + // the newline and begin it again (so when
  • s are put in the source + // remains XHTML compliant) + // note to self: This opens up possibility of config files specifying + // that languages can/cannot have multiline strings??? + $string = str_replace("\n", "\n", $string); + } + + $result .= "" . $string . ''; + $string = ''; + continue; + } else { + //Have a look for regexp comments + if ($i == $next_comment_regexp_pos) { + $COMMENT_MATCHED = true; + $comment = $comment_regexp_cache_per_key[$next_comment_regexp_key]; + $test_str = $this->hsc(substr($part, $i, $comment['length'])); + + //@todo If remove important do remove here + if ($this->lexic_permissions['COMMENTS']['MULTI']) { + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment['key']] . '"'; + } else { + $attributes = ' class="co' . $comment['key'] . '"'; + } + + $test_str = "" . $test_str . ""; + + // Short-cut through all the multiline code + if ($check_linenumbers) { + // strreplace to put close span and open span around multiline newlines + $test_str = str_replace( + "\n", "\n", + str_replace("\n ", "\n ", $test_str) + ); + } + } + + $i += $comment['length'] - 1; + + // parse the rest + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + } + + // If we haven't matched a regexp comment, try multi-line comments + if (!$COMMENT_MATCHED) { + // Is this a multiline comment? + if (!empty($this->language_data['COMMENT_MULTI']) && $next_comment_multi_pos < $i) { + $next_comment_multi_pos = $length; + foreach ($this->language_data['COMMENT_MULTI'] as $open => $close) { + $match_i = false; + if (isset($comment_multi_cache_per_key[$open]) && + ($comment_multi_cache_per_key[$open] >= $i || + $comment_multi_cache_per_key[$open] === false)) { + // we have already matched something + if ($comment_multi_cache_per_key[$open] === false) { + // this comment is never matched + continue; + } + $match_i = $comment_multi_cache_per_key[$open]; + } elseif (($match_i = stripos($part, $open, $i)) !== false) { + $comment_multi_cache_per_key[$open] = $match_i; + } else { + $comment_multi_cache_per_key[$open] = false; + continue; + } + if ($match_i !== false && $match_i < $next_comment_multi_pos) { + $next_comment_multi_pos = $match_i; + $next_open_comment_multi = $open; + if ($match_i === $i) { + break; + } + } + } + } + if ($i == $next_comment_multi_pos) { + $open = $next_open_comment_multi; + $close = $this->language_data['COMMENT_MULTI'][$open]; + $open_strlen = strlen($open); + $close_strlen = strlen($close); + $COMMENT_MATCHED = true; + $test_str_match = $open; + //@todo If remove important do remove here + if ($this->lexic_permissions['COMMENTS']['MULTI'] || + $open == GESHI_START_IMPORTANT) { + if ($open != GESHI_START_IMPORTANT) { + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS']['MULTI'] . '"'; + } else { + $attributes = ' class="coMULTI"'; + } + $test_str = "" . $this->hsc($open); + } else { + if (!$this->use_classes) { + $attributes = ' style="' . $this->important_styles . '"'; + } else { + $attributes = ' class="imp"'; + } + + // We don't include the start of the comment if it's an + // "important" part + $test_str = ""; + } + } else { + $test_str = $this->hsc($open); + } + + $close_pos = strpos( $part, $close, $i + $open_strlen ); + + if ($close_pos === false) { + $close_pos = $length; + } + + // Short-cut through all the multiline code + $rest_of_comment = $this->hsc(substr($part, $i + $open_strlen, $close_pos - $i - $open_strlen + $close_strlen)); + if (($this->lexic_permissions['COMMENTS']['MULTI'] || + $test_str_match == GESHI_START_IMPORTANT) && + $check_linenumbers) { + + // strreplace to put close span and open span around multiline newlines + $test_str .= str_replace( + "\n", "\n", + str_replace("\n ", "\n ", $rest_of_comment) + ); + } else { + $test_str .= $rest_of_comment; + } + + if ($this->lexic_permissions['COMMENTS']['MULTI'] || + $test_str_match == GESHI_START_IMPORTANT) { + $test_str .= ''; + } + + $i = $close_pos + $close_strlen - 1; + + // parse the rest + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + } + } + + // If we haven't matched a multiline comment, try single-line comments + if (!$COMMENT_MATCHED) { + // cache potential single line comment occurances + if (!empty($this->language_data['COMMENT_SINGLE']) && $next_comment_single_pos < $i) { + $next_comment_single_pos = $length; + foreach ($this->language_data['COMMENT_SINGLE'] as $comment_key => $comment_mark) { + $match_i = false; + if (isset($comment_single_cache_per_key[$comment_key]) && + ($comment_single_cache_per_key[$comment_key] >= $i || + $comment_single_cache_per_key[$comment_key] === false)) { + // we have already matched something + if ($comment_single_cache_per_key[$comment_key] === false) { + // this comment is never matched + continue; + } + $match_i = $comment_single_cache_per_key[$comment_key]; + } elseif ( + // case sensitive comments + ($this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] && + ($match_i = stripos($part, $comment_mark, $i)) !== false) || + // non case sensitive + (!$this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] && + (($match_i = strpos($part, $comment_mark, $i)) !== false))) { + $comment_single_cache_per_key[$comment_key] = $match_i; + } else { + $comment_single_cache_per_key[$comment_key] = false; + continue; + } + if ($match_i !== false && $match_i < $next_comment_single_pos) { + $next_comment_single_pos = $match_i; + $next_comment_single_key = $comment_key; + if ($match_i === $i) { + break; + } + } + } + } + if ($next_comment_single_pos == $i) { + $comment_key = $next_comment_single_key; + $comment_mark = $this->language_data['COMMENT_SINGLE'][$comment_key]; + $com_len = strlen($comment_mark); + + // This check will find special variables like $# in bash + // or compiler directives of Delphi beginning {$ + if ((empty($sc_disallowed_before) || ($i == 0) || + (false === strpos($sc_disallowed_before, $part[$i-1]))) && + (empty($sc_disallowed_after) || ($length <= $i + $com_len) || + (false === strpos($sc_disallowed_after, $part[$i + $com_len])))) + { + // this is a valid comment + $COMMENT_MATCHED = true; + if ($this->lexic_permissions['COMMENTS'][$comment_key]) { + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment_key] . '"'; + } else { + $attributes = ' class="co' . $comment_key . '"'; + } + $test_str = "" . $this->hsc($this->change_case($comment_mark)); + } else { + $test_str = $this->hsc($comment_mark); + } + + //Check if this comment is the last in the source + $close_pos = strpos($part, "\n", $i); + $oops = false; + if ($close_pos === false) { + $close_pos = $length; + $oops = true; + } + $test_str .= $this->hsc(substr($part, $i + $com_len, $close_pos - $i - $com_len)); + if ($this->lexic_permissions['COMMENTS'][$comment_key]) { + $test_str .= ""; + } + + // Take into account that the comment might be the last in the source + if (!$oops) { + $test_str .= "\n"; + } + + $i = $close_pos; + + // parse the rest + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + } + } + } + } + + // Where are we adding this char? + if (!$COMMENT_MATCHED) { + $stuff_to_parse .= $char; + } else { + $result .= $test_str; + unset($test_str); + $COMMENT_MATCHED = false; + } + } + // Parse the last bit + $result .= $this->parse_non_string_part($stuff_to_parse); + $stuff_to_parse = ''; + } else { + $result .= $this->hsc($part); + } + // Close the that surrounds the block + if ($STRICTATTRS != '') { + $result = str_replace("\n", "\n", $result); + $result .= ''; + } + + $endresult .= $result; + unset($part, $parts[$key], $result); + } + + //This fix is related to SF#1923020, but has to be applied regardless of + //actually highlighting symbols. + /** NOTE: memorypeak #3 */ + $endresult = str_replace(array('', ''), array(';', '|'), $endresult); + +// // Parse the last stuff (redundant?) +// $result .= $this->parse_non_string_part($stuff_to_parse); + + // Lop off the very first and last spaces +// $result = substr($result, 1, -1); + + // We're finished: stop timing + $this->set_time($start_time, microtime()); + + $this->finalise($endresult); + return $endresult; + } + + /** + * Swaps out spaces and tabs for HTML indentation. Not needed if + * the code is in a pre block... + * + * @param string The source to indent (reference!) + * @since 1.0.0 + * @access private + */ + function indent(&$result) { + /// Replace tabs with the correct number of spaces + if (false !== strpos($result, "\t")) { + $lines = explode("\n", $result); + $result = null;//Save memory while we process the lines individually + $tab_width = $this->get_real_tab_width(); + $tab_string = ' ' . str_repeat(' ', $tab_width); + + for ($key = 0, $n = count($lines); $key < $n; $key++) { + $line = $lines[$key]; + if (false === strpos($line, "\t")) { + continue; + } + + $pos = 0; + $length = strlen($line); + $lines[$key] = ''; // reduce memory + + $IN_TAG = false; + for ($i = 0; $i < $length; ++$i) { + $char = $line[$i]; + // Simple engine to work out whether we're in a tag. + // If we are we modify $pos. This is so we ignore HTML + // in the line and only workout the tab replacement + // via the actual content of the string + // This test could be improved to include strings in the + // html so that < or > would be allowed in user's styles + // (e.g. quotes: '<' '>'; or similar) + if ($IN_TAG) { + if ('>' == $char) { + $IN_TAG = false; + } + $lines[$key] .= $char; + } elseif ('<' == $char) { + $IN_TAG = true; + $lines[$key] .= '<'; + } elseif ('&' == $char) { + $substr = substr($line, $i + 3, 5); + $posi = strpos($substr, ';'); + if (false === $posi) { + ++$pos; + } else { + $pos -= $posi+2; + } + $lines[$key] .= $char; + } elseif ("\t" == $char) { + $str = ''; + // OPTIMISE - move $strs out. Make an array: + // $tabs = array( + // 1 => ' ', + // 2 => '  ', + // 3 => '   ' etc etc + // to use instead of building a string every time + $tab_end_width = $tab_width - ($pos % $tab_width); //Moved out of the look as it doesn't change within the loop + if (($pos & 1) || 1 == $tab_end_width) { + $str .= substr($tab_string, 6, $tab_end_width); + } else { + $str .= substr($tab_string, 0, $tab_end_width+5); + } + $lines[$key] .= $str; + $pos += $tab_end_width; + + if (false === strpos($line, "\t", $i + 1)) { + $lines[$key] .= substr($line, $i + 1); + break; + } + } elseif (0 == $pos && ' ' == $char) { + $lines[$key] .= ' '; + ++$pos; + } else { + $lines[$key] .= $char; + ++$pos; + } + } + } + $result = implode("\n", $lines); + unset($lines);//We don't need the lines separated beyond this --- free them! + } + // Other whitespace + // BenBE: Fix to reduce the number of replacements to be done + $result = preg_replace('/^ /m', ' ', $result); + $result = str_replace(' ', '  ', $result); + + if ($this->line_numbers == GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) { + if ($this->line_ending === null) { + $result = nl2br($result); + } else { + $result = str_replace("\n", $this->line_ending, $result); + } + } + } + + /** + * Changes the case of a keyword for those languages where a change is asked for + * + * @param string The keyword to change the case of + * @return string The keyword with its case changed + * @since 1.0.0 + * @access private + */ + function change_case($instr) { + switch ($this->language_data['CASE_KEYWORDS']) { + case GESHI_CAPS_UPPER: + return strtoupper($instr); + case GESHI_CAPS_LOWER: + return strtolower($instr); + default: + return $instr; + } + } + + /** + * Handles replacements of keywords to include markup and links if requested + * + * @param string The keyword to add the Markup to + * @return The HTML for the match found + * @since 1.0.8 + * @access private + * + * @todo Get rid of ender in keyword links + */ + function handle_keyword_replace($match) { + $k = $this->_kw_replace_group; + $keyword = $match[0]; + $keyword_match = $match[1]; + + $before = ''; + $after = ''; + + if ($this->keyword_links) { + // Keyword links have been ebabled + + if (isset($this->language_data['URLS'][$k]) && + $this->language_data['URLS'][$k] != '') { + // There is a base group for this keyword + + // Old system: strtolower + //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword); + // New system: get keyword from language file to get correct case + if (!$this->language_data['CASE_SENSITIVE'][$k] && + strpos($this->language_data['URLS'][$k], '{FNAME}') !== false) { + foreach ($this->language_data['KEYWORDS'][$k] as $word) { + if (strcasecmp($word, $keyword_match) == 0) { + break; + } + } + } else { + $word = $keyword_match; + } + + $before = '<|UR1|"' . + str_replace( + array( + '{FNAME}', + '{FNAMEL}', + '{FNAMEU}', + '.'), + array( + str_replace('+', '%20', urlencode($this->hsc($word))), + str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))), + str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))), + ''), + $this->language_data['URLS'][$k] + ) . '">'; + $after = ''; + } + } + + return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after; + } + + /** + * handles regular expressions highlighting-definitions with callback functions + * + * @note this is a callback, don't use it directly + * + * @param array the matches array + * @return The highlighted string + * @since 1.0.8 + * @access private + */ + function handle_regexps_callback($matches) { + // before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'", + return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>'; + } + + /** + * handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this + * + * @note this is a callback, don't use it directly + * + * @param array the matches array + * @return string + * @since 1.0.8 + * @access private + */ + function handle_multiline_regexps($matches) { + $before = $this->_hmr_before; + $after = $this->_hmr_after; + if ($this->_hmr_replace) { + $replace = $this->_hmr_replace; + $search = array(); + + foreach (array_keys($matches) as $k) { + $search[] = '\\' . $k; + } + + $before = str_replace($search, $matches, $before); + $after = str_replace($search, $matches, $after); + $replace = str_replace($search, $matches, $replace); + } else { + $replace = $matches[0]; + } + return $before + . '<|!REG3XP' . $this->_hmr_key .'!>' + . str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace) + . '|>' + . $after; + } + + /** + * Takes a string that has no strings or comments in it, and highlights + * stuff like keywords, numbers and methods. + * + * @param string The string to parse for keyword, numbers etc. + * @since 1.0.0 + * @access private + * @todo BUGGY! Why? Why not build string and return? + */ + function parse_non_string_part($stuff_to_parse) { + $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse); + + // Highlight keywords + $disallowed_before = "(?lexic_permissions['STRINGS']) { + $quotemarks = preg_quote(implode($this->language_data['QUOTEMARKS']), '/'); + $disallowed_before .= $quotemarks; + $disallowed_after .= $quotemarks; + } + $disallowed_before .= "])"; + $disallowed_after .= "])"; + + $parser_control_pergroup = false; + if (isset($this->language_data['PARSER_CONTROL'])) { + if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) { + $x = 0; // check wether per-keyword-group parser_control is enabled + if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) { + $disallowed_before = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE']; + ++$x; + } + if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) { + $disallowed_after = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER']; + ++$x; + } + $parser_control_pergroup = (count($this->language_data['PARSER_CONTROL']['KEYWORDS']) - $x) > 0; + } + } + + foreach (array_keys($this->language_data['KEYWORDS']) as $k) { + if (!isset($this->lexic_permissions['KEYWORDS'][$k]) || + $this->lexic_permissions['KEYWORDS'][$k]) { + + $case_sensitive = $this->language_data['CASE_SENSITIVE'][$k]; + $modifiers = $case_sensitive ? '' : 'i'; + + // NEW in 1.0.8 - per-keyword-group parser control + $disallowed_before_local = $disallowed_before; + $disallowed_after_local = $disallowed_after; + if ($parser_control_pergroup && isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k])) { + if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'])) { + $disallowed_before_local = + $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE']; + } + + if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'])) { + $disallowed_after_local = + $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER']; + } + } + + $this->_kw_replace_group = $k; + + //NEW in 1.0.8, the cached regexp list + // since we don't want PHP / PCRE to crash due to too large patterns we split them into smaller chunks + for ($set = 0, $set_length = count($this->language_data['CACHED_KEYWORD_LISTS'][$k]); $set < $set_length; ++$set) { + $keywordset =& $this->language_data['CACHED_KEYWORD_LISTS'][$k][$set]; + // Might make a more unique string for putting the number in soon + // Basically, we don't put the styles in yet because then the styles themselves will + // get highlighted if the language has a CSS keyword in it (like CSS, for example ;)) + $stuff_to_parse = preg_replace_callback( + "/$disallowed_before_local({$keywordset})(?!\(?:htm|php|aspx?))$disallowed_after_local/$modifiers", + array($this, 'handle_keyword_replace'), + $stuff_to_parse + ); + } + } + } + + // Regular expressions + foreach ($this->language_data['REGEXPS'] as $key => $regexp) { + if ($this->lexic_permissions['REGEXPS'][$key]) { + if (is_array($regexp)) { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + // produce valid HTML when we match multiple lines + $this->_hmr_replace = $regexp[GESHI_REPLACE]; + $this->_hmr_before = $regexp[GESHI_BEFORE]; + $this->_hmr_key = $key; + $this->_hmr_after = $regexp[GESHI_AFTER]; + $stuff_to_parse = preg_replace_callback( + "/" . $regexp[GESHI_SEARCH] . "/{$regexp[GESHI_MODIFIERS]}", + array($this, 'handle_multiline_regexps'), + $stuff_to_parse); + $this->_hmr_replace = false; + $this->_hmr_before = ''; + $this->_hmr_after = ''; + } else { + $stuff_to_parse = preg_replace( + '/' . $regexp[GESHI_SEARCH] . '/' . $regexp[GESHI_MODIFIERS], + $regexp[GESHI_BEFORE] . '<|!REG3XP'. $key .'!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER], + $stuff_to_parse); + } + } else { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + // produce valid HTML when we match multiple lines + $this->_hmr_key = $key; + $stuff_to_parse = preg_replace_callback( "/(" . $regexp . ")/", + array($this, 'handle_multiline_regexps'), $stuff_to_parse); + $this->_hmr_key = ''; + } else { + $stuff_to_parse = preg_replace( "/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse); + } + } + } + } + + // Highlight numbers. As of 1.0.8 we support different types of numbers + $numbers_found = false; + + if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse )) { + $numbers_found = true; + + //For each of the formats ... + foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) { + //Check if it should be highlighted ... + $stuff_to_parse = preg_replace($regexp, "<|/NUM!$id/>\\1|>", $stuff_to_parse); + } + } + + // + // Now that's all done, replace /[number]/ with the correct styles + // + foreach (array_keys($this->language_data['KEYWORDS']) as $k) { + if (!$this->use_classes) { + $attributes = ' style="' . + (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ? + $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"'; + } else { + $attributes = ' class="kw' . $k . '"'; + } + $stuff_to_parse = str_replace("<|/$k/>", "<|$attributes>", $stuff_to_parse); + } + + if ($numbers_found) { + // Put number styles in + foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) { + //Commented out for now, as this needs some review ... + // if ($numbers_permissions & $id) { + //Get the appropriate style ... + //Checking for unset styles is done by the style cache builder ... + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"'; + } else { + $attributes = ' class="nu'.$id.'"'; + } + + //Set in the correct styles ... + $stuff_to_parse = str_replace("/NUM!$id/", $attributes, $stuff_to_parse); + // } + } + } + + // Highlight methods and fields in objects + if ($this->lexic_permissions['METHODS'] && $this->language_data['OOLANG']) { + $oolang_spaces = "[\s]*"; + $oolang_before = ""; + $oolang_after = "[a-zA-Z][a-zA-Z0-9_]*"; + if (isset($this->language_data['PARSER_CONTROL'])) { + if (isset($this->language_data['PARSER_CONTROL']['OOLANG'])) { + if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'])) { + $oolang_before = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE']; + } + if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'])) { + $oolang_after = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER']; + } + if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'])) { + $oolang_spaces = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES']; + } + } + } + + foreach ($this->language_data['OBJECT_SPLITTERS'] as $key => $splitter) { + if (false !== strpos($stuff_to_parse, $splitter)) { + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['METHODS'][$key] . '"'; + } else { + $attributes = ' class="me' . $key . '"'; + } + $stuff_to_parse = preg_replace("/($oolang_before)(" . preg_quote($this->language_data['OBJECT_SPLITTERS'][$key], '/') . ")($oolang_spaces)($oolang_after)/", "\\1\\2\\3<|$attributes>\\4|>", $stuff_to_parse); + } + } + } + + // + // Highlight brackets. Yes, I've tried adding a semi-colon to this list. + // You try it, and see what happens ;) + // TODO: Fix lexic permissions not converting entities if shouldn't + // be highlighting regardless + // + if ($this->lexic_permissions['BRACKETS']) { + $stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'], + $this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse ); + } + + + //FIX for symbol highlighting ... + if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) { + //Get all matches and throw away those witin a block that is already highlighted... (i.e. matched by a regexp) + $n_symbols = preg_match_all("/<\|(?:|[^>])+>(?:(?!\|>).*?)\|>|<\/a>|(?:" . $this->language_data['SYMBOL_SEARCH'] . ")+(?![^<]+?>)/", $stuff_to_parse, $pot_symbols, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + $global_offset = 0; + for ($s_id = 0; $s_id < $n_symbols; ++$s_id) { + $symbol_match = $pot_symbols[$s_id][0][0]; + if (strpos($symbol_match, '<') !== false || strpos($symbol_match, '>') !== false) { + // already highlighted blocks _must_ include either < or > + // so if this conditional applies, we have to skip this match + // BenBE: UNLESS the block contains or + if(strpos($symbol_match, '') === false && + strpos($symbol_match, '') === false) { + continue; + } + } + + // if we reach this point, we have a valid match which needs to be highlighted + + $symbol_length = strlen($symbol_match); + $symbol_offset = $pot_symbols[$s_id][0][1]; + unset($pot_symbols[$s_id]); + $symbol_end = $symbol_length + $symbol_offset; + $symbol_hl = ""; + + // if we have multiple styles, we have to handle them properly + if ($this->language_data['MULTIPLE_SYMBOL_GROUPS']) { + $old_sym = -1; + // Split the current stuff to replace into its atomic symbols ... + preg_match_all("/" . $this->language_data['SYMBOL_SEARCH'] . "/", $symbol_match, $sym_match_syms, PREG_PATTERN_ORDER); + foreach ($sym_match_syms[0] as $sym_ms) { + //Check if consequtive symbols belong to the same group to save output ... + if (isset($this->language_data['SYMBOL_DATA'][$sym_ms]) + && ($this->language_data['SYMBOL_DATA'][$sym_ms] != $old_sym)) { + if (-1 != $old_sym) { + $symbol_hl .= "|>"; + } + $old_sym = $this->language_data['SYMBOL_DATA'][$sym_ms]; + if (!$this->use_classes) { + $symbol_hl .= '<| style="' . $this->language_data['STYLES']['SYMBOLS'][$old_sym] . '">'; + } else { + $symbol_hl .= '<| class="sy' . $old_sym . '">'; + } + } + $symbol_hl .= $sym_ms; + } + unset($sym_match_syms); + + //Close remaining tags and insert the replacement at the right position ... + //Take caution if symbol_hl is empty to avoid doubled closing spans. + if (-1 != $old_sym) { + $symbol_hl .= "|>"; + } + } else { + if (!$this->use_classes) { + $symbol_hl = '<| style="' . $this->language_data['STYLES']['SYMBOLS'][0] . '">'; + } else { + $symbol_hl = '<| class="sy0">'; + } + $symbol_hl .= $symbol_match . '|>'; + } + + $stuff_to_parse = substr_replace($stuff_to_parse, $symbol_hl, $symbol_offset + $global_offset, $symbol_length); + + // since we replace old text with something of different size, + // we'll have to keep track of the differences + $global_offset += strlen($symbol_hl) - $symbol_length; + } + } + //FIX for symbol highlighting ... + + // Add class/style for regexps + foreach (array_keys($this->language_data['REGEXPS']) as $key) { + if ($this->lexic_permissions['REGEXPS'][$key]) { + if (is_callable($this->language_data['STYLES']['REGEXPS'][$key])) { + $this->_rx_key = $key; + $stuff_to_parse = preg_replace_callback("/!REG3XP$key!(.*)\|>/U", + array($this, 'handle_regexps_callback'), + $stuff_to_parse); + } else { + if (!$this->use_classes) { + $attributes = ' style="' . $this->language_data['STYLES']['REGEXPS'][$key] . '"'; + } else { + if (is_array($this->language_data['REGEXPS'][$key]) && + array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$key])) { + $attributes = ' class="' . + $this->language_data['REGEXPS'][$key][GESHI_CLASS] . '"'; + } else { + $attributes = ' class="re' . $key . '"'; + } + } + $stuff_to_parse = str_replace("!REG3XP$key!", "$attributes", $stuff_to_parse); + } + } + } + + // Replace with . for urls + $stuff_to_parse = str_replace('', '.', $stuff_to_parse); + // Replace <|UR1| with link_styles[GESHI_LINK])) { + if ($this->use_classes) { + $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' href=', $stuff_to_parse); + } else { + $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' style="' . $this->link_styles[GESHI_LINK] . '" href=', $stuff_to_parse); + } + } else { + $stuff_to_parse = str_replace('<|UR1|', 'link_target . ' href=', $stuff_to_parse); + } + + // + // NOW we add the span thingy ;) + // + + $stuff_to_parse = str_replace('<|', '', '', $stuff_to_parse ); + return substr($stuff_to_parse, 1); + } + + /** + * Sets the time taken to parse the code + * + * @param microtime The time when parsing started + * @param microtime The time when parsing ended + * @since 1.0.2 + * @access private + */ + function set_time($start_time, $end_time) { + $start = explode(' ', $start_time); + $end = explode(' ', $end_time); + $this->time = $end[0] + $end[1] - $start[0] - $start[1]; + } + + /** + * Gets the time taken to parse the code + * + * @return double The time taken to parse the code + * @since 1.0.2 + */ + function get_time() { + return $this->time; + } + + /** + * Merges arrays recursively, overwriting values of the first array with values of later arrays + * + * @since 1.0.8 + * @access private + */ + function merge_arrays() { + $arrays = func_get_args(); + $narrays = count($arrays); + + // check arguments + // comment out if more performance is necessary (in this case the foreach loop will trigger a warning if the argument is not an array) + for ($i = 0; $i < $narrays; $i ++) { + if (!is_array($arrays[$i])) { + // also array_merge_recursive returns nothing in this case + trigger_error('Argument #' . ($i+1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING); + return false; + } + } + + // the first array is in the output set in every case + $ret = $arrays[0]; + + // merege $ret with the remaining arrays + for ($i = 1; $i < $narrays; $i ++) { + foreach ($arrays[$i] as $key => $value) { + if (is_array($value) && isset($ret[$key])) { + // if $ret[$key] is not an array you try to merge an scalar value with an array - the result is not defined (incompatible arrays) + // in this case the call will trigger an E_USER_WARNING and the $ret[$key] will be false. + $ret[$key] = $this->merge_arrays($ret[$key], $value); + } else { + $ret[$key] = $value; + } + } + } + + return $ret; + } + + /** + * Gets language information and stores it for later use + * + * @param string The filename of the language file you want to load + * @since 1.0.0 + * @access private + * @todo Needs to load keys for lexic permissions for keywords, regexps etc + */ + function load_language($file_name) { + if ($file_name == $this->loaded_language) { + // this file is already loaded! + return; + } + + //Prepare some stuff before actually loading the language file + $this->loaded_language = $file_name; + $this->parse_cache_built = false; + $this->enable_highlighting(); + $language_data = array(); + + //Load the language file + require $file_name; + + // Perhaps some checking might be added here later to check that + // $language data is a valid thing but maybe not + $this->language_data = $language_data; + + // Set strict mode if should be set + $this->strict_mode = $this->language_data['STRICT_MODE_APPLIES']; + + // Set permissions for all lexics to true + // so they'll be highlighted by default + foreach (array_keys($this->language_data['KEYWORDS']) as $key) { + if (!empty($this->language_data['KEYWORDS'][$key])) { + $this->lexic_permissions['KEYWORDS'][$key] = true; + } else { + $this->lexic_permissions['KEYWORDS'][$key] = false; + } + } + + foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) { + $this->lexic_permissions['COMMENTS'][$key] = true; + } + foreach (array_keys($this->language_data['REGEXPS']) as $key) { + $this->lexic_permissions['REGEXPS'][$key] = true; + } + + // for BenBE and future code reviews: + // we can use empty here since we only check for existance and emptiness of an array + // if it is not an array at all but rather false or null this will work as intended as well + // even if $this->language_data['PARSER_CONTROL'] is undefined this won't trigger a notice + if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) { + foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) { + // it's either true or false and maybe is true as well + $perm = $value !== GESHI_NEVER; + if ($flag == 'ALL') { + $this->enable_highlighting($perm); + continue; + } + if (!isset($this->lexic_permissions[$flag])) { + // unknown lexic permission + continue; + } + if (is_array($this->lexic_permissions[$flag])) { + foreach ($this->lexic_permissions[$flag] as $key => $val) { + $this->lexic_permissions[$flag][$key] = $perm; + } + } else { + $this->lexic_permissions[$flag] = $perm; + } + } + unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']); + } + + //Fix: Problem where hardescapes weren't handled if no ESCAPE_CHAR was given + //You need to set one for HARDESCAPES only in this case. + if(!isset($this->language_data['HARDCHAR'])) { + $this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR']; + } + + //NEW in 1.0.8: Allow styles to be loaded from a separate file to override defaults + $style_filename = substr($file_name, 0, -4) . '.style.php'; + if (is_readable($style_filename)) { + //Clear any style_data that could have been set before ... + if (isset($style_data)) { + unset($style_data); + } + + //Read the Style Information from the style file + include $style_filename; + + //Apply the new styles to our current language styles + if (isset($style_data) && is_array($style_data)) { + $this->language_data['STYLES'] = + $this->merge_arrays($this->language_data['STYLES'], $style_data); + } + } + } + + /** + * Takes the parsed code and various options, and creates the HTML + * surrounding it to make it look nice. + * + * @param string The code already parsed (reference!) + * @since 1.0.0 + * @access private + */ + function finalise(&$parsed_code) { + // Remove end parts of important declarations + // This is BUGGY!! My fault for bad code: fix coming in 1.2 + // @todo Remove this crap + if ($this->enable_important_blocks && + (strpos($parsed_code, $this->hsc(GESHI_START_IMPORTANT)) === false)) { + $parsed_code = str_replace($this->hsc(GESHI_END_IMPORTANT), '', $parsed_code); + } + + // Add HTML whitespace stuff if we're using the
    header + if ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) { + $this->indent($parsed_code); + } + + // purge some unnecessary stuff + /** NOTE: memorypeak #1 */ + $parsed_code = preg_replace('#]+>(\s*)#', '\\1', $parsed_code); + + // If we are using IDs for line numbers, there needs to be an overall + // ID set to prevent collisions. + if ($this->add_ids && !$this->overall_id) { + $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4); + } + + // Get code into lines + /** NOTE: memorypeak #2 */ + $code = explode("\n", $parsed_code); + $parsed_code = $this->header(); + + // If we're using line numbers, we insert
  • s and appropriate + // markup to style them (otherwise we don't need to do anything) + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) { + // If we're using the
     header, we shouldn't add newlines because
    +            // the 
     will line-break them (and the 
  • s already do this for us) + $ls = ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) ? "\n" : ''; + + // Set vars to defaults for following loop + $i = 0; + + // Foreach line... + for ($i = 0, $n = count($code); $i < $n;) { + //Reset the attributes for a new line ... + $attrs = array(); + + // Make lines have at least one space in them if they're empty + // BenBE: Checking emptiness using trim instead of relying on blanks + if ('' == trim($code[$i])) { + $code[$i] = ' '; + } + + // If this is a "special line"... + if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && + $i % $this->line_nth_row == ($this->line_nth_row - 1)) { + // Set the attributes to style the line + if ($this->use_classes) { + //$attr = ' class="li2"'; + $attrs['class'][] = 'li2'; + $def_attr = ' class="de2"'; + } else { + //$attr = ' style="' . $this->line_style2 . '"'; + $attrs['style'][] = $this->line_style2; + // This style "covers up" the special styles set for special lines + // so that styles applied to special lines don't apply to the actual + // code on that line + $def_attr = ' style="' . $this->code_style . '"'; + } + } else { + if ($this->use_classes) { + //$attr = ' class="li1"'; + $attrs['class'][] = 'li1'; + $def_attr = ' class="de1"'; + } else { + //$attr = ' style="' . $this->line_style1 . '"'; + $attrs['style'][] = $this->line_style1; + $def_attr = ' style="' . $this->code_style . '"'; + } + } + + //Check which type of tag to insert for this line + if ($this->header_type == GESHI_HEADER_PRE_VALID) { + $start = ""; + $end = '
  • '; + } else { + // Span or div? + $start = ""; + $end = ''; + } + + ++$i; + + // Are we supposed to use ids? If so, add them + if ($this->add_ids) { + $attrs['id'][] = "$this->overall_id-$i"; + } + + //Is this some line with extra styles??? + if (in_array($i, $this->highlight_extra_lines)) { + if ($this->use_classes) { + if (isset($this->highlight_extra_lines_styles[$i])) { + $attrs['class'][] = "lx$i"; + } else { + $attrs['class'][] = "ln-xtra"; + } + } else { + array_push($attrs['style'], $this->get_line_style($i)); + } + } + + // Add in the line surrounded by appropriate list HTML + $attr_string = ''; + foreach ($attrs as $key => $attr) { + $attr_string .= ' ' . $key . '="' . implode(' ', $attr) . '"'; + } + + $parsed_code .= "$start{$code[$i-1]}$end
  • $ls"; + unset($code[$i - 1]); + } + } else { + $n = count($code); + if ($this->use_classes) { + $attributes = ' class="de1"'; + } else { + $attributes = ' style="'. $this->code_style .'"'; + } + if ($this->header_type == GESHI_HEADER_PRE_VALID) { + $parsed_code .= ''; + } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + if ($this->use_classes) { + $attrs = ' class="ln"'; + } else { + $attrs = ' style="'. $this->table_linenumber_style .'"'; + } + $parsed_code .= ''; + // get linenumbers + // we don't merge it with the for below, since it should be better for + // memory consumption this way + // @todo: but... actually it would still be somewhat nice to merge the two loops + // the mem peaks are at different positions + for ($i = 0; $i < $n; ++$i) { + $close = 0; + // fancy lines + if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && + $i % $this->line_nth_row == ($this->line_nth_row - 1)) { + // Set the attributes to style the line + if ($this->use_classes) { + $parsed_code .= ''; + } else { + // This style "covers up" the special styles set for special lines + // so that styles applied to special lines don't apply to the actual + // code on that line + $parsed_code .= '' + .''; + } + $close += 2; + } + //Is this some line with extra styles??? + if (in_array($i + 1, $this->highlight_extra_lines)) { + if ($this->use_classes) { + if (isset($this->highlight_extra_lines_styles[$i])) { + $parsed_code .= ""; + } else { + $parsed_code .= ""; + } + } else { + $parsed_code .= "get_line_style($i) . "\">"; + } + ++$close; + } + $parsed_code .= $this->line_numbers_start + $i; + if ($close) { + $parsed_code .= str_repeat('', $close); + } elseif ($i != $n) { + $parsed_code .= "\n"; + } + } + $parsed_code .= ''; + } + $parsed_code .= ''; + } + // No line numbers, but still need to handle highlighting lines extra. + // Have to use divs so the full width of the code is highlighted + $close = 0; + for ($i = 0; $i < $n; ++$i) { + // Make lines have at least one space in them if they're empty + // BenBE: Checking emptiness using trim instead of relying on blanks + if ('' == trim($code[$i])) { + $code[$i] = ' '; + } + // fancy lines + if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS && + $i % $this->line_nth_row == ($this->line_nth_row - 1)) { + // Set the attributes to style the line + if ($this->use_classes) { + $parsed_code .= ''; + } else { + // This style "covers up" the special styles set for special lines + // so that styles applied to special lines don't apply to the actual + // code on that line + $parsed_code .= '' + .''; + } + $close += 2; + } + //Is this some line with extra styles??? + if (in_array($i + 1, $this->highlight_extra_lines)) { + if ($this->use_classes) { + if (isset($this->highlight_extra_lines_styles[$i])) { + $parsed_code .= ""; + } else { + $parsed_code .= ""; + } + } else { + $parsed_code .= "get_line_style($i) . "\">"; + } + ++$close; + } + + $parsed_code .= $code[$i]; + + if ($close) { + $parsed_code .= str_repeat('', $close); + $close = 0; + } + elseif ($i + 1 < $n) { + $parsed_code .= "\n"; + } + unset($code[$i]); + } + + if ($this->header_type == GESHI_HEADER_PRE_VALID || $this->header_type == GESHI_HEADER_PRE_TABLE) { + $parsed_code .= ''; + } + if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { + $parsed_code .= ''; + } + } + + $parsed_code .= $this->footer(); + } + + /** + * Creates the header for the code block (with correct attributes) + * + * @return string The header for the code block + * @since 1.0.0 + * @access private + */ + function header() { + // Get attributes needed + /** + * @todo Document behaviour change - class is outputted regardless of whether + * we're using classes or not. Same with style + */ + $attributes = ' class="' . $this->_genCSSName($this->language); + if ($this->overall_class != '') { + $attributes .= " ".$this->_genCSSName($this->overall_class); + } + $attributes .= '"'; + + if ($this->overall_id != '') { + $attributes .= " id=\"{$this->overall_id}\""; + } + if ($this->overall_style != '' && !$this->use_classes) { + $attributes .= ' style="' . $this->overall_style . '"'; + } + + $ol_attributes = ''; + + if ($this->line_numbers_start != 1) { + $ol_attributes .= ' start="' . $this->line_numbers_start . '"'; + } + + // Get the header HTML + $header = $this->header_content; + if ($header) { + if ($this->header_type == GESHI_HEADER_PRE || $this->header_type == GESHI_HEADER_PRE_VALID) { + $header = str_replace("\n", '', $header); + } + $header = $this->replace_keywords($header); + + if ($this->use_classes) { + $attr = ' class="head"'; + } else { + $attr = " style=\"{$this->header_content_style}\""; + } + if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { + $header = "$header"; + } else { + $header = "$header"; + } + } + + if (GESHI_HEADER_NONE == $this->header_type) { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + return "$header"; + } + return $header . ($this->force_code_block ? '
    ' : ''); + } + + // Work out what to return and do it + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + if ($this->header_type == GESHI_HEADER_PRE) { + return "$header"; + } elseif ($this->header_type == GESHI_HEADER_DIV || + $this->header_type == GESHI_HEADER_PRE_VALID) { + return "$header"; + } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { + return "$header"; + } + } else { + if ($this->header_type == GESHI_HEADER_PRE) { + return "$header" . + ($this->force_code_block ? '
    ' : ''); + } else { + return "$header" . + ($this->force_code_block ? '
    ' : ''); + } + } + } + + /** + * Returns the footer for the code block. + * + * @return string The footer for the code block + * @since 1.0.0 + * @access private + */ + function footer() { + $footer = $this->footer_content; + if ($footer) { + if ($this->header_type == GESHI_HEADER_PRE) { + $footer = str_replace("\n", '', $footer);; + } + $footer = $this->replace_keywords($footer); + + if ($this->use_classes) { + $attr = ' class="foot"'; + } else { + $attr = " style=\"{$this->footer_content_style}\""; + } + if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) { + $footer = "$footer"; + } else { + $footer = "$footer
    "; + } + } + + if (GESHI_HEADER_NONE == $this->header_type) { + return ($this->line_numbers != GESHI_NO_LINE_NUMBERS) ? '' . $footer : $footer; + } + + if ($this->header_type == GESHI_HEADER_DIV || $this->header_type == GESHI_HEADER_PRE_VALID) { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + return "$footer
    "; + } + return ($this->force_code_block ? '
    ' : '') . + "$footer"; + } + elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + return "$footer"; + } + return ($this->force_code_block ? '' : '') . + "$footer"; + } + else { + if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) { + return "$footer"; + } + return ($this->force_code_block ? '' : '') . + "$footer"; + } + } + + /** + * Replaces certain keywords in the header and footer with + * certain configuration values + * + * @param string The header or footer content to do replacement on + * @return string The header or footer with replaced keywords + * @since 1.0.2 + * @access private + */ + function replace_keywords($instr) { + $keywords = $replacements = array(); + + $keywords[] = '
      to have no effect at all if there are line numbers + // (
        s have margins that should be destroyed so all layout is + // controlled by the set_overall_style method, which works on the + //
         or 
        container). Additionally, set default styles for lines + if (!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) { + //$stylesheet .= "$selector, {$selector}ol, {$selector}ol li {margin: 0;}\n"; + $stylesheet .= "$selector.de1, $selector.de2 {{$this->code_style}}\n"; + } + + // Add overall styles + // note: neglect economy_mode, empty styles are meaningless + if ($this->overall_style != '') { + $stylesheet .= "$selector {{$this->overall_style}}\n"; + } + + // Add styles for links + // note: economy mode does not make _any_ sense here + // either the style is empty and thus no selector is needed + // or the appropriate key is given. + foreach ($this->link_styles as $key => $style) { + if ($style != '') { + switch ($key) { + case GESHI_LINK: + $stylesheet .= "{$selector}a:link {{$style}}\n"; + break; + case GESHI_HOVER: + $stylesheet .= "{$selector}a:hover {{$style}}\n"; + break; + case GESHI_ACTIVE: + $stylesheet .= "{$selector}a:active {{$style}}\n"; + break; + case GESHI_VISITED: + $stylesheet .= "{$selector}a:visited {{$style}}\n"; + break; + } + } + } + + // Header and footer + // note: neglect economy_mode, empty styles are meaningless + if ($this->header_content_style != '') { + $stylesheet .= "$selector.head {{$this->header_content_style}}\n"; + } + if ($this->footer_content_style != '') { + $stylesheet .= "$selector.foot {{$this->footer_content_style}}\n"; + } + + // Styles for important stuff + // note: neglect economy_mode, empty styles are meaningless + if ($this->important_styles != '') { + $stylesheet .= "$selector.imp {{$this->important_styles}}\n"; + } + + // Simple line number styles + if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->line_style1 != '') { + $stylesheet .= "{$selector}li, {$selector}.li1 {{$this->line_style1}}\n"; + } + if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->table_linenumber_style != '') { + $stylesheet .= "{$selector}.ln {{$this->table_linenumber_style}}\n"; + } + // If there is a style set for fancy line numbers, echo it out + if ((!$economy_mode || $this->line_numbers == GESHI_FANCY_LINE_NUMBERS) && $this->line_style2 != '') { + $stylesheet .= "{$selector}.li2 {{$this->line_style2}}\n"; + } + + // note: empty styles are meaningless + foreach ($this->language_data['STYLES']['KEYWORDS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || + (isset($this->lexic_permissions['KEYWORDS'][$group]) && + $this->lexic_permissions['KEYWORDS'][$group]))) { + $stylesheet .= "$selector.kw$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['COMMENTS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || + (isset($this->lexic_permissions['COMMENTS'][$group]) && + $this->lexic_permissions['COMMENTS'][$group]) || + (!empty($this->language_data['COMMENT_REGEXP']) && + !empty($this->language_data['COMMENT_REGEXP'][$group])))) { + $stylesheet .= "$selector.co$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['ESCAPE_CHAR'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['ESCAPE_CHAR'])) { + // NEW: since 1.0.8 we have to handle hardescapes + if ($group === 'HARD') { + $group = '_h'; + } + $stylesheet .= "$selector.es$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['BRACKETS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['BRACKETS'])) { + $stylesheet .= "$selector.br$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['SYMBOLS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['SYMBOLS'])) { + $stylesheet .= "$selector.sy$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['STRINGS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['STRINGS'])) { + // NEW: since 1.0.8 we have to handle hardquotes + if ($group === 'HARD') { + $group = '_h'; + } + $stylesheet .= "$selector.st$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) { + $stylesheet .= "$selector.nu$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) { + $stylesheet .= "$selector.me$group {{$styles}}\n"; + } + } + // note: neglect economy_mode, empty styles are meaningless + foreach ($this->language_data['STYLES']['SCRIPT'] as $group => $styles) { + if ($styles != '') { + $stylesheet .= "$selector.sc$group {{$styles}}\n"; + } + } + foreach ($this->language_data['STYLES']['REGEXPS'] as $group => $styles) { + if ($styles != '' && (!$economy_mode || + (isset($this->lexic_permissions['REGEXPS'][$group]) && + $this->lexic_permissions['REGEXPS'][$group]))) { + if (is_array($this->language_data['REGEXPS'][$group]) && + array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$group])) { + $stylesheet .= "$selector."; + $stylesheet .= $this->language_data['REGEXPS'][$group][GESHI_CLASS]; + $stylesheet .= " {{$styles}}\n"; + } else { + $stylesheet .= "$selector.re$group {{$styles}}\n"; + } + } + } + // Styles for lines being highlighted extra + if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_styles))) { + $stylesheet .= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_lines_style}}\n"; + } + $stylesheet .= "{$selector}span.xtra { display:block; }\n"; + foreach ($this->highlight_extra_lines_styles as $lineid => $linestyle) { + $stylesheet .= "{$selector}.lx$lineid, {$selector}li.lx$lineid, {$selector}div.lx$lineid {{$linestyle}}\n"; + } + + return $stylesheet; + } + + /** + * Get's the style that is used for the specified line + * + * @param int The line number information is requested for + * @access private + * @since 1.0.7.21 + */ + function get_line_style($line) { + //$style = null; + $style = null; + if (isset($this->highlight_extra_lines_styles[$line])) { + $style = $this->highlight_extra_lines_styles[$line]; + } else { // if no "extra" style assigned + $style = $this->highlight_extra_lines_style; + } + + return $style; + } + + /** + * this functions creates an optimized regular expression list + * of an array of strings. + * + * Example: + * $list = array('faa', 'foo', 'foobar'); + * => string 'f(aa|oo(bar)?)' + * + * @param $list array of (unquoted) strings + * @param $regexp_delimiter your regular expression delimiter, @see preg_quote() + * @return string for regular expression + * @author Milian Wolff + * @since 1.0.8 + * @access private + */ + function optimize_regexp_list($list, $regexp_delimiter = '/') { + $regex_chars = array('.', '\\', '+', '-', '*', '?', '[', '^', ']', '$', + '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', $regexp_delimiter); + sort($list); + $regexp_list = array(''); + $num_subpatterns = 0; + $list_key = 0; + + // the tokens which we will use to generate the regexp list + $tokens = array(); + $prev_keys = array(); + // go through all entries of the list and generate the token list + $cur_len = 0; + for ($i = 0, $i_max = count($list); $i < $i_max; ++$i) { + if ($cur_len > GESHI_MAX_PCRE_LENGTH) { + // seems like the length of this pcre is growing exorbitantly + $regexp_list[++$list_key] = $this->_optimize_regexp_list_tokens_to_string($tokens); + $num_subpatterns = substr_count($regexp_list[$list_key], '(?:'); + $tokens = array(); + $cur_len = 0; + } + $level = 0; + $entry = preg_quote((string) $list[$i], $regexp_delimiter); + $pointer = &$tokens; + // properly assign the new entry to the correct position in the token array + // possibly generate smaller common denominator keys + while (true) { + // get the common denominator + if (isset($prev_keys[$level])) { + if ($prev_keys[$level] == $entry) { + // this is a duplicate entry, skip it + continue 2; + } + $char = 0; + while (isset($entry[$char]) && isset($prev_keys[$level][$char]) + && $entry[$char] == $prev_keys[$level][$char]) { + ++$char; + } + if ($char > 0) { + // this entry has at least some chars in common with the current key + if ($char == strlen($prev_keys[$level])) { + // current key is totally matched, i.e. this entry has just some bits appended + $pointer = &$pointer[$prev_keys[$level]]; + } else { + // only part of the keys match + $new_key_part1 = substr($prev_keys[$level], 0, $char); + $new_key_part2 = substr($prev_keys[$level], $char); + + if (in_array($new_key_part1[0], $regex_chars) + || in_array($new_key_part2[0], $regex_chars)) { + // this is bad, a regex char as first character + $pointer[$entry] = array('' => true); + array_splice($prev_keys, $level, count($prev_keys), $entry); + $cur_len += strlen($entry); + continue; + } else { + // relocate previous tokens + $pointer[$new_key_part1] = array($new_key_part2 => $pointer[$prev_keys[$level]]); + unset($pointer[$prev_keys[$level]]); + $pointer = &$pointer[$new_key_part1]; + // recreate key index + array_splice($prev_keys, $level, count($prev_keys), array($new_key_part1, $new_key_part2)); + $cur_len += strlen($new_key_part2); + } + } + ++$level; + $entry = substr($entry, $char); + continue; + } + // else: fall trough, i.e. no common denominator was found + } + if ($level == 0 && !empty($tokens)) { + // we can dump current tokens into the string and throw them away afterwards + $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens); + $new_subpatterns = substr_count($new_entry, '(?:'); + if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + $new_subpatterns > GESHI_MAX_PCRE_SUBPATTERNS) { + $regexp_list[++$list_key] = $new_entry; + $num_subpatterns = $new_subpatterns; + } else { + if (!empty($regexp_list[$list_key])) { + $new_entry = '|' . $new_entry; + } + $regexp_list[$list_key] .= $new_entry; + $num_subpatterns += $new_subpatterns; + } + $tokens = array(); + $cur_len = 0; + } + // no further common denominator found + $pointer[$entry] = array('' => true); + array_splice($prev_keys, $level, count($prev_keys), $entry); + + $cur_len += strlen($entry); + break; + } + unset($list[$i]); + } + // make sure the last tokens get converted as well + $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens); + if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + substr_count($new_entry, '(?:') > GESHI_MAX_PCRE_SUBPATTERNS) { + if ( !empty($regexp_list[$list_key]) ) { + ++$list_key; + } + $regexp_list[$list_key] = $new_entry; + } else { + if (!empty($regexp_list[$list_key])) { + $new_entry = '|' . $new_entry; + } + $regexp_list[$list_key] .= $new_entry; + } + return $regexp_list; + } + /** + * this function creates the appropriate regexp string of an token array + * you should not call this function directly, @see $this->optimize_regexp_list(). + * + * @param &$tokens array of tokens + * @param $recursed bool to know wether we recursed or not + * @return string + * @author Milian Wolff + * @since 1.0.8 + * @access private + */ + function _optimize_regexp_list_tokens_to_string(&$tokens, $recursed = false) { + $list = ''; + foreach ($tokens as $token => $sub_tokens) { + $list .= $token; + $close_entry = isset($sub_tokens['']); + unset($sub_tokens['']); + if (!empty($sub_tokens)) { + $list .= '(?:' . $this->_optimize_regexp_list_tokens_to_string($sub_tokens, true) . ')'; + if ($close_entry) { + // make sub_tokens optional + $list .= '?'; + } + } + $list .= '|'; + } + if (!$recursed) { + // do some optimizations + // common trailing strings + // BUGGY! + //$list = preg_replace_callback('#(?<=^|\:|\|)\w+?(\w+)(?:\|.+\1)+(?=\|)#', create_function( + // '$matches', 'return "(?:" . preg_replace("#" . preg_quote($matches[1], "#") . "(?=\||$)#", "", $matches[0]) . ")" . $matches[1];'), $list); + // (?:p)? => p? + $list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list); + // (?:a|b|c|d|...)? => [abcd...]? + // TODO: a|bb|c => [ac]|bb + $list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', function ($matches) { return "[" . str_replace("|", "", $matches[1]) . "]"; }, $list); + } + // return $list without trailing pipe + return substr($list, 0, -1); + } +} // End Class GeSHi + + +if (!function_exists('geshi_highlight')) { + /** + * Easy way to highlight stuff. Behaves just like highlight_string + * + * @param string The code to highlight + * @param string The language to highlight the code in + * @param string The path to the language files. You can leave this blank if you need + * as from version 1.0.7 the path should be automatically detected + * @param boolean Whether to return the result or to echo + * @return string The code highlighted (if $return is true) + * @since 1.0.2 + */ + function geshi_highlight($string, $language, $path = null, $return = false) { + $geshi = new GeSHi($string, $language, $path); + $geshi->set_header_type(GESHI_HEADER_NONE); + + if ($return) { + return '' . $geshi->parse_code() . ''; + } + + echo '' . $geshi->parse_code() . ''; + + if ($geshi->error()) { + return false; + } + return true; + } +} + diff --git a/plugins/dokuwiki/inc/geshi/actionscript-french.php b/plugins/dokuwiki/inc/geshi/actionscript-french.php new file mode 100644 index 0000000..e816050 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/actionscript-french.php @@ -0,0 +1,957 @@ + 'Actionscript', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + '#include', + 'for', + 'foreach', + 'if', + 'elseif', + 'else', + 'while', + 'do', + 'dowhile', + 'endwhile', + 'endif', + 'switch', + 'case', + 'endswitch', + 'break', + 'continue', + 'in', + 'null', + 'false', + 'true', + 'var', + 'default', + 'new', + '_global', + 'undefined', + 'super' + ), + 2 => array( + 'static', + 'private', + 'public', + 'class', + 'extends', + 'implements', + 'import', + 'return', + 'trace', + '_quality', + '_root', + 'set', + 'setInterval', + 'setProperty', + 'stopAllSounds', + 'targetPath', + 'this', + 'typeof', + 'unescape', + 'updateAfterEvent' + ), + 3 => array ( + 'Accessibility', + 'Array', + 'Boolean', + 'Button', + 'Camera', + 'Color', + 'ContextMenuItem', + 'ContextMenu', + 'Cookie', + 'Date', + 'Error', + 'function', + 'FWEndCommand', + 'FWJavascript', + 'Key', + 'LoadMovieNum', + 'LoadMovie', + 'LoadVariablesNum', + 'LoadVariables', + 'LoadVars', + 'LocalConnection', + 'Math', + 'Microphone', + 'MMExecute', + 'MMEndCommand', + 'MMSave', + 'Mouse', + 'MovieClipLoader', + 'MovieClip', + 'NetConnexion', + 'NetStream', + 'Number', + 'Object', + 'printAsBitmapNum', + 'printNum', + 'printAsBitmap', + 'printJob', + 'print', + 'Selection', + 'SharedObject', + 'Sound', + 'Stage', + 'String', + 'System', + 'TextField', + 'TextFormat', + 'Tween', + 'Video', + 'XMLUI', + 'XMLNode', + 'XMLSocket', + 'XML' + ), + 4 => array ( + 'isactive', + 'updateProperties' + ), + 5 => array ( + 'callee', + 'caller', + ), + 6 => array ( + 'concat', + 'join', + 'pop', + 'push', + 'reverse', + 'shift', + 'slice', + 'sort', + 'sortOn', + 'splice', + 'toString', + 'unshift' + ), + 7 => array ( + 'valueOf' + ), + 8 => array ( + 'onDragOut', + 'onDragOver', + 'onKeyUp', + 'onKillFocus', + 'onPress', + 'onRelease', + 'onReleaseOutside', + 'onRollOut', + 'onRollOver', + 'onSetFocus' + ), + 9 => array ( + 'setMode', + 'setMotionLevel', + 'setQuality', + 'activityLevel', + 'bandwidth', + 'currentFps', + 'fps', + 'index', + 'motionLevel', + 'motionTimeOut', + 'muted', + 'names', + 'quality', + 'onActivity', + 'onStatus' + ), + 10 => array ( + 'getRGB', + 'setRGB', + 'getTransform', + 'setTransform' + ), + 11 => array ( + 'caption', + 'enabled', + 'separatorBefore', + 'visible', + 'onSelect' + ), + 12 => array ( + 'setCookie', + 'getcookie' + ), + 13 => array ( + 'hideBuiltInItems', + 'builtInItems', + 'customItems', + 'onSelect' + ), + 14 => array ( + 'CustomActions.get', + 'CustomActions.install', + 'CustomActions.list', + 'CustomActions.uninstall', + ), + 15 => array ( + 'getDate', + 'getDay', + 'getFullYear', + 'getHours', + 'getMilliseconds', + 'getMinutes', + 'getMonth', + 'getSeconds', + 'getTime', + 'getTimezoneOffset', + 'getUTCDate', + 'getUTCDay', + 'getUTCFullYear', + 'getUTCHours', + 'getUTCMinutes', + 'getUTCMilliseconds', + 'getUTCMonth', + 'getUTCSeconds', + 'getYear', + 'setDate', + 'setFullYear', + 'setHours', + 'setMilliseconds', + 'setMinutes', + 'setMonth', + 'setSeconds', + 'setTime', + 'setUTCDate', + 'setUTCDay', + 'setUTCFullYear', + 'setUTCHours', + 'setUTCMinutes', + 'setUTCMilliseconds', + 'setUTCMonth', + 'setUTCSeconds', + 'setYear', + 'UTC' + ), + 16 => array ( + 'message', + 'name', + 'throw', + 'try', + 'catch', + 'finally' + ), + 17 => array ( + 'apply', + 'call' + ), + 18 => array ( + 'BACKSPACE', + 'CAPSLOCK', + 'CONTROL', + 'DELETEKEY', + 'DOWN', + 'END', + 'ENTER', + 'ESCAPE', + 'getAscii', + 'getCode', + 'HOME', + 'INSERT', + 'isDown', + 'isToggled', + 'LEFT', + 'onKeyDown', + 'onKeyUp', + 'PGDN', + 'PGUP', + 'RIGHT', + 'SPACE', + 'TAB', + 'UP' + ), + 19 => array ( + 'addRequestHeader', + 'contentType', + 'decode' + ), + 20 => array ( + 'allowDomain', + 'allowInsecureDomain', + 'close', + 'domain' + ), + 21 => array ( + 'abs', + 'acos', + 'asin', + 'atan', + 'atan2', + 'ceil', + 'cos', + 'exp', + 'floor', + 'log', + 'LN2', + 'LN10', + 'LOG2E', + 'LOG10E', + 'max', + 'min', + 'PI', + 'pow', + 'random', + 'sin', + 'SQRT1_2', + 'sqrt', + 'tan', + 'round', + 'SQRT2' + ), + 22 => array ( + 'activityLevel', + 'muted', + 'names', + 'onActivity', + 'onStatus', + 'setRate', + 'setGain', + 'gain', + 'rate', + 'setSilenceLevel', + 'setUseEchoSuppression', + 'silenceLevel', + 'silenceTimeOut', + 'useEchoSuppression' + ), + 23 => array ( + 'hide', + 'onMouseDown', + 'onMouseMove', + 'onMouseUp', + 'onMouseWeel', + 'show' + ), + 24 => array ( + '_alpha', + 'attachAudio', + 'attachMovie', + 'beginFill', + 'beginGradientFill', + 'clear', + 'createEmptyMovieClip', + 'createTextField', + '_current', + 'curveTo', + '_dropTarget', + 'duplicateMovieClip', + 'endFill', + 'focusEnabled', + 'enabled', + '_focusrec', + '_framesLoaded', + 'getBounds', + 'getBytesLoaded', + 'getBytesTotal', + 'getDepth', + 'getInstanceAtDepth', + 'getNextHighestDepth', + 'getSWFVersion', + 'getTextSnapshot', + 'getURL', + 'globalToLocal', + 'gotoAndPlay', + 'gotoAndStop', + '_height', + 'hitArea', + 'hitTest', + 'lineStyle', + 'lineTo', + 'localToGlobal', + '_lockroot', + 'menu', + 'onUnload', + '_parent', + 'play', + 'prevFrame', + '_quality', + 'removeMovieClip', + '_rotation', + 'setMask', + '_soundbuftime', + 'startDrag', + 'stopDrag', + 'stop', + 'swapDepths', + 'tabChildren', + '_target', + '_totalFrames', + 'trackAsMenu', + 'unloadMovie', + 'useHandCursor', + '_visible', + '_width', + '_xmouse', + '_xscale', + '_x', + '_ymouse', + '_yscale', + '_y' + ), + 25 => array ( + 'getProgress', + 'loadClip', + 'onLoadComplete', + 'onLoadError', + 'onLoadInit', + 'onLoadProgress', + 'onLoadStart' + ), + 26 => array ( + 'bufferLength', + 'currentFps', + 'seek', + 'setBufferTime', + 'bufferTime', + 'time', + 'pause' + ), + 27 => array ( + 'MAX_VALUE', + 'MIN_VALUE', + 'NEGATIVE_INFINITY', + 'POSITIVE_INFINITY' + ), + 28 => array ( + 'addProperty', + 'constructor', + '__proto__', + 'registerClass', + '__resolve', + 'unwatch', + 'watch', + 'onUpDate' + ), + 29 => array ( + 'addPage' + ), + 30 => array ( + 'getBeginIndex', + 'getCaretIndex', + 'getEndIndex', + 'setSelection' + ), + 31 => array ( + 'flush', + 'getLocal', + 'getSize' + ), + 32 => array ( + 'attachSound', + 'duration', + 'getPan', + 'getVolume', + 'onID3', + 'loadSound', + 'id3', + 'onSoundComplete', + 'position', + 'setPan', + 'setVolume' + ), + 33 => array ( + 'getBeginIndex', + 'getCaretIndex', + 'getEndIndex', + 'setSelection' + ), + 34 => array ( + 'getEndIndex', + ), + 35 => array ( + 'align', + 'height', + 'width', + 'onResize', + 'scaleMode', + 'showMenu' + ), + 36 => array ( + 'charAt', + 'charCodeAt', + 'concat', + 'fromCharCode', + 'indexOf', + 'lastIndexOf', + 'substr', + 'substring', + 'toLowerCase', + 'toUpperCase' + ), + 37 => array ( + 'avHardwareDisable', + 'hasAccessibility', + 'hasAudioEncoder', + 'hasAudio', + 'hasEmbeddedVideo', + 'hasMP3', + 'hasPrinting', + 'hasScreenBroadcast', + 'hasScreenPlayback', + 'hasStreamingAudio', + 'hasStreamingVideo', + 'hasVideoEncoder', + 'isDebugger', + 'language', + 'localFileReadDisable', + 'manufacturer', + 'os', + 'pixelAspectRatio', + 'playerType', + 'screenColor', + 'screenDPI', + 'screenResolutionX', + 'screenResolutionY', + 'serverString', + 'version' + ), + 38 => array ( + 'allowDomain', + 'allowInsecureDomain', + 'loadPolicyFile' + ), + 39 => array ( + 'exactSettings', + 'setClipboard', + 'showSettings', + 'useCodepage' + ), + 40 => array ( + 'getStyle', + 'getStyleNames', + 'parseCSS', + 'setStyle', + 'transform' + ), + 41 => array ( + 'autoSize', + 'background', + 'backgroundColor', + 'border', + 'borderColor', + 'bottomScroll', + 'condenseWhite', + 'embedFonts', + 'getFontList', + 'getNewTextFormat', + 'getTextFormat', + 'hscroll', + 'htmlText', + 'html', + 'maxChars', + 'maxhscroll', + 'maxscroll', + 'mouseWheelEnabled', + 'multiline', + 'onScroller', + 'password', + 'removeTextField', + 'replaceSel', + 'replaceText', + 'restrict', + 'scroll', + 'selectable', + 'setNewTextFormat', + 'setTextFormat', + 'styleSheet', + 'tabEnabled', + 'tabIndex', + 'textColor', + 'textHeight', + 'textWidth', + 'text', + 'type', + '_url', + 'variable', + 'wordWrap' + ), + 42 => array ( + 'blockIndent', + 'bold', + 'bullet', + 'font', + 'getTextExtent', + 'indent', + 'italic', + 'leading', + 'leftMargin', + 'rightMargin', + 'size', + 'tabStops', + 'underline' + ), + 43 => array ( + 'findText', + 'getCount', + 'getSelected', + 'getSelectedText', + 'getText', + 'hitTestTextNearPos', + 'setSelectColor', + 'setSelected' + ), + 44 => array ( + 'begin', + 'change', + 'continueTo', + 'fforward', + 'finish', + 'func', + 'FPS', + 'getPosition', + 'isPlaying', + 'looping', + 'obj', + 'onMotionChanged', + 'onMotionFinished', + 'onMotionLooped', + 'onMotionStarted', + 'onMotionResumed', + 'onMotionStopped', + 'prop', + 'rewind', + 'resume', + 'setPosition', + 'time', + 'userSeconds', + 'yoyo' + ), + 45 => array ( + 'attachVideo', + 'deblocking', + 'smoothing' + ), + 46 => array ( + 'addRequestHeader', + 'appendChild', + 'attributes', + 'childNodes', + 'cloneNode', + 'contentType', + 'createElement', + 'createTextNode', + 'docTypeDecl', + 'firstChild', + 'hasChildNodes', + 'ignoreWhite', + 'insertBefore', + 'lastChild', + 'nextSibling', + 'nodeName', + 'nodeType', + 'nodeValue', + 'parentNode', + 'parseXML', + 'previousSibling', + 'removeNode', + 'xmlDecl' + ), + 47 => array ( + 'onClose', + 'onXML' + ), + 48 => array ( + 'add', + 'and', + '_highquality', + 'chr', + 'eq', + 'ge', + 'ifFrameLoaded', + 'int', + 'le', + 'it', + 'mbchr', + 'mblength', + 'mbord', + 'ne', + 'not', + 'or', + 'ord', + 'tellTarget', + 'toggleHighQuality' + ), + 49 => array ( + 'ASSetPropFlags', + 'ASnative', + 'ASconstructor', + 'AsSetupError', + 'FWEndCommand', + 'FWJavascript', + 'MMEndCommand', + 'MMSave', + 'XMLUI' + ), + 50 => array ( + 'System.capabilities' + ), + 51 => array ( + 'System.security' + ), + 52 => array ( + 'TextField.StyleSheet' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '!', '@', '%', '&', '*', '|', '/', '<', '>','=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => true, + 2 => true, + 3 => true, + 4 => true, + 5 => true, + 6 => true, + 7 => true, + 8 => true, + 9 => true, + 10 => true, + 11 => true, + 12 => true, + 13 => true, + 14 => true, + 15 => true, + 16 => true, + 17 => true, + 18 => true, + 19 => true, + 20 => true, + 21 => true, + 22 => true, + 23 => true, + 24 => true, + 25 => true, + 26 => true, + 27 => true, + 28 => true, + 29 => true, + 30 => true, + 31 => true, + 32 => true, + 33 => true, + 34 => true, + 35 => true, + 36 => true, + 37 => true, + 38 => true, + 39 => true, + 40 => true, + 41 => true, + 42 => true, + 43 => true, + 44 => true, + 45 => true, + 46 => true, + 47 => true, + 48 => true, + 49 => true, + 50 => true, + 51 => true, + 52 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000ff;', + 2 => 'color: #006600;', + 3 => 'color: #000080;', + 4 => 'color: #006600;', + 5 => 'color: #006600;', + 6 => 'color: #006600;', + 7 => 'color: #006600;', + 8 => 'color: #006600;', + 9 => 'color: #006600;', + 10 => 'color: #006600;', + 11 => 'color: #006600;', + 12 => 'color: #006600;', + 13 => 'color: #006600;', + 14 => 'color: #006600;', + 15 => 'color: #006600;', + 16 => 'color: #006600;', + 17 => 'color: #006600;', + 18 => 'color: #006600;', + 19 => 'color: #006600;', + 20 => 'color: #006600;', + 21 => 'color: #006600;', + 22 => 'color: #006600;', + 23 => 'color: #006600;', + 24 => 'color: #006600;', + 25 => 'color: #006600;', + 26 => 'color: #006600;', + 27 => 'color: #006600;', + 28 => 'color: #006600;', + 29 => 'color: #006600;', + 30 => 'color: #006600;', + 31 => 'color: #006600;', + 32 => 'color: #006600;', + 33 => 'color: #006600;', + 34 => 'color: #006600;', + 35 => 'color: #006600;', + 36 => 'color: #006600;', + 37 => 'color: #006600;', + 38 => 'color: #006600;', + 39 => 'color: #006600;', + 40 => 'color: #006600;', + 41 => 'color: #006600;', + 42 => 'color: #006600;', + 43 => 'color: #006600;', + 44 => 'color: #006600;', + 45 => 'color: #006600;', + 46 => 'color: #006600;', + 47 => 'color: #006600;', + 48 => 'color: #CC0000;', + 49 => 'color: #5700d1;', + 50 => 'color: #006600;', + 51 => 'color: #006600;', + 52 => 'color: #CC0000;' + ), + 'COMMENTS' => array( + 1 => 'color: #ff8000; font-style: italic;', + 2 => 'color: #ff8000; font-style: italic;', + 'MULTI' => 'color: #ff8000; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #333333;' + ), + 'STRINGS' => array( + 0 => 'color: #333333; background-color: #eeeeee;' + ), + 'NUMBERS' => array( + 0 => 'color: #c50000;' + ), + + 'SYMBOLS' => array( + 0 => 'color: #000000;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => 'http://wiki.media-box.net/documentation/flash/{FNAME}', + 2 => 'http://wiki.media-box.net/documentation/flash/{FNAME}', + 3 => 'http://wiki.media-box.net/documentation/flash/{FNAME}', + 4 => 'http://wiki.media-box.net/documentation/flash/accessibility/{FNAME}', + 5 => 'http://wiki.media-box.net/documentation/flash/arguments/{FNAME}', + 6 => 'http://wiki.media-box.net/documentation/flash/array/{FNAME}', + 7 => 'http://wiki.media-box.net/documentation/flash/boolean/{FNAME}', + 8 => 'http://wiki.media-box.net/documentation/flash/button/{FNAME}', + 9 => 'http://wiki.media-box.net/documentation/flash/camera/{FNAME}', + 10 => 'http://wiki.media-box.net/documentation/flash/color/{FNAME}', + 11 => 'http://wiki.media-box.net/documentation/flash/contextmenuitem/{FNAME}', + 12 => 'http://wiki.media-box.net/documentation/flash/contextmenu/{FNAME}', + 13 => 'http://wiki.media-box.net/documentation/flash/cookie/{FNAME}', + 14 => 'http://wiki.media-box.net/documentation/flash/customactions/{FNAME}', + 15 => 'http://wiki.media-box.net/documentation/flash/date/{FNAME}', + 16 => 'http://wiki.media-box.net/documentation/flash/error/{FNAME}', + 17 => 'http://wiki.media-box.net/documentation/flash/function/{FNAME}', + 18 => 'http://wiki.media-box.net/documentation/flash/key/{FNAME}', + 19 => 'http://wiki.media-box.net/documentation/flash/loadvars/{FNAME}', + 20 => 'http://wiki.media-box.net/documentation/flash/localconnection/{FNAME}', + 21 => 'http://wiki.media-box.net/documentation/flash/math/{FNAME}', + 22 => 'http://wiki.media-box.net/documentation/flash/microphone/{FNAME}', + 23 => 'http://wiki.media-box.net/documentation/flash/mouse/{FNAME}', + 24 => 'http://wiki.media-box.net/documentation/flash/movieclip/{FNAME}', + 25 => 'http://wiki.media-box.net/documentation/flash/moviecliploader/{FNAME}', + 26 => 'http://wiki.media-box.net/documentation/flash/netstream/{FNAME}', + 27 => 'http://wiki.media-box.net/documentation/flash/number/{FNAME}', + 28 => 'http://wiki.media-box.net/documentation/flash/object/{FNAME}', + 29 => 'http://wiki.media-box.net/documentation/flash/printJob/{FNAME}', + 30 => 'http://wiki.media-box.net/documentation/flash/selection/{FNAME}', + 31 => 'http://wiki.media-box.net/documentation/flash/sharedobject/{FNAME}', + 32 => 'http://wiki.media-box.net/documentation/flash/sound/{FNAME}', + 33 => 'http://wiki.media-box.net/documentation/flash/selection/{FNAME}', + 34 => 'http://wiki.media-box.net/documentation/flash/sharedobject/{FNAME}', + 35 => 'http://wiki.media-box.net/documentation/flash/stage/{FNAME}', + 36 => 'http://wiki.media-box.net/documentation/flash/string/{FNAME}', + 37 => 'http://wiki.media-box.net/documentation/flash/system/capabilities/{FNAME}', + 38 => 'http://wiki.media-box.net/documentation/flash/system/security/{FNAME}', + 39 => 'http://wiki.media-box.net/documentation/flash/system/{FNAME}', + 40 => 'http://wiki.media-box.net/documentation/flash/textfield/stylesheet/{FNAME}', + 41 => 'http://wiki.media-box.net/documentation/flash/textfield/{FNAME}', + 42 => 'http://wiki.media-box.net/documentation/flash/textformat/{FNAME}', + 43 => 'http://wiki.media-box.net/documentation/flash/textsnapshot/{FNAME}', + 44 => 'http://wiki.media-box.net/documentation/flash/tween/{FNAME}', + 45 => 'http://wiki.media-box.net/documentation/flash/video/{FNAME}', + 46 => 'http://wiki.media-box.net/documentation/flash/xml/{FNAME}', + 47 => 'http://wiki.media-box.net/documentation/flash/xmlsocket/{FNAME}', + 48 => 'http://wiki.media-box.net/documentation/flash/{FNAME}', + 49 => 'http://wiki.media-box.net/documentation/flash/{FNAME}', + 50 => 'http://wiki.media-box.net/documentation/flash/system/capabilities', + 51 => 'http://wiki.media-box.net/documentation/flash/system/security', + 52 => 'http://wiki.media-box.net/documentation/flash/textfield/stylesheet' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array(), + 'HIGHLIGHT_STRICT_BLOCK' => array() +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/actionscript.php b/plugins/dokuwiki/inc/geshi/actionscript.php new file mode 100644 index 0000000..30df1fd --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/actionscript.php @@ -0,0 +1,199 @@ + 'ActionScript', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + '#include', 'for', 'foreach', 'if', 'elseif', 'else', 'while', 'do', 'dowhile', + 'endwhile', 'endif', 'switch', 'case', 'endswitch', 'return', 'break', 'continue', 'in' + ), + 2 => array( + 'null', 'false', 'true', 'var', + 'default', 'function', 'class', + 'new', '_global' + ), + 3 => array( + '#endinitclip', '#initclip', '__proto__', '_accProps', '_alpha', '_currentframe', + '_droptarget', '_focusrect', '_framesloaded', '_height', '_highquality', '_lockroot', + '_name', '_parent', '_quality', '_root', '_rotation', '_soundbuftime', '_target', '_totalframes', + '_url', '_visible', '_width', '_x', '_xmouse', '_xscale', '_y', '_ymouse', '_yscale', 'abs', + 'Accessibility', 'acos', 'activityLevel', 'add', 'addListener', 'addPage', 'addProperty', + 'addRequestHeader', 'align', 'allowDomain', 'allowInsecureDomain', 'and', 'appendChild', + 'apply', 'Arguments', 'Array', 'asfunction', 'asin', 'atan', 'atan2', 'attachAudio', 'attachMovie', + 'attachSound', 'attachVideo', 'attributes', 'autosize', 'avHardwareDisable', 'background', + 'backgroundColor', 'BACKSPACE', 'bandwidth', 'beginFill', 'beginGradientFill', 'blockIndent', + 'bold', 'Boolean', 'border', 'borderColor', 'bottomScroll', 'bufferLength', 'bufferTime', + 'builtInItems', 'bullet', 'Button', 'bytesLoaded', 'bytesTotal', 'call', 'callee', 'caller', + 'Camera', 'capabilities', 'CAPSLOCK', 'caption', 'catch', 'ceil', 'charAt', 'charCodeAt', + 'childNodes', 'chr', 'clear', 'clearInterval', 'cloneNode', 'close', 'Color', 'concat', + 'connect', 'condenseWhite', 'constructor', 'contentType', 'ContextMenu', 'ContextMenuItem', + 'CONTROL', 'copy', 'cos', 'createElement', 'createEmptyMovieClip', 'createTextField', + 'createTextNode', 'currentFps', 'curveTo', 'CustomActions', 'customItems', 'data', 'Date', + 'deblocking', 'delete', 'DELETEKEY', 'docTypeDecl', 'domain', 'DOWN', + 'duplicateMovieClip', 'duration', 'dynamic', 'E', 'embedFonts', 'enabled', + 'END', 'endFill', 'ENTER', 'eq', 'Error', 'ESCAPE(Konstante)', 'escape(Funktion)', 'eval', + 'exactSettings', 'exp', 'extends', 'finally', 'findText', 'firstChild', 'floor', + 'flush', 'focusEnabled', 'font', 'fps', 'fromCharCode', 'fscommand', + 'gain', 'ge', 'get', 'getAscii', 'getBeginIndex', 'getBounds', 'getBytesLoaded', 'getBytesTotal', + 'getCaretIndex', 'getCode', 'getCount', 'getDate', 'getDay', 'getDepth', 'getEndIndex', 'getFocus', + 'getFontList', 'getFullYear', 'getHours', 'getInstanceAtDepth', 'getLocal', 'getMilliseconds', + 'getMinutes', 'getMonth', 'getNewTextFormat', 'getNextHighestDepth', 'getPan', 'getProgress', + 'getProperty', 'getRGB', 'getSeconds', 'getSelected', 'getSelectedText', 'getSize', 'getStyle', + 'getStyleNames', 'getSWFVersion', 'getText', 'getTextExtent', 'getTextFormat', 'getTextSnapshot', + 'getTime', 'getTimer', 'getTimezoneOffset', 'getTransform', 'getURL', 'getUTCDate', 'getUTCDay', + 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', + 'getVersion', 'getVolume', 'getYear', 'globalToLocal', 'goto', 'gotoAndPlay', 'gotoAndStop', + 'hasAccessibility', 'hasAudio', 'hasAudioEncoder', 'hasChildNodes', 'hasEmbeddedVideo', 'hasMP3', + 'hasPrinting', 'hasScreenBroadcast', 'hasScreenPlayback', 'hasStreamingAudio', 'hasStreamingVideo', + 'hasVideoEncoder', 'height', 'hide', 'hideBuiltInItems', 'hitArea', 'hitTest', 'hitTestTextNearPos', + 'HOME', 'hscroll', 'html', 'htmlText', 'ID3', 'ifFrameLoaded', 'ignoreWhite', 'implements', + 'import', 'indent', 'index', 'indexOf', 'Infinity', '-Infinity', 'INSERT', 'insertBefore', 'install', + 'instanceof', 'int', 'interface', 'isActive', 'isDebugger', 'isDown', 'isFinite', 'isNaN', 'isToggled', + 'italic', 'join', 'Key', 'language', 'lastChild', 'lastIndexOf', 'le', 'leading', 'LEFT', 'leftMargin', + 'length', 'level', 'lineStyle', 'lineTo', 'list', 'LN10', 'LN2', 'load', 'loadClip', 'loaded', 'loadMovie', + 'loadMovieNum', 'loadSound', 'loadVariables', 'loadVariablesNum', 'LoadVars', 'LocalConnection', + 'localFileReadDisable', 'localToGlobal', 'log', 'LOG10E', 'LOG2E', 'manufacturer', 'Math', 'max', + 'MAX_VALUE', 'maxChars', 'maxhscroll', 'maxscroll', 'mbchr', 'mblength', 'mbord', 'mbsubstring', 'menu', + 'message', 'Microphone', 'min', 'MIN_VALUE', 'MMExecute', 'motionLevel', 'motionTimeOut', 'Mouse', + 'mouseWheelEnabled', 'moveTo', 'Movieclip', 'MovieClipLoader', 'multiline', 'muted', 'name', 'names', 'NaN', + 'ne', 'NEGATIVE_INFINITY', 'NetConnection', 'NetStream', 'newline', 'nextFrame', + 'nextScene', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue', 'not', 'Number', 'Object', + 'on', 'onActivity', 'onChanged', 'onClipEvent', 'onClose', 'onConnect', 'onData', 'onDragOut', + 'onDragOver', 'onEnterFrame', 'onID3', 'onKeyDown', 'onKeyUp', 'onKillFocus', 'onLoad', 'onLoadComplete', + 'onLoadError', 'onLoadInit', 'onLoadProgress', 'onLoadStart', 'onMouseDown', 'onMouseMove', 'onMouseUp', + 'onMouseWheel', 'onPress', 'onRelease', 'onReleaseOutside', 'onResize', 'onRollOut', 'onRollOver', + 'onScroller', 'onSelect', 'onSetFocus', 'onSoundComplete', 'onStatus', 'onUnload', 'onUpdate', 'onXML', + 'or(logischesOR)', 'ord', 'os', 'parentNode', 'parseCSS', 'parseFloat', 'parseInt', 'parseXML', 'password', + 'pause', 'PGDN', 'PGUP', 'PI', 'pixelAspectRatio', 'play', 'playerType', 'pop', 'position', + 'POSITIVE_INFINITY', 'pow', 'prevFrame', 'previousSibling', 'prevScene', 'print', 'printAsBitmap', + 'printAsBitmapNum', 'PrintJob', 'printNum', 'private', 'prototype', 'public', 'push', 'quality', + 'random', 'rate', 'registerClass', 'removeListener', 'removeMovieClip', 'removeNode', 'removeTextField', + 'replaceSel', 'replaceText', 'resolutionX', 'resolutionY', 'restrict', 'reverse', 'RIGHT', + 'rightMargin', 'round', 'scaleMode', 'screenColor', 'screenDPI', 'screenResolutionX', 'screenResolutionY', + 'scroll', 'seek', 'selectable', 'Selection', 'send', 'sendAndLoad', 'separatorBefore', 'serverString', + 'set', 'setvariable', 'setBufferTime', 'setClipboard', 'setDate', 'setFocus', 'setFullYear', 'setGain', + 'setHours', 'setInterval', 'setMask', 'setMilliseconds', 'setMinutes', 'setMode', 'setMonth', + 'setMotionLevel', 'setNewTextFormat', 'setPan', 'setProperty', 'setQuality', 'setRate', 'setRGB', + 'setSeconds', 'setSelectColor', 'setSelected', 'setSelection', 'setSilenceLevel', 'setStyle', + 'setTextFormat', 'setTime', 'setTransform', 'setUseEchoSuppression', 'setUTCDate', 'setUTCFullYear', + 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setVolume', + 'setYear', 'SharedObject', 'SHIFT(Konstante)', 'shift(Methode)', 'show', 'showMenu', 'showSettings', + 'silenceLevel', 'silenceTimeout', 'sin', 'size', 'slice', 'smoothing', 'sort', 'sortOn', 'Sound', 'SPACE', + 'splice', 'split', 'sqrt', 'SQRT1_2', 'SQRT2', 'Stage', 'start', 'startDrag', 'static', 'status', 'stop', + 'stopAllSounds', 'stopDrag', 'String', 'StyleSheet(Klasse)', 'styleSheet(Eigenschaft)', 'substr', + 'substring', 'super', 'swapDepths', 'System', 'TAB', 'tabChildren', 'tabEnabled', 'tabIndex', + 'tabStops', 'tan', 'target', 'targetPath', 'tellTarget', 'text', 'textColor', 'TextField', 'TextFormat', + 'textHeight', 'TextSnapshot', 'textWidth', 'this', 'throw', 'time', 'toggleHighQuality', 'toLowerCase', + 'toString', 'toUpperCase', 'trace', 'trackAsMenu', 'try', 'type', 'typeof', 'undefined', + 'underline', 'unescape', 'uninstall', 'unloadClip', 'unloadMovie', 'unLoadMovieNum', 'unshift', 'unwatch', + 'UP', 'updateAfterEvent', 'updateProperties', 'url', 'useCodePage', 'useEchoSuppression', 'useHandCursor', + 'UTC', 'valueOf', 'variable', 'version', 'Video', 'visible', 'void', 'watch', 'width', + 'with', 'wordwrap', 'XML', 'xmlDecl', 'XMLNode', 'XMLSocket' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '!', '@', '%', '&', '*', '|', '/', '<', '>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #0066CC;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array(), + 'HIGHLIGHT_STRICT_BLOCK' => array() +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/ada.php b/plugins/dokuwiki/inc/geshi/ada.php new file mode 100644 index 0000000..461a165 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/ada.php @@ -0,0 +1,135 @@ + 'Ada', + 'COMMENT_SINGLE' => array(1 => '--'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'begin', 'declare', 'do', 'else', 'elsif', 'exception', 'for', 'if', + 'is', 'loop', 'while', 'then', 'is', 'end', 'select', 'case', 'while', 'until', + 'goto', 'return' + ), + 2 => array( + 'abs', 'and', 'mod', 'not', 'or', 'rem', 'xor' + ), + 3 => array( + 'abort', 'abstract', 'accept', 'access', 'aliased', 'all', 'array', 'at', 'body', + 'constant', 'delay', 'delta', 'digits', 'entry', 'exit', + 'function', 'generic', 'in', 'limited', 'new', 'null', 'of', 'others', 'out', 'package', 'pragma', + 'private', 'procedure', 'protected', 'raise', 'range', 'record', 'renames', 'requeue', 'reverse', + 'separate', 'subtype', 'tagged', 'task', 'terminate', 'type', 'use', 'when', 'with' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #00007f;', + 2 => 'color: #0000ff;', + 3 => 'color: #46aa03; font-weight:bold;', + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'COMMENTS' => array( + 1 => 'color: #adadad; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #7f007f;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff0000;' + ), + 'METHODS' => array( + 1 => 'color: #202020;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/apache.php b/plugins/dokuwiki/inc/geshi/apache.php new file mode 100644 index 0000000..028a92a --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/apache.php @@ -0,0 +1,173 @@ + 'Apache Log', + 'COMMENT_SINGLE' => array(1 => '#'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + /*keywords*/ + 1 => array( + 'accessconfig','accessfilename','action','addalt', + 'addaltbyencoding','addaltbytype','addcharset', + 'adddefaultcharset','adddescription', + 'addencoding','addhandler','addicon','addiconbyencoding', + 'addiconbytype','addlanguage','addmodule','addmoduleinfo', + 'addtype','agentlog','alias','aliasmatch', + 'allow','allowconnect','allowoverride','anonymous', + 'anonymous_authoritative','anonymous_logemail','anonymous_mustgiveemail', + 'anonymous_nouserid','anonymous_verifyemail','authauthoritative', + 'authdbauthoritative','authdbgroupfile','authdbmauthoritative', + 'authdbmgroupfile','authdbmgroupfile','authdbuserfile','authdbmuserfile', + 'authdigestfile','authgroupfile','authname','authtype', + 'authuserfile','bindaddress','browsermatch','browsermatchnocase', + 'bs2000account','cachedefaultexpire','cachedirlength','cachedirlevels', + 'cacheforcecompletion','cachegcinterval','cachelastmodifiedfactor','cachemaxexpire', + 'cachenegotiateddocs','cacheroot','cachesize','checkspelling', + 'clearmodulelist','contentdigest','cookieexpires','cookielog', + 'cookielog','cookietracking','coredumpdirectory','customlog', + 'defaulticon','defaultlanguage','defaulttype','define', + 'deny','directory','directorymatch','directoryindex', + 'documentroot','errordocument','errorlog','example', + 'expiresactive','expiresbytype','expiresdefault','extendedstatus', + 'fancyindexing','files','filesmatch','forcetype', + 'group','header','headername','hostnamelookups', + 'identitycheck','ifdefine','ifmodule','imapbase', + 'imapdefault','imapmenu','include','indexignore', + 'indexoptions','keepalive','keepalivetimeout','languagepriority', + 'limit','limitexcept','limitrequestbody','limitrequestfields', + 'limitrequestfieldsize','limitrequestline','listen','listenbacklog', + 'loadfile','loadmodule','location','locationmatch', + 'lockfile','logformat','loglevel','maxclients', + 'maxkeepaliverequests','maxrequestsperchild','maxspareservers','metadir', + 'metafiles','metasuffix','mimemagicfile','minspareservers', + 'mmapfile','namevirtualhost','nocache','options','order', + 'passenv','pidfile','port','proxyblock','proxydomain', + 'proxypass','proxypassreverse','proxyreceivebuffersize','proxyremote', + 'proxyrequests','proxyvia','qsc','readmename', + 'redirect','redirectmatch','redirectpermanent','redirecttemp', + 'refererignore','refererlog','removehandler','require', + 'resourceconfig','rewritebase','rewritecond','rewriteengine', + 'rewritelock','rewritelog','rewriteloglevel','rewritemap', + 'rewriteoptions','rewriterule','rlimitcpu','rlimitmem', + 'rlimitnproc','satisfy','scoreboardfile','script', + 'scriptalias','scriptaliasmatch','scriptinterpretersource','scriptlog', + 'scriptlogbuffer','scriptloglength','sendbuffersize', + 'serveradmin','serveralias','servername','serverpath', + 'serverroot','serversignature','servertokens','servertype', + 'setenv','setenvif','setenvifnocase','sethandler', + 'singlelisten','startservers','threadsperchild','timeout', + 'transferlog','typesconfig','unsetenv','usecanonicalname', + 'user','userdir','virtualhost','virtualdocumentroot', + 'virtualdocumentrootip','virtualscriptalias','virtualscriptaliasip', + 'xbithack','from','all' + ), + /*keyords 2*/ + 2 => array( + 'on','off','standalone','inetd', + 'force-response-1.0','downgrade-1.0','nokeepalive', + 'ndexes','includes','followsymlinks','none', + 'x-compress','x-gzip' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #00007f;', + 2 => 'color: #0000ff;', + ), + 'COMMENTS' => array( + 1 => 'color: #adadad; font-style: italic;', + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #7f007f;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff0000;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/applescript.php b/plugins/dokuwiki/inc/geshi/applescript.php new file mode 100644 index 0000000..33ab4f9 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/applescript.php @@ -0,0 +1,136 @@ + 'AppleScript', + 'COMMENT_SINGLE' => array(1 => '--'), + 'COMMENT_MULTI' => array( '(*' => '*)'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"',"'"), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'script','property','prop','end','copy','to','set','global','local','on','to','of', + 'in','given','with','without','return','continue','tell','if','then','else','repeat', + 'times','while','until','from','exit','try','error','considering','ignoring','timeout', + 'transaction','my','get','put','into','is' + ), + 2 => array( + 'each','some','every','whose','where','id','index','first','second','third','fourth', + 'fifth','sixth','seventh','eighth','ninth','tenth','last','front','back','st','nd', + 'rd','th','middle','named','through','thru','before','after','beginning','the' + ), + 3 => array( + 'close','copy','count','delete','duplicate','exists','launch','make','move','open', + 'print','quit','reopen','run','save','saving', + 'it','me','version','pi','result','space','tab','anything','case','diacriticals','expansion', + 'hyphens','punctuation','bold','condensed','expanded','hidden','italic','outline','plain', + 'shadow','strikethrough','subscript','superscript','underline','ask','no','yes','false', + 'true','weekday','monday','mon','tuesday','tue','wednesday','wed','thursday','thu','friday', + 'fri','saturday','sat','sunday','sun','month','january','jan','february','feb','march', + 'mar','april','apr','may','june','jun','july','jul','august','aug','september', + 'sep','october','oct','november','nov','december','dec','minutes','hours', + 'days','weeks','div','mod','and','not','or','as','contains','equal','equals','isnt' + ) + ), + 'SYMBOLS' => array( + ')','+','-','^','*','/','&','<','>=','<','<=','=','�' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0000ff;', + 4 => 'color: #009999;', + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => ',+-=<>/?^&*' + ), + 'REGEXPS' => array( + 0 => '[\\$%@]+[a-zA-Z_][a-zA-Z0-9_]*', + 4 => '<[a-zA-Z_][a-zA-Z0-9_]*>', + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/asm.php b/plugins/dokuwiki/inc/geshi/asm.php new file mode 100644 index 0000000..cb2bfe7 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/asm.php @@ -0,0 +1,200 @@ + 'ASM', + 'COMMENT_SINGLE' => array(1 => ';'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + /*CPU*/ + 1 => array( + 'aaa','aad','aam','aas','adc','add','and','call','cbw','clc','cld','cli','cmc','cmp', + 'cmps','cmpsb','cmpsw','cwd','daa','das','dec','div','esc','hlt','idiv','imul','in','inc', + 'int','into','iret','ja','jae','jb','jbe','jc','jcxz','je','jg','jge','jl','jle','jmp', + 'jna','jnae','jnb','jnbe','jnc','jne','jng','jnge','jnl','jnle','jno','jnp','jns','jnz', + 'jo','jp','jpe','jpo','js','jz','lahf','lds','lea','les','lods','lodsb','lodsw','loop', + 'loope','loopew','loopne','loopnew','loopnz','loopnzw','loopw','loopz','loopzw','mov', + 'movs','movsb','movsw','mul','neg','nop','not','or','out','pop','popf','push','pushf', + 'rcl','rcr','ret','retf','retn','rol','ror','sahf','sal','sar','sbb','scas','scasb','scasw', + 'shl','shr','stc','std','sti','stos','stosb','stosw','sub','test','wait','xchg','xlat', + 'xlatb','xor','bound','enter','ins','insb','insw','leave','outs','outsb','outsw','popa','pusha','pushw', + 'arpl','lar','lsl','sgdt','sidt','sldt','smsw','str','verr','verw','clts','lgdt','lidt','lldt','lmsw','ltr', + 'bsf','bsr','bt','btc','btr','bts','cdq','cmpsd','cwde','insd','iretd','iretdf','iretf', + 'jecxz','lfs','lgs','lodsd','loopd','looped','loopned','loopnzd','loopzd','lss','movsd', + 'movsx','movzx','outsd','popad','popfd','pushad','pushd','pushfd','scasd','seta','setae', + 'setb','setbe','setc','sete','setg','setge','setl','setle','setna','setnae','setnb','setnbe', + 'setnc','setne','setng','setnge','setnl','setnle','setno','setnp','setns','setnz','seto','setp', + 'setpe','setpo','sets','setz','shld','shrd','stosd','bswap','cmpxchg','invd','invlpg','wbinvd','xadd','lock', + 'rep','repe','repne','repnz','repz' + ), + /*FPU*/ + 2 => array( + 'f2xm1','fabs','fadd','faddp','fbld','fbstp','fchs','fclex','fcom','fcomp','fcompp','fdecstp', + 'fdisi','fdiv','fdivp','fdivr','fdivrp','feni','ffree','fiadd','ficom','ficomp','fidiv', + 'fidivr','fild','fimul','fincstp','finit','fist','fistp','fisub','fisubr','fld','fld1', + 'fldcw','fldenv','fldenvw','fldl2e','fldl2t','fldlg2','fldln2','fldpi','fldz','fmul', + 'fmulp','fnclex','fndisi','fneni','fninit','fnop','fnsave','fnsavew','fnstcw','fnstenv', + 'fnstenvw','fnstsw','fpatan','fprem','fptan','frndint','frstor','frstorw','fsave', + 'fsavew','fscale','fsqrt','fst','fstcw','fstenv','fstenvw','fstp','fstsw','fsub','fsubp', + 'fsubr','fsubrp','ftst','fwait','fxam','fxch','fxtract','fyl2x','fyl2xp1', + 'fsetpm','fcos','fldenvd','fnsaved','fnstenvd','fprem1','frstord','fsaved','fsin','fsincos', + 'fstenvd','fucom','fucomp','fucompp' + ), + /*registers*/ + 3 => array( + 'ah','al','ax','bh','bl','bp','bx','ch','cl','cr0','cr2','cr3','cs','cx','dh','di','dl', + 'dr0','dr1','dr2','dr3','dr6','dr7','ds','dx','eax','ebp','ebx','ecx','edi','edx', + 'es','esi','esp','fs','gs','si','sp','ss','st','tr3','tr4','tr5','tr6','tr7', 'ah', 'bh', 'ch', 'dh' + ), + /*Directive*/ + 4 => array( + '186','286','286c','286p','287','386','386c','386p','387','486','486p', + '8086','8087','alpha','break','code','const','continue','cref','data','data?', + 'dosseg','else','elseif','endif','endw','err','err1','err2','errb', + 'errdef','errdif','errdifi','erre','erridn','erridni','errnb','errndef', + 'errnz','exit','fardata','fardata?','if','lall','lfcond','list','listall', + 'listif','listmacro','listmacroall',' model','no87','nocref','nolist', + 'nolistif','nolistmacro','radix','repeat','sall','seq','sfcond','stack', + 'startup','tfcond','type','until','untilcxz','while','xall','xcref', + 'xlist','alias','align','assume','catstr','comm','comment','db','dd','df','dosseg','dq', + 'dt','dup','dw','echo','else','elseif','elseif1','elseif2','elseifb','elseifdef','elseifdif', + 'elseifdifi','elseife','elseifidn','elseifidni','elseifnb','elseifndef','end', + 'endif','endm','endp','ends','eq',' equ','even','exitm','extern','externdef','extrn','for', + 'forc','ge','goto','group','high','highword','if','if1','if2','ifb','ifdef','ifdif', + 'ifdifi','ife',' ifidn','ifidni','ifnb','ifndef','include','includelib','instr','invoke', + 'irp','irpc','label','le','length','lengthof','local','low','lowword','lroffset', + 'macro','mask','mod','msfloat','name','ne','offset','opattr','option','org','%out', + 'page','popcontext','proc','proto','ptr','public','purge','pushcontext','record', + 'repeat','rept','seg','segment','short','size','sizeof','sizestr','struc','struct', + 'substr','subtitle','subttl','textequ','this','title','type','typedef','union','while','width', + '.model', '.stack', '.code', '.data' + + ), + + /*Operands*/ + 5 => array( + '@b','@f','addr','basic','byte','c','carry?','dword', + 'far','far16','fortran','fword','near','near16','overflow?','parity?','pascal','qword', + 'real4',' real8','real10','sbyte','sdword','sign?','stdcall','sword','syscall','tbyte', + 'vararg','word','zero?','flat','near32','far32', + 'abs','all','assumes','at','casemap','common','compact', + 'cpu','dotname','emulator','epilogue','error','export','expr16','expr32','farstack','flat', + 'forceframe','huge','language','large','listing','ljmp','loadds','m510','medium','memory', + 'nearstack','nodotname','noemulator','nokeyword','noljmp','nom510','none','nonunique', + 'nooldmacros','nooldstructs','noreadonly','noscoped','nosignextend','nothing', + 'notpublic','oldmacros','oldstructs','os_dos','para','private','prologue','radix', + 'readonly','req','scoped','setif2','smallstack','tiny','use16','use32','uses' + ) + ), + 'SYMBOLS' => array( + '[', ']', '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #00007f;', + 2 => 'color: #0000ff;', + 3 => 'color: #46aa03; font-weight:bold;', + 4 => 'color: #0000ff;', + 5 => 'color: #0000ff;' + ), + 'COMMENTS' => array( + 1 => 'color: #adadad; font-style: italic;', + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #7f007f;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff0000;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #ff0000;', + 1 => 'color: #ff0000;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '0[0-9a-fA-F][0-9a-fA-F]*[hH]', + 1 => '[01][01]*[bB]' + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/asp.php b/plugins/dokuwiki/inc/geshi/asp.php new file mode 100644 index 0000000..8f3c06b --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/asp.php @@ -0,0 +1,155 @@ + 'ASP', + 'COMMENT_SINGLE' => array(1 => "'", 2 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => 0, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'include', 'file', 'Dim', 'Option', 'Explicit', 'Implicit', 'Set', 'Select', 'ReDim', 'Preserve', + 'ByVal', 'ByRef', 'End', 'Private', 'Public', 'If', 'Then', 'Else', 'ElseIf', 'Case', 'With', 'NOT', + 'While', 'Wend', 'For', 'Loop', 'Do', 'Request', 'Response', 'Server', 'ADODB', 'Session', 'Application', + 'Each', 'In', 'Get', 'Next', 'INT', 'CINT', 'CBOOL', 'CDATE', 'CBYTE', 'CCUR', 'CDBL', 'CLNG', 'CSNG', + 'CSTR', 'Fix', 'Is', 'Sgn', 'String', 'Boolean', 'Currency', 'Me', 'Single', 'Long', 'Integer', 'Byte', + 'Variant', 'Double', 'To', 'Let', 'Xor', 'Resume', 'On', 'Error', 'Imp', 'GoTo', 'Call', 'Global' + ), + 2 => array( + 'Null', 'Nothing', 'And', + 'False', '<%', '%>', + '<script language=', '</script>', + 'True', 'var', 'Or', 'BOF', 'EOF', + 'Function', 'Class', 'New', 'Sub' + ), + 3 => array( + 'CreateObject', 'Write', 'Redirect', 'Cookies', 'BinaryRead', 'ClientCertificate', 'Form', 'QueryString', + 'ServerVariables', 'TotalBytes', 'AddHeader', 'AppendToLog', 'BinaryWrite', 'Buffer', 'CacheControl', + 'Charset', 'Clear', 'ContentType', 'End()', 'Expires', 'ExpiresAbsolute', 'Flush()', 'IsClientConnected', + 'PICS', 'Status', 'Connection', 'Recordset', 'Execute', 'Abandon', 'Lock', 'UnLock', 'Command', 'Fields', + 'Properties', 'Property', 'Send', 'Replace', 'InStr', 'TRIM', 'NOW', 'Day', 'Month', 'Hour', 'Minute', 'Second', + 'Year', 'MonthName', 'LCase', 'UCase', 'Abs', 'Array', 'As', 'LEN', 'MoveFirst', 'MoveLast', 'MovePrevious', + 'MoveNext', 'LBound', 'UBound', 'Transfer', 'Open', 'Close', 'MapPath', 'FileExists', 'OpenTextFile', 'ReadAll' + ) + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #990099; font-weight: bold;', + 2 => 'color: #0000ff; font-weight: bold;', + 3 => 'color: #330066;' + ), + 'COMMENTS' => array( + 1 => 'color: #008000;', + 2 => 'color: #ff6600;', + 'MULTI' => 'color: #008000;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #006600; font-weight:bold' + ), + 'STRINGS' => array( + 0 => 'color: #cc0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #800000;' + ), + 'METHODS' => array( + 1 => 'color: #9900cc;' + ), + 'SYMBOLS' => array( + 0 => 'color: #006600; font-weight: bold' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + '<%' => '%>' + ), + 1 => array( + '' + ), + 2 => array( + '' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true, + 2 => true, + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/autoit.php b/plugins/dokuwiki/inc/geshi/autoit.php new file mode 100644 index 0000000..e2e1e27 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/autoit.php @@ -0,0 +1,196 @@ + 'AutoIT', + 'COMMENT_SINGLE' => array(';'), + 'COMMENT_MULTI' => array('#comments-start' => '#comments-end'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'continueloop', 'and', 'byref', 'case', 'const', 'dim', 'do', 'else', + 'elseif', 'endfunc', 'endif', 'endselect', 'exit', 'exitloop', 'for', + 'func', 'global', 'if', 'local', 'next', 'not', 'or', 'redim', 'return', + 'select', 'step', 'then', 'to', 'until', 'wend', 'while' + ), + 2 => array( + '@appdatacommondir','@appdatadir','@autoitexe','@autoitversion','@commonfilesdir', + '@compiled','@computername','@comspec','@cr','@crlf','@desktopcommondir','@desktopdepth','@desktopdir', + '@desktopheight','@desktoprefresh','@desktopwidth','@documentscommondir','@error','@extended', + '@favoritescommondir','@favoritesdir','@gui_ctrlhandle','@gui_ctrlid','@gui_winhandle','@homedrive', + '@homepath','@homeshare','@hour','@inetgetactive','@inetgetbytesread','@ipaddress1','@ipaddress2', + '@ipaddress3','@ipaddress4','@lf','@logondnsdomain','@logondomain','@logonserver','@mday','@min', + '@mon','@mydocumentsdir','@numparams','@osbuild','@oslang','@osservicepack','@ostype','@osversion', + '@programfilesdir','@programscommondir','@programsdir','@scriptdir','@scriptfullpath','@scriptname', + '@sec','@startmenucommondir','@startmenudir','@startupcommondir','@startupdir','@sw_disable', + '@sw_enable','@sw_hide','@sw_maximize','@sw_minimize','@sw_restore','@sw_show','@sw_showdefault', + '@sw_showmaximized','@sw_showminimized','@sw_showminnoactive','@sw_showna','@sw_shownoactivate', + '@sw_shownormal','@systemdir','@tab','@tempdir','@username','@userprofiledir','@wday','@windowsdir', + '@workingdir','@yday','@year' + ), + 3 => array( + 'abs','acos','adlibdisable','adlibenable','asc','asin','assign','atan','autoitsetoption', + 'autoitwingettitle','autoitwinsettitle','bitand','bitnot','bitor','bitshift','bitxor','blockinput', + 'break','call','cdtray','chr','clipget','clipput','consolewrite','controlclick','controlcommand','controldisable', + 'controlenable','controlfocus','controlgetfocus','controlgethandle','controlgetpos','controlgettext', + 'controlhide','controllistview','controlmove','controlsend','controlsettext','controlshow','cos', + 'dec','dircopy','dircreate','dirgetsize','dirmove','dirremove','dllcall','dllclose','dllopen','drivegetdrive', + 'drivegetfilesystem','drivegetlabel','drivegetserial','drivegettype','drivemapadd','drivemapdel', + 'drivemapget','drivesetlabel','drivespacefree','drivespacetotal','drivestatus','envget','envset', + 'envupdate','eval','exp','filechangedir','fileclose','filecopy','filecreateshortcut','filedelete', + 'fileexists','filefindfirstfile','filefindnextfile','filegetattrib','filegetlongname','filegetshortcut', + 'filegetshortname','filegetsize','filegettime','filegetversion','fileinstall','filemove','fileopen', + 'fileopendialog','fileread','filereadline','filerecycle','filerecycleempty','filesavedialog', + 'fileselectfolder','filesetattrib','filesettime','filewrite','filewriteline','ftpsetproxy','guicreate', + 'guictrlcreateavi','guictrlcreatebutton','guictrlcreatecheckbox','guictrlcreatecombo','guictrlcreatecontextmenu', + 'guictrlcreatedate','guictrlcreatedummy','guictrlcreateedit','guictrlcreategroup','guictrlcreateicon', + 'guictrlcreateinput','guictrlcreatelabel','guictrlcreatelist','guictrlcreatelistview','guictrlcreatelistviewitem', + 'guictrlcreatemenu','guictrlcreatemenuitem','guictrlcreatepic','guictrlcreateprogress','guictrlcreateradio', + 'guictrlcreateslider','guictrlcreatetab','guictrlcreatetabitem','guictrlcreatetreeview','guictrlcreatetreeviewitem', + 'guictrlcreateupdown','guictrldelete','guictrlgetstate','guictrlread','guictrlrecvmsg','guictrlsendmsg', + 'guictrlsendtodummy','guictrlsetbkcolor','guictrlsetcolor','guictrlsetcursor','guictrlsetdata', + 'guictrlsetfont','guictrlsetimage','guictrlsetlimit','guictrlsetonevent','guictrlsetpos','guictrlsetresizing', + 'guictrlsetstate','guictrlsetstyle','guictrlsettip','guidelete','guigetcursorinfo','guigetmsg', + 'guisetbkcolor','guisetcoord','guisetcursor','guisetfont','guisethelp','guiseticon','guisetonevent', + 'guisetstate','guistartgroup','guiswitch','hex','hotkeyset','httpsetproxy','inetget','inetgetsize', + 'inidelete','iniread','inireadsection','inireadsectionnames','iniwrite','inputbox','int','isadmin', + 'isarray','isdeclared','isfloat','isint','isnumber','isstring','log','memgetstats','mod','mouseclick', + 'mouseclickdrag','mousedown','mousegetcursor','mousegetpos','mousemove','mouseup','mousewheel', + 'msgbox','number','opt','ping','pixelchecksum','pixelgetcolor','pixelsearch','processclose','processexists', + 'processlist','processsetpriority','processwait','processwaitclose','progressoff','progresson', + 'progressset','random','regdelete','regenumkey','regenumval','regread','regwrite','round','run','runasset', + 'runwait','send','seterror','setextended','shutdown','sin','sleep','soundplay','soundsetwavevolume', + 'splashimageon','splashoff','splashtexton','sqrt','statusbargettext','string','stringaddcr','stringformat', + 'stringinstr','stringisalnum','stringisalpha','stringisascii','stringisdigit','stringisfloat', + 'stringisint','stringislower','stringisspace','stringisupper','stringisxdigit','stringleft','stringlen', + 'stringlower','stringmid','stringregexp','stringregexpreplace','stringreplace','stringright', + 'stringsplit','stringstripcr','stringstripws','stringtrimleft','stringtrimright','stringupper', + 'tan','timerdiff','timerinit','timerstart','timerstop','tooltip','traytip','ubound','winactivate','winactive', + 'winclose','winexists','wingetcaretpos','wingetclasslist','wingetclientsize','wingethandle','wingetpos', + 'wingetprocess','wingetstate','wingettext','wingettitle','winkill','winlist','winmenuselectitem', + 'winminimizeall','winminimizeallundo','winmove','winsetontop','winsetstate','winsettitle','winsettrans', + 'winshow','winwait','winwaitactive','winwaitclose','winwaitnotactive' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '&', '*', '/', '<', '>', '+', '-', '^', '=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000FF; font-weight: bold;', + 2 => 'color: #FF33FF; font-weight: bold;', + 3 => 'color: #000090; font-style: italic; font-weight: bold;', + ), + 'COMMENTS' => array( + 0 => 'font-style: italic; color: #669900;', 'MULTI' => 'font-style: italic; color: #669900;' + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => 'color: #FF0000; font-weight: bold;' + ), + 'STRINGS' => array( + 0 => 'font-weight: bold; color: #9999CC;' + ), + 'NUMBERS' => array( + 0 => 'font-style: italic; font-weight: bold; color: #AC00A9;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #FF0000; font-weight: bold;' + ), + 'REGEXPS' => array( + 0 => 'font-weight: bold; color: #AA0000;' + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + 3 => '' + ) + ), + 'URLS' => array( + 1 => 'http://www.autoitscript.com/autoit3/docs/keywords.htm', + 2 => 'http://www.autoitscript.com/autoit3/docs/macros.htm', + 3 => 'http://www.autoitscript.com/autoit3/docs/functions/{FNAME}.htm', + 4 => '' + ), + + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => "[\\$]{1,2}[a-zA-Z_][a-zA-Z0-9_]*", + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, +/* 'SCRIPT_DELIMITERS' => array( + 0 => array( + ' '?>' + ), + 1 => array( + ' '?>' + ), + 2 => array( + '<%' => '%>' + ), + 3 => array( + '' + ) + ),*/ + + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true, + 2 => true, + 3 => true + ) +); + +?> + diff --git a/plugins/dokuwiki/inc/geshi/bash.php b/plugins/dokuwiki/inc/geshi/bash.php new file mode 100644 index 0000000..dc27c40 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/bash.php @@ -0,0 +1,137 @@ + 'Bash', + // Bash DOES have single line comments with # markers. But bash also has + // the $# variable, so comments need special handling (see sf.net + // 1564839) + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function', + 'if', 'in', 'select', 'then', 'until', 'while', 'time' + ), + 3 => array( + 'source', 'alias', 'bg', 'bind', 'break', 'builtin', 'cd', 'command', + 'compgen', 'complete', 'continue', 'declare', 'typeset', 'dirs', + 'disown', 'echo', 'enable', 'eval', 'exec', 'exit', 'export', 'fc', + 'fg', 'getopts', 'hash', 'help', 'history', 'jobs', 'kill', 'let', + 'local', 'logout', 'popd', 'printf', 'pushd', 'pwd', 'read', 'readonly', + 'return', 'set', 'shift', 'shopt', 'suspend', 'test', 'times', 'trap', + 'type', 'ulimit', 'umask', 'unalias', 'unset', 'wait' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '!', '@', '%', '&', '*', '|', '/', '<', '>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => true, + 3 => true, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0000ff;', + 1 => 'color: #0000ff;', + 2 => 'color: #0000ff;', + 3 => 'color: #808080; font-style: italic;', + 4 => 'color: #0000ff;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 3 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => "\\$\\{[a-zA-Z_][a-zA-Z0-9_]*?\\}", + 1 => "\\$[a-zA-Z_][a-zA-Z0-9_]*", + 2 => "([a-zA-Z_][a-zA-Z0-9_]*)=", + 3 => "(? "\\$#" + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/c.php b/plugins/dokuwiki/inc/geshi/c.php new file mode 100644 index 0000000..43ce60a --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/c.php @@ -0,0 +1,144 @@ + 'C', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'if', 'return', 'while', 'case', 'continue', 'default', + 'do', 'else', 'for', 'switch', 'goto' + ), + 2 => array( + 'null', 'false', 'break', 'true', 'function', 'enum', 'extern', 'inline' + ), + 3 => array( + 'printf', 'cout' + ), + 4 => array( + 'auto', 'char', 'const', 'double', 'float', 'int', 'long', + 'register', 'short', 'signed', 'sizeof', 'static', 'string', 'struct', + 'typedef', 'union', 'unsigned', 'void', 'volatile', 'wchar_t' + ), + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #339933;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #202020;', + 2 => 'color: #202020;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAME}.html', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + 2 => '::' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/c_mac.php b/plugins/dokuwiki/inc/geshi/c_mac.php new file mode 100644 index 0000000..3239467 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/c_mac.php @@ -0,0 +1,176 @@ + 'C (Mac)', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'if', 'return', 'while', 'case', 'continue', 'default', + 'do', 'else', 'for', 'switch', 'goto' + ), + 2 => array( + 'NULL', 'false', 'break', 'true', 'enum', 'errno', 'EDOM', + 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG', + 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG', + 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP', + 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP', + 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN', + 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN', + 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT', + 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR', + 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam', 'NULL', + 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr', + 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC', + // Mac-specific constants: + 'kCFAllocatorDefault' + ), + 3 => array( + 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert', + 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint', + 'ispunct', 'isspace', 'ispunct', 'isupper', 'isxdigit', 'tolower', 'toupper', + 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp', + 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2', + 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp', 'asin', 'acos', 'atan', 'atan2', + 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen', + 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf', + 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf', + 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc', + 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind', + 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs', + 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc', + 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv', + 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat', + 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn', + 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy', + 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime', + 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime' + ), + 4 => array( + 'auto', 'char', 'const', 'double', 'float', 'int', 'long', + 'register', 'short', 'signed', 'sizeof', 'static', 'string', 'struct', + 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf', + 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t', + 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', + // Mac-specific types: + 'CFArrayRef', 'CFDictionaryRef', 'CFMutableDictionaryRef', 'CFBundleRef', 'CFSetRef', 'CFStringRef', + 'CFURLRef', 'CFLocaleRef', 'CFDateFormatterRef', 'CFNumberFormatterRef', 'CFPropertyListRef', + 'CFTreeRef', 'CFWriteStreamRef', 'CFCharacterSetRef', 'CFMutableStringRef', 'CFNotificationRef', + 'CFNotificationRef', 'CFReadStreamRef', 'CFNull', 'CFAllocatorRef', 'CFBagRef', 'CFBinaryHeapRef', + 'CFBitVectorRef', 'CFBooleanRef', 'CFDataRef', 'CFDateRef', 'CFMachPortRef', 'CFMessagePortRef', + 'CFMutableArrayRef', 'CFMutableBagRef', 'CFMutableBitVectorRef', 'CFMutableCharacterSetRef', + 'CFMutableDataRef', 'CFMutableSetRef', 'CFNumberRef', 'CFPlugInRef', 'CFPlugInInstanceRef', + 'CFRunLoopRef', 'CFRunLoopObserverRef', 'CFRunLoopSourceRef', 'CFRunLoopTimerRef', 'CFSocketRef', + 'CFTimeZoneRef', 'CFTypeRef', 'CFUserNotificationRef', 'CFUUIDRef', 'CFXMLNodeRef', 'CFXMLParserRef', + 'CFXMLTreeRef' + ), + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000ff;', + 2 => 'color: #0000ff;', + 3 => 'color: #0000dd;', + 4 => 'color: #0000ff;' + ), + 'COMMENTS' => array( + 1 => 'color: #ff0000;', + 2 => 'color: #339900;', + 'MULTI' => 'color: #ff0000; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #666666; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' + ), + 'STRINGS' => array( + 0 => 'color: #666666;' + ), + 'NUMBERS' => array( + 0 => 'color: #0000dd;' + ), + 'METHODS' => array( + 1 => 'color: #00eeff;', + 2 => 'color: #00eeff;' + ), + 'SYMBOLS' => array( + 0 => 'color: #000000;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAME}.html', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + 2 => '::' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/caddcl.php b/plugins/dokuwiki/inc/geshi/caddcl.php new file mode 100644 index 0000000..444f774 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/caddcl.php @@ -0,0 +1,127 @@ + 'CAD DCL', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'boxed_column','boxed_radio_column','boxed_radio_row','boxed_row', + 'column','concatenation','button','dialog','edit_box','image','image_button', + 'errtile','list_box','ok_cancel','ok_cancel_help','ok_cancel_help_errtile', + 'ok_cancel_help_info','ok_only','paragraph','popup_list','radio_button', + 'radio_column','radio_row','row','slider','spacer','spacer_0','spacer_1','text', + 'text_part','toggle', + 'action','alignment','allow_accept','aspect_ratio','big_increment', + 'children_alignment','children_fixed_height', + 'children_fixed_width','color', + 'edit_limit','edit_width','fixed_height','fixed_width', + 'height','initial_focus','is_cancel','is_default', + 'is_enabled','is_tab_stop','is-bold','key','label','layout','list', + 'max_value','min_value','mnemonic','multiple_select','password_char', + 'small_increment','tabs','tab_truncate','value','width', + 'false','true','left','right','centered','top','bottom', + 'dialog_line','dialog_foreground','dialog_background', + 'graphics_background','black','red','yellow','green','cyan', + 'blue','magenta','whitegraphics_foreground', + 'horizontal','vertical' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/cadlisp.php b/plugins/dokuwiki/inc/geshi/cadlisp.php new file mode 100644 index 0000000..d57e5ed --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/cadlisp.php @@ -0,0 +1,187 @@ + 'CAD Lisp', + 'COMMENT_SINGLE' => array(1 => ";"), + 'COMMENT_MULTI' => array(";|" => "|;"), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'abs','acad_colordlg','acad_helpdlg','acad_strlsort','action_tile', + 'add_list','alert','alloc','and','angle','angtof','angtos','append','apply', + 'arx','arxload','arxunload','ascii','assoc','atan','atof','atoi','atom', + 'atoms-family','autoarxload','autoload','Boole','boundp','caddr', + 'cadr','car','cdr','chr','client_data_tile','close','command','cond', + 'cons','cos','cvunit','defun','defun-q','defun-q-list-ref', + 'defun-q-list-set','dictadd','dictnext','dictremove','dictrename', + 'dictsearch','dimx_tile','dimy_tile','distance','distof','done_dialog', + 'end_image','end_list','entdel','entget','entlast','entmake', + 'entmakex','entmod','entnext','entsel','entupd','eq','equal','eval','exit', + 'exp','expand','expt','fill_image','findfile','fix','float','foreach','function', + 'gc','gcd','get_attr','get_tile','getangle','getcfg','getcname','getcorner', + 'getdist','getenv','getfiled','getint','getkword','getorient','getpoint', + 'getreal','getstring','getvar','graphscr','grclear','grdraw','grread','grtext', + 'grvecs','handent','help','if','initdia','initget','inters','itoa','lambda','last', + 'layoutlist','length','list','listp','load','load_dialog','log','logand','logior', + 'lsh','mapcar','max','mem','member','menucmd','menugroup','min','minusp','mode_tile', + 'namedobjdict','nentsel','nentselp','new_dialog','nil','not','nth','null', + 'numberp','open','or','osnap','polar','prin1','princ','print','progn','prompt', + 'quit','quote','read','read-char','read-line','redraw','regapp','rem','repeat', + 'reverse','rtos','set','set_tile','setcfg','setenv','setfunhelp','setq','setvar', + 'setview','sin','slide_image','snvalid','sqrt','ssadd','ssdel','ssget','ssgetfirst', + 'sslength','ssmemb','ssname','ssnamex','sssetfirst','start_dialog','start_image', + 'start_list','startapp','strcase','strcat','strlen','subst','substr','t','tablet', + 'tblnext','tblobjname','tblsearch','term_dialog','terpri','textbox','textpage', + 'textscr','trace','trans','type','unload_dialog','untrace','vector_image','ver', + 'vports','wcmatch','while','write-char','write-line','xdroom','xdsize','zerop', + 'vl-acad-defun','vl-acad-undefun','vl-arx-import','vlax-3D-point', + 'vlax-add-cmd','vlax-create-object','vlax-curve-getArea', + 'vlax-curve-getClosestPointTo','vlax-curve-getClosestPointToProjection', + 'vlax-curve-getDistAtParam','vlax-curve-getDistAtPoint', + 'vlax-curve-getEndParam','vlax-curve-getEndPoint', + 'vlax-curve-getFirstDeriv','vlax-curve-getParamAtDist', + 'vlax-curve-getParamAtPoint','vlax-curve-getPointAtDist', + 'vlax-curve-getPointAtParam','vlax-curve-getSecondDeriv', + 'vlax-curve-getStartParam','vlax-curve-getStartPoint', + 'vlax-curve-isClosed','vlax-curve-isPeriodic','vlax-curve-isPlanar', + 'vlax-dump-object','vlax-erased-p','vlax-for','vlax-get-acad-object', + 'vlax-get-object','vlax-get-or-create-object','vlax-get-property', + 'vlax-import-type-library','vlax-invoke-method','vlax-ldata-delete', + 'vlax-ldata-get','vlax-ldata-list','vlax-ldata-put','vlax-ldata-test', + 'vlax-make-safearray','vlax-make-variant','vlax-map-collection', + 'vlax-method-applicable-p','vlax-object-released-p','vlax-product-key', + 'vlax-property-available-p','vlax-put-property','vlax-read-enabled-p', + 'vlax-release-object','vlax-remove-cmd','vlax-safearray-fill', + 'vlax-safearray-get-dim','vlax-safearray-get-element', + 'vlax-safearray-get-l-bound','vlax-safearray-get-u-bound', + 'vlax-safearray-put-element','vlax-safearray-type','vlax-tmatrix', + 'vlax-typeinfo-available-p','vlax-variant-change-type', + 'vlax-variant-type','vlax-variant-value','vlax-write-enabled-p', + 'vl-bb-ref','vl-bb-set','vl-catch-all-apply','vl-catch-all-error-message', + 'vl-catch-all-error-p','vl-cmdf','vl-consp','vl-directory-files','vl-doc-export', + 'vl-doc-import','vl-doc-ref','vl-doc-set','vl-every','vl-exit-with-error', + 'vl-exit-with-value','vl-file-copy','vl-file-delete','vl-file-directory-p', + 'vl-filename-base','vl-filename-directory','vl-filename-extension', + 'vl-filename-mktemp','vl-file-rename','vl-file-size','vl-file-systime', + 'vl-get-resource','vlisp-compile','vl-list-exported-functions', + 'vl-list-length','vl-list-loaded-vlx','vl-load-all','vl-load-com', + 'vl-load-reactors','vl-member-if','vl-member-if-not','vl-position', + 'vl-prin1-to-string','vl-princ-to-string','vl-propagate','vlr-acdb-reactor', + 'vlr-add','vlr-added-p','vlr-beep-reaction','vlr-command-reactor', + 'vlr-current-reaction-name','vlr-data','vlr-data-set', + 'vlr-deepclone-reactor','vlr-docmanager-reactor','vlr-dwg-reactor', + 'vlr-dxf-reactor','vlr-editor-reactor','vl-registry-delete', + 'vl-registry-descendents','vl-registry-read','vl-registry-write', + 'vl-remove','vl-remove-if','vl-remove-if-not','vlr-insert-reactor', + 'vlr-linker-reactor','vlr-lisp-reactor','vlr-miscellaneous-reactor', + 'vlr-mouse-reactor','vlr-notification','vlr-object-reactor', + 'vlr-owner-add','vlr-owner-remove','vlr-owners','vlr-pers','vlr-pers-list', + 'vlr-pers-p','vlr-pers-release','vlr-reaction-names','vlr-reactions', + 'vlr-reaction-set','vlr-reactors','vlr-remove','vlr-remove-all', + 'vlr-set-notification','vlr-sysvar-reactor','vlr-toolbar-reactor', + 'vlr-trace-reaction','vlr-type','vlr-types','vlr-undo-reactor', + 'vlr-wblock-reactor','vlr-window-reactor','vlr-xref-reactor', + 'vl-some','vl-sort','vl-sort-i','vl-string-elt','vl-string-left-trim', + 'vl-string-mismatch','vl-string-position','vl-string-right-trim', + 'vl-string-search','vl-string-subst','vl-string-translate','vl-string-trim', + 'vl-symbol-name','vl-symbolp','vl-symbol-value','vl-unload-vlx','vl-vbaload', + 'vl-vbarun','vl-vlx-loaded-p' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '!', '%', '^', '&', '/','+','-','*','=','<','>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/cpp.php b/plugins/dokuwiki/inc/geshi/cpp.php new file mode 100644 index 0000000..3df350e --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/cpp.php @@ -0,0 +1,172 @@ + 'C++', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'case', 'continue', 'default', 'do', 'else', 'for', 'goto', 'if', 'return', + 'switch', 'while' + ), + 2 => array( + 'NULL', 'false', 'break', 'true', 'enum', 'errno', 'EDOM', + 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG', + 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG', + 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP', + 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP', + 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN', + 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN', + 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT', + 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR', + 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam', 'NULL', + 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr', + 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC', + 'virtual', 'public', 'private', 'protected', 'template', 'using', 'namespace', + 'try', 'catch', 'inline', 'dynamic_cast', 'const_cast', 'reinterpret_cast', + 'static_cast', 'explicit', 'friend', 'wchar_t', 'typename', 'typeid', 'class' + ), + 3 => array( + 'cin', 'cerr', 'clog', 'cout', 'delete', 'new', 'this', + 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert', + 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint', + 'ispunct', 'isspace', 'ispunct', 'isupper', 'isxdigit', 'tolower', 'toupper', + 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp', + 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2', + 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp', 'asin', 'acos', 'atan', 'atan2', + 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen', + 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf', + 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf', + 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc', + 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind', + 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs', + 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc', + 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv', + 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat', + 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn', + 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy', + 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime', + 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime' + ), + 4 => array( + 'auto', 'bool', 'char', 'const', 'double', 'float', 'int', 'long', 'longint', + 'register', 'short', 'shortint', 'signed', 'static', 'struct', + 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf', + 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t', + 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', + ), + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000ff;', + 2 => 'color: #0000ff;', + 3 => 'color: #0000dd;', + 4 => 'color: #0000ff;' + ), + 'COMMENTS' => array( + 1 => 'color: #ff0000;', + 2 => 'color: #339900;', + 'MULTI' => 'color: #ff0000; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #666666; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' + ), + 'STRINGS' => array( + 0 => 'color: #666666;' + ), + 'NUMBERS' => array( + 0 => 'color: #0000dd;' + ), + 'METHODS' => array( + 1 => 'color: #00eeff;', + 2 => 'color: #00eeff;' + ), + 'SYMBOLS' => array( + 0 => 'color: #000000;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + 2 => '::' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/csharp.php b/plugins/dokuwiki/inc/geshi/csharp.php new file mode 100644 index 0000000..6371405 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/csharp.php @@ -0,0 +1,233 @@ + 'C#', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'HARDQUOTE' => array('@"', '"'), + 'HARDESCAPE' => array('""'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'as', 'auto', 'base', 'break', 'case', 'catch', 'const', 'continue', + 'default', 'do', 'else', 'event', 'explicit', 'extern', 'false', + 'finally', 'fixed', 'for', 'foreach', 'goto', 'if', 'implicit', + 'in', 'internal', 'lock', 'namespace', 'null', 'operator', 'out', + 'override', 'params', 'private', 'protected', 'public', 'readonly', + 'ref', 'return', 'sealed', 'stackalloc', 'static', 'switch', 'this', + 'throw', 'true', 'try', 'unsafe', 'using', 'virtual', 'void', 'while' + ), + 2 => array( + '#elif', '#endif', '#endregion', '#else', '#error', '#define', '#if', + '#line', '#region', '#undef', '#warning' + ), + 3 => array( + 'checked', 'is', 'new', 'sizeof', 'typeof', 'unchecked' + ), + 4 => array( + 'bool', 'byte', 'char', 'class', 'decimal', 'delegate', 'double', + 'enum', 'float', 'int', 'interface', 'long', 'object', 'sbyte', + 'short', 'string', 'struct', 'uint', 'ulong', 'ushort' + ), + 5 => array( + 'Microsoft.Win32', + 'System', + 'System.CodeDOM', + 'System.CodeDOM.Compiler', + 'System.Collections', + 'System.Collections.Bases', + 'System.ComponentModel', + 'System.ComponentModel.Design', + 'System.ComponentModel.Design.CodeModel', + 'System.Configuration', + 'System.Configuration.Assemblies', + 'System.Configuration.Core', + 'System.Configuration.Install', + 'System.Configuration.Interceptors', + 'System.Configuration.Schema', + 'System.Configuration.Web', + 'System.Core', + 'System.Data', + 'System.Data.ADO', + 'System.Data.Design', + 'System.Data.Internal', + 'System.Data.SQL', + 'System.Data.SQLTypes', + 'System.Data.XML', + 'System.Data.XML.DOM', + 'System.Data.XML.XPath', + 'System.Data.XML.XSLT', + 'System.Diagnostics', + 'System.Diagnostics.SymbolStore', + 'System.DirectoryServices', + 'System.Drawing', + 'System.Drawing.Design', + 'System.Drawing.Drawing2D', + 'System.Drawing.Imaging', + 'System.Drawing.Printing', + 'System.Drawing.Text', + 'System.Globalization', + 'System.IO', + 'System.IO.IsolatedStorage', + 'System.Messaging', + 'System.Net', + 'System.Net.Sockets', + 'System.NewXml', + 'System.NewXml.XPath', + 'System.NewXml.Xsl', + 'System.Reflection', + 'System.Reflection.Emit', + 'System.Resources', + 'System.Runtime.InteropServices', + 'System.Runtime.InteropServices.Expando', + 'System.Runtime.Remoting', + 'System.Runtime.Serialization', + 'System.Runtime.Serialization.Formatters', + 'System.Runtime.Serialization.Formatters.Binary', + 'System.Security', + 'System.Security.Cryptography', + 'System.Security.Cryptography.X509Certificates', + 'System.Security.Permissions', + 'System.Security.Policy', + 'System.Security.Principal', + 'System.ServiceProcess', + 'System.Text', + 'System.Text.RegularExpressions', + 'System.Threading', + 'System.Timers', + 'System.Web', + 'System.Web.Caching', + 'System.Web.Configuration', + 'System.Web.Security', + 'System.Web.Services', + 'System.Web.Services.Description', + 'System.Web.Services.Discovery', + 'System.Web.Services.Protocols', + 'System.Web.UI', + 'System.Web.UI.Design', + 'System.Web.UI.Design.WebControls', + 'System.Web.UI.Design.WebControls.ListControls', + 'System.Web.UI.HtmlControls', + 'System.Web.UI.WebControls', + 'System.WinForms', + 'System.WinForms.ComponentModel', + 'System.WinForms.Design', + 'System.Xml', + 'System.Xml.Serialization', + 'System.Xml.Serialization.Code', + 'System.Xml.Serialization.Schema' + ), + ), + 'SYMBOLS' => array( + '+', '-', '*', '?', '=', '/', '%', '&', '>', '<', '^', '!', '|', ':', + '(', ')', '{', '}', '[', ']' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0600FF;', + 2 => 'color: #FF8000; font-weight: bold;', + 3 => 'color: #008000;', + 4 => 'color: #FF0000;', + 5 => 'color: #000000;' + ), + 'COMMENTS' => array( + 1 => 'color: #008080; font-style: italic;', + 2 => 'color: #008080;', + 'MULTI' => 'color: #008080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #008080; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' + ), + 'STRINGS' => array( + 0 => 'color: #808080;' + ), + 'NUMBERS' => array( + 0 => 'color: #FF0000;' + ), + 'METHODS' => array( + 1 => 'color: #0000FF;', + 2 => 'color: #0000FF;' + ), + 'SYMBOLS' => array( + 0 => 'color: #008000;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.google.com/search?q={FNAME}+msdn.microsoft.com', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + 2 => '::' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/css.php b/plugins/dokuwiki/inc/geshi/css.php new file mode 100644 index 0000000..3331027 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/css.php @@ -0,0 +1,178 @@ + 'CSS', + 'COMMENT_SINGLE' => array(1 => '@'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"', "'"), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'aqua', 'azimuth', 'background-attachment', 'background-color', + 'background-image', 'background-position', 'background-repeat', + 'background', 'black', 'blue', 'border-bottom-color', 'border-bottom-style', + 'border-bottom-width', 'border-left-color', 'border-left-style', + 'border-left-width', 'border-right', 'border-right-color', + 'border-right-style', 'border-right-width', 'border-top-color', + 'border-top-style', 'border-top-width','border-bottom', 'border-collapse', + 'border-left', 'border-width', 'border-color', 'border-spacing', + 'border-style', 'border-top', 'border', 'caption-side', + 'clear', 'clip', 'color', 'content', 'counter-increment', 'counter-reset', + 'cue-after', 'cue-before', 'cue', 'cursor', 'direction', 'display', + 'elevation', 'empty-cells', 'float', 'font-family', 'font-size', + 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', + 'font-weight', 'font', 'height', 'letter-spacing', 'line-height', + 'list-style', 'list-style-image', 'list-style-position', 'list-style-type', + 'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'margin', + 'marker-offset', 'marks', 'max-height', 'max-width', 'min-height', + 'min-width', 'orphans', 'outline', 'outline-color', 'outline-style', + 'outline-width', 'overflow', 'padding-bottom', 'padding-left', + 'padding-right', 'padding-top', 'padding', 'page', 'page-break-after', + 'page-break-before', 'page-break-inside', 'pause-after', 'pause-before', + 'pause', 'pitch', 'pitch-range', 'play-during', 'position', 'quotes', + 'richness', 'right', 'size', 'speak-header', 'speak-numeral', 'speak-punctuation', + 'speak', 'speech-rate', 'stress', 'table-layout', 'text-align', 'text-decoration', + 'text-indent', 'text-shadow', 'text-transform', 'top', 'unicode-bidi', + 'vertical-align', 'visibility', 'voice-family', 'volume', 'white-space', 'widows', + 'width', 'word-spacing', 'z-index', 'bottom', 'left' + ), + 2 => array( + 'above', 'absolute', 'always', 'armenian', 'aural', 'auto', 'avoid', + 'baseline', 'behind', 'below', 'bidi-override', 'blink', 'block', 'bold', 'bolder', 'both', + 'capitalize', 'center-left', 'center-right', 'center', 'circle', 'cjk-ideographic', + 'close-quote', 'collapse', 'condensed', 'continuous', 'crop', 'crosshair', 'cross', 'cursive', + 'dashed', 'decimal-leading-zero', 'decimal', 'default', 'digits', 'disc', 'dotted', 'double', + 'e-resize', 'embed', 'extra-condensed', 'extra-expanded', 'expanded', + 'fantasy', 'far-left', 'far-right', 'faster', 'fast', 'fixed', 'fuchsia', + 'georgian', 'gray', 'green', 'groove', 'hebrew', 'help', 'hidden', 'hide', 'higher', + 'high', 'hiragana-iroha', 'hiragana', 'icon', 'inherit', 'inline-table', 'inline', + 'inset', 'inside', 'invert', 'italic', 'justify', 'katakana-iroha', 'katakana', + 'landscape', 'larger', 'large', 'left-side', 'leftwards', 'level', 'lighter', 'lime', 'line-through', 'list-item', 'loud', 'lower-alpha', 'lower-greek', 'lower-roman', 'lowercase', 'ltr', 'lower', 'low', + 'maroon', 'medium', 'message-box', 'middle', 'mix', 'monospace', + 'n-resize', 'narrower', 'navy', 'ne-resize', 'no-close-quote', 'no-open-quote', 'no-repeat', 'none', 'normal', 'nowrap', 'nw-resize', + 'oblique', 'olive', 'once', 'open-quote', 'outset', 'outside', 'overline', + 'pointer', 'portrait', 'purple', 'px', + 'red', 'relative', 'repeat-x', 'repeat-y', 'repeat', 'rgb', 'ridge', 'right-side', 'rightwards', + 's-resize', 'sans-serif', 'scroll', 'se-resize', 'semi-condensed', 'semi-expanded', 'separate', 'serif', 'show', 'silent', 'silver', 'slow', 'slower', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid', 'spell-out', 'square', + 'static', 'status-bar', 'super', 'sw-resize', + 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row', 'table-row-group', 'teal', 'text', 'text-bottom', 'text-top', 'thick', 'thin', 'transparent', + 'ultra-condensed', 'ultra-expanded', 'underline', 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url', + 'visible', + 'w-resize', 'wait', 'white', 'wider', + 'x-fast', 'x-high', 'x-large', 'x-loud', 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small', + 'yellow', 'yes' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', ':', ';' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => true, + 2 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000000; font-weight: bold;', + 2 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1 => 'color: #a1a100;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + 0 => 'color: #cc00cc;', + 1 => 'color: #6666ff;', + 2 => 'color: #3333ff;', + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '\#[a-zA-Z0-9\-]+\s+\{', + 1 => '\.[a-zA-Z0-9\-]+\s', + 2 => ':[a-zA-Z0-9\-]+\s' + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/d.php b/plugins/dokuwiki/inc/geshi/d.php new file mode 100644 index 0000000..1cb8d74 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/d.php @@ -0,0 +1,287 @@ + 'D', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"', "'", '`'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'while', + 'switch', + 'if', + 'foreach', + 'for', + 'goto', + 'return', + 'else', + 'do', + 'case', + 'continue', + 'break' + ), + 2 => array( + 'with', + 'union', + 'typeof', + 'typeid', + 'typedef', + 'try', + 'true', + 'throw', + 'this', + 'super', + 'pragma', + 'out', + 'null', + 'new', + 'module', + 'mixin', + 'is', + 'invariant', + 'interface', + 'inout', + 'in', + 'import', + 'function', + 'finally', + 'false', + 'extern', + 'delete', + 'delegate', + 'default', + 'catch', + 'cast', + 'body', + 'assert', + 'asm', + 'alias' + ), + 3 => array( + 'TypeInfo', + 'SwitchError', + 'OutOfMemoryException', + 'Object', + 'ModuleInfo', + 'Interface', + 'Exception', + 'Error', + 'ClassInfo', + 'ArrayBoundsError', + 'AssertError', + '_d_throw', + '_d_switch_ustring', + '_d_switch_string', + '_d_switch_dstring', + '_d_OutOfMemory', + '_d_obj_eq', + '_d_obj_cmp', + '_d_newclass', + '_d_newbitarray', + '_d_newarrayi', + '_d_new', + '_d_monitorrelease', + '_d_monitor_prolog', + '_d_monitor_handler', + '_d_monitorexit', + '_d_monitor_epilog', + '_d_monitorenter', + '_d_local_unwind', + '_d_isbaseof2', + '_d_isbaseof', + '_d_invariant', + '_d_interface_vtbl', + '_d_interface_cast', + '_d_framehandler', + '_d_exception_filter', + '_d_exception', + '_d_dynamic_cast', + '_d_delmemory', + '_d_delinterface', + '_d_delclass', + '_d_delarray', + '_d_criticalexit', + '_d_criticalenter', + '_d_create_exception_object', + '_d_callfinalizer', + '_d_arraysetlengthb', + '_d_arraysetlength', + '_d_arraysetbit2', + '_d_arraysetbit', + '_d_arraycopybit', + '_d_arraycopy', + '_d_arraycatn', + '_d_arraycatb', + '_d_arraycat', + '_d_arraycast_frombit', + '_d_arraycast', + '_d_arrayappendcb', + '_d_arrayappendc', + '_d_arrayappendb', + '_d_arrayappend', + ), + 4 => array( + 'wchar', + 'volatile', + 'void', + 'version', + 'ushort', + 'unittest', + 'ulong', + 'uint', + 'ucent', + 'ubyte', + 'template', + 'struct', + 'static', + 'synchronized', + 'size_t', + 'short', + 'real', + 'public', + 'protected', + 'private', + 'ptrdiff_t', + 'package', + 'override', + 'long', + 'int', + 'ireal', + 'ifloat', + 'idouble', + 'float', + 'final', + 'export', + 'enum', + 'double', + 'deprecated', + 'debug', + 'dchar', + 'creal', + 'const', + 'class', + 'char', + 'cfloat', + 'cent', + 'cdouble', + 'byte', + 'bool', + 'bit', + 'auto', + 'align', + 'abstract' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '?', '!', ';', ':', ',', '...', '..', + '+', '-', '*', '/', '%', '&', '|', '^', '<', '>', '=', '~', + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => true, + 2 => true, + 3 => true, + 4 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #aaaadd; font-weight: bold;', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1=> 'color: #808080; font-style: italic;', + 2=> 'color: #a1a100;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/delphi.php b/plugins/dokuwiki/inc/geshi/delphi.php new file mode 100644 index 0000000..3c85f30 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/delphi.php @@ -0,0 +1,272 @@ + 'Delphi', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('(*' => '*)', '{' => '}'), + 'CASE_KEYWORDS' => 0, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'Abstract', 'And', 'Array', 'As', 'Asm', 'At', 'Begin', 'Case', 'Class', + 'Const', 'Constructor', 'Contains', 'Destructor', 'DispInterface', 'Div', + 'Do', 'DownTo', 'Else', 'End', 'Except', 'File', 'Finalization', + 'Finally', 'For', 'Function', 'Goto', 'If', 'Implementation', 'In', + 'Inherited', 'Initialization', 'Inline', 'Interface', 'Is', 'Label', + 'Mod', 'Not', 'Object', 'Of', 'On', 'Or', 'Overload', 'Override', + 'Package', 'Packed', 'Private', 'Procedure', 'Program', 'Property', + 'Protected', 'Public', 'Published', 'Raise', 'Record', 'Repeat', + 'Requires', 'Resourcestring', 'Set', 'Shl', 'Shr', 'Then', 'ThreadVar', + 'To', 'Try', 'Type', 'Unit', 'Until', 'Uses', 'Var', 'Virtual', 'While', + 'With', 'Xor', 'assembler', 'cdecl', 'far', 'near', 'pascal', 'register', + 'safecall', 'stdcall', 'varargs' + ), + 2 => array( + 'nil', 'false', 'self', 'true', 'var', 'type', 'const' + ), + 3 => array( + 'Abs', 'AcquireExceptionObject', 'Addr', 'AnsiToUtf8', 'Append', 'ArcTan', + 'Assert', 'AssignFile', 'Assigned', 'BeginThread', 'BlockRead', + 'BlockWrite', 'Break', 'ChDir', 'Chr', 'Close', 'CloseFile', + 'CompToCurrency', 'CompToDouble', 'Concat', 'Continue', 'Copy', 'Cos', + 'Dec', 'Delete', 'Dispose', 'DoubleToComp', 'EndThread', 'EnumModules', + 'EnumResourceModules', 'Eof', 'Eoln', 'Erase', 'ExceptAddr', + 'ExceptObject', 'Exclude', 'Exit', 'Exp', 'FilePos', 'FileSize', + 'FillChar', 'Finalize', 'FindClassHInstance', 'FindHInstance', + 'FindResourceHInstance', 'Flush', 'Frac', 'FreeMem', 'Get8087CW', + 'GetDir', 'GetLastError', 'GetMem', 'GetMemoryManager', + 'GetModuleFileName', 'GetVariantManager', 'Halt', 'Hi', 'High', + 'IOResult', 'Inc', 'Include', 'Initialize', 'Insert', 'Int', + 'IsMemoryManagerSet', 'IsVariantManagerSet', 'Length', 'Ln', 'Lo', 'Low', + 'MkDir', 'Move', 'New', 'Odd', 'OleStrToStrVar', 'OleStrToString', 'Ord', + 'PUCS4Chars', 'ParamCount', 'ParamStr', 'Pi', 'Pos', 'Pred', 'Ptr', + 'Random', 'Randomize', 'Read', 'ReadLn', 'ReallocMem', + 'ReleaseExceptionObject', 'Rename', 'Reset', 'Rewrite', 'RmDir', 'Round', + 'RunError', 'Seek', 'SeekEof', 'SeekEoln', 'Set8087CW', 'SetLength', + 'SetLineBreakStyle', 'SetMemoryManager', 'SetString', 'SetTextBuf', + 'SetVariantManager', 'Sin', 'SizeOf', 'Slice', 'Sqr', 'Sqrt', 'Str', + 'StringOfChar', 'StringToOleStr', 'StringToWideChar', 'Succ', 'Swap', + 'Trunc', 'Truncate', 'TypeInfo', 'UCS4StringToWideString', 'UTF8Decode', + 'UTF8Encode', 'UnicodeToUtf8', 'UniqueString', 'UpCase', 'Utf8ToAnsi', + 'Utf8ToUnicode', 'Val', 'VarArrayRedim', 'VarClear', + 'WideCharLenToStrVar', 'WideCharLenToString', 'WideCharToStrVar', + 'WideCharToString', 'WideStringToUCS4String', 'Write', 'WriteLn', + + 'Abort', 'AddExitProc', 'AddTerminateProc', 'AdjustLineBreaks', 'AllocMem', + 'AnsiCompareFileName', 'AnsiCompareStr', 'AnsiCompareText', + 'AnsiDequotedStr', 'AnsiExtractQuotedStr', 'AnsiLastChar', + 'AnsiLowerCase', 'AnsiLowerCaseFileName', 'AnsiPos', 'AnsiQuotedStr', + 'AnsiSameStr', 'AnsiSameText', 'AnsiStrComp', 'AnsiStrIComp', + 'AnsiStrLComp', 'AnsiStrLIComp', 'AnsiStrLastChar', 'AnsiStrLower', + 'AnsiStrPos', 'AnsiStrRScan', 'AnsiStrScan', 'AnsiStrUpper', + 'AnsiUpperCase', 'AnsiUpperCaseFileName', 'AppendStr', 'AssignStr', + 'Beep', 'BoolToStr', 'ByteToCharIndex', 'ByteToCharLen', 'ByteType', + 'CallTerminateProcs', 'ChangeFileExt', 'CharLength', 'CharToByteIndex', + 'CharToByteLen', 'CompareMem', 'CompareStr', 'CompareText', 'CreateDir', + 'CreateGUID', 'CurrToStr', 'CurrToStrF', 'CurrentYear', 'Date', + 'DateTimeToFileDate', 'DateTimeToStr', 'DateTimeToString', + 'DateTimeToSystemTime', 'DateTimeToTimeStamp', 'DateToStr', 'DayOfWeek', + 'DecodeDate', 'DecodeDateFully', 'DecodeTime', 'DeleteFile', + 'DirectoryExists', 'DiskFree', 'DiskSize', 'DisposeStr', 'EncodeDate', + 'EncodeTime', 'ExceptionErrorMessage', 'ExcludeTrailingBackslash', + 'ExcludeTrailingPathDelimiter', 'ExpandFileName', 'ExpandFileNameCase', + 'ExpandUNCFileName', 'ExtractFileDir', 'ExtractFileDrive', + 'ExtractFileExt', 'ExtractFileName', 'ExtractFilePath', + 'ExtractRelativePath', 'ExtractShortPathName', 'FileAge', 'FileClose', + 'FileCreate', 'FileDateToDateTime', 'FileExists', 'FileGetAttr', + 'FileGetDate', 'FileIsReadOnly', 'FileOpen', 'FileRead', 'FileSearch', + 'FileSeek', 'FileSetAttr', 'FileSetDate', 'FileSetReadOnly', 'FileWrite', + 'FinalizePackage', 'FindClose', 'FindCmdLineSwitch', 'FindFirst', + 'FindNext', 'FloatToCurr', 'FloatToDateTime', 'FloatToDecimal', + 'FloatToStr', 'FloatToStrF', 'FloatToText', 'FloatToTextFmt', + 'FmtLoadStr', 'FmtStr', 'ForceDirectories', 'Format', 'FormatBuf', + 'FormatCurr', 'FormatDateTime', 'FormatFloat', 'FreeAndNil', + 'GUIDToString', 'GetCurrentDir', 'GetEnvironmentVariable', + 'GetFileVersion', 'GetFormatSettings', 'GetLocaleFormatSettings', + 'GetModuleName', 'GetPackageDescription', 'GetPackageInfo', 'GetTime', + 'IncAMonth', 'IncMonth', 'IncludeTrailingBackslash', + 'IncludeTrailingPathDelimiter', 'InitializePackage', 'IntToHex', + 'IntToStr', 'InterlockedDecrement', 'InterlockedExchange', + 'InterlockedExchangeAdd', 'InterlockedIncrement', 'IsDelimiter', + 'IsEqualGUID', 'IsLeapYear', 'IsPathDelimiter', 'IsValidIdent', + 'Languages', 'LastDelimiter', 'LoadPackage', 'LoadStr', 'LowerCase', + 'MSecsToTimeStamp', 'NewStr', 'NextCharIndex', 'Now', 'OutOfMemoryError', + 'QuotedStr', 'RaiseLastOSError', 'RaiseLastWin32Error', 'RemoveDir', + 'RenameFile', 'ReplaceDate', 'ReplaceTime', 'SafeLoadLibrary', + 'SameFileName', 'SameText', 'SetCurrentDir', 'ShowException', 'Sleep', + 'StrAlloc', 'StrBufSize', 'StrByteType', 'StrCat', 'StrCharLength', + 'StrComp', 'StrCopy', 'StrDispose', 'StrECopy', 'StrEnd', 'StrFmt', + 'StrIComp', 'StrLCat', 'StrLComp', 'StrLCopy', 'StrLFmt', 'StrLIComp', + 'StrLen', 'StrLower', 'StrMove', 'StrNew', 'StrNextChar', 'StrPCopy', + 'StrPLCopy', 'StrPas', 'StrPos', 'StrRScan', 'StrScan', 'StrToBool', + 'StrToBoolDef', 'StrToCurr', 'StrToCurrDef', 'StrToDate', 'StrToDateDef', + 'StrToDateTime', 'StrToDateTimeDef', 'StrToFloat', 'StrToFloatDef', + 'StrToInt', 'StrToInt64', 'StrToInt64Def', 'StrToIntDef', 'StrToTime', + 'StrToTimeDef', 'StrUpper', 'StringReplace', 'StringToGUID', 'Supports', + 'SysErrorMessage', 'SystemTimeToDateTime', 'TextToFloat', 'Time', + 'TimeStampToDateTime', 'TimeStampToMSecs', 'TimeToStr', 'Trim', + 'TrimLeft', 'TrimRight', 'TryEncodeDate', 'TryEncodeTime', + 'TryFloatToCurr', 'TryFloatToDateTime', 'TryStrToBool', 'TryStrToCurr', + 'TryStrToDate', 'TryStrToDateTime', 'TryStrToFloat', 'TryStrToInt', + 'TryStrToInt64', 'TryStrToTime', 'UnloadPackage', 'UpperCase', + 'WideCompareStr', 'WideCompareText', 'WideFmtStr', 'WideFormat', + 'WideFormatBuf', 'WideLowerCase', 'WideSameStr', 'WideSameText', + 'WideUpperCase', 'Win32Check', 'WrapText', + + 'ActivateClassGroup', 'AllocateHwnd', 'BinToHex', 'CheckSynchronize', + 'CollectionsEqual', 'CountGenerations', 'DeallocateHwnd', 'EqualRect', + 'ExtractStrings', 'FindClass', 'FindGlobalComponent', 'GetClass', + 'GroupDescendantsWith', 'HexToBin', 'IdentToInt', + 'InitInheritedComponent', 'IntToIdent', 'InvalidPoint', + 'IsUniqueGlobalComponentName', 'LineStart', 'ObjectBinaryToText', + 'ObjectResourceToText', 'ObjectTextToBinary', 'ObjectTextToResource', + 'PointsEqual', 'ReadComponentRes', 'ReadComponentResEx', + 'ReadComponentResFile', 'Rect', 'RegisterClass', 'RegisterClassAlias', + 'RegisterClasses', 'RegisterComponents', 'RegisterIntegerConsts', + 'RegisterNoIcon', 'RegisterNonActiveX', 'SmallPoint', 'StartClassGroup', + 'TestStreamFormat', 'UnregisterClass', 'UnregisterClasses', + 'UnregisterIntegerConsts', 'UnregisterModuleClasses', + 'WriteComponentResFile', + + 'ArcCos', 'ArcCosh', 'ArcCot', 'ArcCotH', 'ArcCsc', 'ArcCscH', 'ArcSec', + 'ArcSecH', 'ArcSin', 'ArcSinh', 'ArcTan2', 'ArcTanh', 'Ceil', + 'CompareValue', 'Cosecant', 'Cosh', 'Cot', 'CotH', 'Cotan', 'Csc', 'CscH', + 'CycleToDeg', 'CycleToGrad', 'CycleToRad', 'DegToCycle', 'DegToGrad', + 'DegToRad', 'DivMod', 'DoubleDecliningBalance', 'EnsureRange', 'Floor', + 'Frexp', 'FutureValue', 'GetExceptionMask', 'GetPrecisionMode', + 'GetRoundMode', 'GradToCycle', 'GradToDeg', 'GradToRad', 'Hypot', + 'InRange', 'IntPower', 'InterestPayment', 'InterestRate', + 'InternalRateOfReturn', 'IsInfinite', 'IsNan', 'IsZero', 'Ldexp', 'LnXP1', + 'Log10', 'Log2', 'LogN', 'Max', 'MaxIntValue', 'MaxValue', 'Mean', + 'MeanAndStdDev', 'Min', 'MinIntValue', 'MinValue', 'MomentSkewKurtosis', + 'NetPresentValue', 'Norm', 'NumberOfPeriods', 'Payment', 'PeriodPayment', + 'Poly', 'PopnStdDev', 'PopnVariance', 'Power', 'PresentValue', + 'RadToCycle', 'RadToDeg', 'RadToGrad', 'RandG', 'RandomRange', 'RoundTo', + 'SLNDepreciation', 'SYDDepreciation', 'SameValue', 'Sec', 'SecH', + 'Secant', 'SetExceptionMask', 'SetPrecisionMode', 'SetRoundMode', 'Sign', + 'SimpleRoundTo', 'SinCos', 'Sinh', 'StdDev', 'Sum', 'SumInt', + 'SumOfSquares', 'SumsAndSquares', 'Tan', 'Tanh', 'TotalVariance', + 'Variance' + ), + 4 => array( + 'AnsiChar', 'AnsiString', 'Bool', 'Boolean', 'Byte', 'ByteBool', 'Cardinal', 'Char', + 'Comp', 'Currency', 'DWORD', 'Double', 'Extended', 'Int64', 'Integer', 'IUnknown', + 'LongBool', 'LongInt', 'LongWord', 'PAnsiChar', 'PAnsiString', 'PBool', 'PBoolean', 'PByte', + 'PByteArray', 'PCardinal', 'PChar', 'PComp', 'PCurrency', 'PDWORD', 'PDate', 'PDateTime', + 'PDouble', 'PExtended', 'PInt64', 'PInteger', 'PLongInt', 'PLongWord', 'Pointer', 'PPointer', + 'PShortInt', 'PShortString', 'PSingle', 'PSmallInt', 'PString', 'PHandle', 'PVariant', 'PWord', + 'PWordArray', 'PWordBool', 'PWideChar', 'PWideString', 'Real', 'Real48', 'ShortInt', 'ShortString', + 'Single', 'SmallInt', 'String', 'TClass', 'TDate', 'TDateTime', 'TextFile', 'THandle', + 'TObject', 'TTime', 'Variant', 'WideChar', 'WideString', 'Word', 'WordBool' + ), + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000000; font-weight: bold;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'REGEXPS' => array( + 0 => 'color: #9ac;', + 1 => 'color: #ff0000;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + 0 => '\$[0-9a-fA-F]+', + 1 => '\#\$?[0-9]{1,3}' + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/diff.php b/plugins/dokuwiki/inc/geshi/diff.php new file mode 100644 index 0000000..96085e9 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/diff.php @@ -0,0 +1,186 @@ + 'Diff', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array(), + 'ESCAPE_CHAR' => ' ', + 'KEYWORDS' => array( + 1 => array( + '\ No newline at end of file' + ), + 2 => array( + '***************' /* This only seems to works in some cases? */ + ), + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + 1 => false, + 2 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #aaaaaa; font-style: italic;', + 2 => 'color: #dd6611;', + ), + 'COMMENTS' => array( + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => '' + ), + 'STRINGS' => array( + 0 => '' + ), + 'NUMBERS' => array( + 0 => '' + ), + 'METHODS' => array( + 0 => '' + ), + 'SYMBOLS' => array( + 0 => '' + ), + 'SCRIPT' => array( + 0 => '' + ), + 'REGEXPS' => array( + 0 => 'color: #440088;', + 1 => 'color: #991111;', + 2 => 'color: #00b000;', + 3 => 'color: #888822;', + 4 => 'color: #888822;', + 5 => 'color: #0011dd;', + 6 => 'color: #440088;', + 7 => 'color: #991111;', + 8 => 'color: #00b000;', + 9 => 'color: #888822;', + ), + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTER' => '', + 'REGEXPS' => array( + 0 => "[0-9,]+[acd][0-9,]+", + 1 => array( + GESHI_SEARCH => '^\\<.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 2 => array( + GESHI_SEARCH => '^\\>.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 3 => array( + GESHI_SEARCH => '^[\\-]{3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 4 => array( + GESHI_SEARCH => '^(\\+){3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 5 => array( + GESHI_SEARCH => '^\\!.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 6 => array( + GESHI_SEARCH => '^[\\@]{2}.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 7 => array( + GESHI_SEARCH => '^\\-.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 8 => array( + GESHI_SEARCH => '^\\+.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 9 => array( + GESHI_SEARCH => '^(\\*){3}\\s.*$', + GESHI_REPLACE => '\\0', + GESHI_MODIFIERS => 'm', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/div.php b/plugins/dokuwiki/inc/geshi/div.php new file mode 100644 index 0000000..eb5a45e --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/div.php @@ -0,0 +1,128 @@ + 'DIV', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_UPPER, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'while','until','to','switch','step','return','repeat','loop','if','from','frame','for','end','elseif', + 'else','default','debug','continue','clone','case','break','begin' + ), + 2 => array( + 'xor','whoami','type','sizeof','pointer','or','offset','not','neg','mod','id','dup','and','_ne','_lt', + '_le','_gt','_ge','_eq' + ), + 3 => array( + 'setup_program','program','process','private','local','import','global','function','const', + 'compiler_options' + ), + 4 => array( + 'word','struct','string','int','byte' + ), + ), + 'SYMBOLS' => array( + '(',')','[',']','=','+','-','*','/','!','%','^','&',':',';',',','<','>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0040b1;', + 2 => 'color: #000000;', + 3 => 'color: #000066; font-weight: bold;', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => 'color: #44aa44;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #202020;', + ), + 'SYMBOLS' => array( + 0 => 'color: #44aa44;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTER' => '', + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/dos.php b/plugins/dokuwiki/inc/geshi/dos.php new file mode 100644 index 0000000..e939baf --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/dos.php @@ -0,0 +1,185 @@ + 'DOS', + 'COMMENT_SINGLE' => array(1 =>'REM', 2 => '@REM'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array(), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + /* Flow control keywords */ + 1 => array( + 'if', 'else', 'goto', + 'for', 'in', 'do', + 'call', 'exit' + ), + /* IF statement keywords */ + 2 => array( + 'not', 'exist', 'errorlevel', + 'defined', + 'equ', 'neq', 'lss', 'leq', 'gtr', 'geq' + ), + /* Internal commands */ + 3 => array( + 'shift', + 'cd', 'dir', 'echo', + 'setlocal', 'endlocal', 'set', + 'pause' + ), + /* Special files */ + + 4 => array( + 'prn', 'nul', 'lpt3', 'lpt2', 'lpt1', 'con', + 'com4', 'com3', 'com2', 'com1', 'aux' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #00b100; font-weight: bold;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #b1b100; font-weight: bold;', + 4 => 'color: #0000ff; font-weight: bold;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( +/* 0 => 'color: #cc66cc;' */ + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #33cc33;', + 1 => 'color: #33cc33;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + 0 => 'color: #b100b1; font-weight: bold;', + 1 => 'color: #448844;', + 2 => 'color: #448888;' + ) + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'URLS' => array( + 1 => 'http://www.ss64.com/nt/{FNAME}.html', + 2 => 'http://www.ss64.com/nt/{FNAME}.html', + 3 => 'http://www.ss64.com/nt/{FNAME}.html', + 4 => 'http://www.ss64.com/nt/{FNAME}.html' + ), + 'REGEXPS' => array( + /* Label */ + 0 => array( +/* GESHI_SEARCH => '((?si:[@\s]+GOTO\s+|\s+:)[\s]*)((? '((?si:[@\s]+GOTO\s+|\s+:)[\s]*)((? '\\2', + GESHI_MODIFIERS => 'si', + GESHI_BEFORE => '\\1', + GESHI_AFTER => '' + ), + /* Variable assignement */ + 1 => array( +/* GESHI_SEARCH => '(SET[\s]+(?si:/A[\s]+|/P[\s]+|))([^=\s\n]+)([\s]*=)',*/ + GESHI_SEARCH => '(SET[\s]+(?si:/A[\s]+|/P[\s]+|))([^=\n]+)([\s]*=)', + GESHI_REPLACE => '\\2', + GESHI_MODIFIERS => 'si', + GESHI_BEFORE => '\\1', + GESHI_AFTER => '\\3' + ), + /* Arguments or variable evaluation */ + 2 => array( +/* GESHI_SEARCH => '(%)([\d*]|[^%\s]*(?=%))((? '(%)([\d*]|[^%]*(?=%))((? '\\2', + GESHI_MODIFIERS => 'si', + GESHI_BEFORE => '\\1', + GESHI_AFTER => '\\3' + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/eiffel.php b/plugins/dokuwiki/inc/geshi/eiffel.php new file mode 100644 index 0000000..635e0ab --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/eiffel.php @@ -0,0 +1,397 @@ + 'Eiffel', + 'COMMENT_SINGLE' => array(1 => '--'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '%', + 'KEYWORDS' => array( + 1 => array( + 'separate', + 'invariant', + 'inherit', + 'indexing', + 'feature', + 'expanded', + 'deferred', + 'class' + ), + 2 => array( + 'xor', + 'when', + 'variant', + 'until', + 'unique', + 'undefine', + 'then', + 'strip', + 'select', + 'retry', + 'rescue', + 'require', + 'rename', + 'reference', + 'redefine', + 'prefix', + 'or', + 'once', + 'old', + 'obsolete', + 'not', + 'loop', + 'local', + 'like', + 'is', + 'inspect', + 'infix', + 'include', + 'implies', + 'if', + 'frozen', + 'from', + 'external', + 'export', + 'ensure', + 'end', + 'elseif', + 'else', + 'do', + 'creation', + 'create', + 'check', + 'as', + 'and', + 'alias', + 'agent' + ), + 3 => array( + 'Void', + 'True', + 'Result', + 'Precursor', + 'False', + 'Current' + ), + 4 => array( + 'UNIX_SIGNALS', + 'UNIX_FILE_INFO', + 'UNBOUNDED', + 'TWO_WAY_TREE_CURSOR', + 'TWO_WAY_TREE', + 'TWO_WAY_SORTED_SET', + 'TWO_WAY_LIST', + 'TWO_WAY_CURSOR_TREE', + 'TWO_WAY_CIRCULAR', + 'TWO_WAY_CHAIN_ITERATOR', + 'TUPLE', + 'TREE', + 'TRAVERSABLE', + 'TO_SPECIAL', + 'THREAD_CONTROL', + 'THREAD_ATTRIBUTES', + 'THREAD', + 'TABLE', + 'SUBSET', + 'STRING_HANDLER', + 'STRING', + 'STREAM', + 'STORABLE', + 'STD_FILES', + 'STACK', + 'SPECIAL', + 'SORTED_TWO_WAY_LIST', + 'SORTED_STRUCT', + 'SORTED_LIST', + 'SINGLE_MATH', + 'SET', + 'SEQUENCE', + 'SEQ_STRING', + 'SEMAPHORE', + 'ROUTINE', + 'RESIZABLE', + 'RECURSIVE_TREE_CURSOR', + 'RECURSIVE_CURSOR_TREE', + 'REAL_REF', + 'REAL', + 'RAW_FILE', + 'RANDOM', + 'QUEUE', + 'PROXY', + 'PROFILING_SETTING', + 'PROCEDURE', + 'PRIORITY_QUEUE', + 'PRIMES', + 'PRECOMP', + 'POINTER_REF', + 'POINTER', + 'PLATFORM', + 'PLAIN_TEXT_FILE', + 'PATH_NAME', + 'PART_SORTED_TWO_WAY_LIST', + 'PART_SORTED_SET', + 'PART_SORTED_LIST', + 'PART_COMPARABLE', + 'OPERATING_ENVIRONMENT', + 'ONCE_CONTROL', + 'OBJECT_OWNER', + 'OBJECT_CONTROL', + 'NUMERIC', + 'NONE', + 'MUTEX', + 'MULTI_ARRAY_LIST', + 'MULTAR_LIST_CURSOR', + 'MEMORY', + 'MEM_INFO', + 'MEM_CONST', + 'MATH_CONST', + 'LIST', + 'LINKED_TREE_CURSOR', + 'LINKED_TREE', + 'LINKED_STACK', + 'LINKED_SET', + 'LINKED_QUEUE', + 'LINKED_PRIORITY_QUEUE', + 'LINKED_LIST_CURSOR', + 'LINKED_LIST', + 'LINKED_CURSOR_TREE', + 'LINKED_CIRCULAR', + 'LINKABLE', + 'LINEAR_ITERATOR', + 'LINEAR', + 'ITERATOR', + 'IO_MEDIUM', + 'INTERNAL', + 'INTEGER_REF', + 'INTEGER_INTERVAL', + 'INTEGER', + 'INFINITE', + 'INDEXABLE', + 'IDENTIFIED_CONTROLLER', + 'IDENTIFIED', + 'HIERARCHICAL', + 'HEAP_PRIORITY_QUEUE', + 'HASHABLE', + 'HASH_TABLE_CURSOR', + 'HASH_TABLE', + 'GENERAL', + 'GC_INFO', + 'FUNCTION', + 'FORMAT_INTEGER', + 'FORMAT_DOUBLE', + 'FIXED_TREE', + 'FIXED_LIST', + 'FIXED', + 'FINITE', + 'FILE_NAME', + 'FILE', + 'FIBONACCI', + 'EXECUTION_ENVIRONMENT', + 'EXCEPTIONS', + 'EXCEP_CONST', + 'DYNAMIC_TREE', + 'DYNAMIC_LIST', + 'DYNAMIC_CIRCULAR', + 'DYNAMIC_CHAIN', + 'DOUBLE_REF', + 'DOUBLE_MATH', + 'DOUBLE', + 'DISPENSER', + 'DIRECTORY_NAME', + 'DIRECTORY', + 'DECLARATOR', + 'DEBUG_OUTPUT', + 'CURSOR_TREE_ITERATOR', + 'CURSOR_TREE', + 'CURSOR_STRUCTURE', + 'CURSOR', + 'COUNTABLE_SEQUENCE', + 'COUNTABLE', + 'CONTAINER', + 'CONSOLE', + 'CONDITION_VARIABLE', + 'COMPARABLE_STRUCT', + 'COMPARABLE_SET', + 'COMPARABLE', + 'COMPACT_TREE_CURSOR', + 'COMPACT_CURSOR_TREE', + 'COLLECTION', + 'CIRCULAR_CURSOR', + 'CIRCULAR', + 'CHARACTER_REF', + 'CHARACTER', + 'CHAIN', + 'CELL', + 'BOX', + 'BOUNDED_STACK', + 'BOUNDED_QUEUE', + 'BOUNDED', + 'BOOLEAN_REF', + 'BOOLEAN', + 'BOOL_STRING', + 'BIT_REF', + 'BINARY_TREE', + 'BINARY_SEARCH_TREE_SET', + 'BINARY_SEARCH_TREE', + 'BILINEAR', + 'BI_LINKABLE', + 'BASIC_ROUTINES', + 'BAG', + 'ASCII', + 'ARRAYED_TREE', + 'ARRAYED_STACK', + 'ARRAYED_QUEUE', + 'ARRAYED_LIST_CURSOR', + 'ARRAYED_LIST', + 'ARRAYED_CIRCULAR', + 'ARRAY2', + 'ARRAY', + 'ARGUMENTS', + 'ANY', + 'ACTIVE' + ), + 5 => array( + 'yes', + 'visible', + 'trace', + 'system', + 'root', + 'profile', + 'override_cluster', + 'object', + 'no', + 'multithreaded', + 'msil_generation_type', + 'line_generation', + 'library', + 'inlining_size', + 'inlining', + 'include_path', + 'il_verifiable', + 'exclude', + 'exception_trace', + 'dynamic_runtime', + 'dotnet_naming_convention', + 'disabled_debug', + 'default', + 'debug', + 'dead_code_removal', + 'console_application', + 'cluster', + 'cls_compliant', + 'check_vape', + 'assertion', + 'array_optimization', + 'all', + 'address_expression' + ), + ), + 'SYMBOLS' => array( + '+', '-', '*', '?', '=', '/', '%', '&', '>', '<', '^', '!', '|', ':', + '(', ')', '{', '}', '[', ']', '#' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => true, + 5 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0600FF; background-color: #FFF0E0; font-weight: bold;', + 2 => 'color: #0600FF; font-weight: bold;', + 3 => 'color: #800080;', + 4 => 'color: #800000', + 5 => 'color: #603000;' + ), + 'COMMENTS' => array( + 1 => 'color: #008000; font-style: italic;', + 'MULTI' => '' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #005070; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #FF0000;' + ), + 'STRINGS' => array( + 0 => 'color: #0080A0;' + ), + 'NUMBERS' => array( + 0 => 'color: #FF0000;' + ), + 'METHODS' => array( + 1 => 'color: #000060;', + 2 => 'color: #000050;' + ), + 'SYMBOLS' => array( + 0 => 'color: #600000;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => 'http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+{FNAME}&btnI=I%27m+Feeling+Lucky' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> + diff --git a/plugins/dokuwiki/inc/geshi/freebasic.php b/plugins/dokuwiki/inc/geshi/freebasic.php new file mode 100644 index 0000000..cfd2f8a --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/freebasic.php @@ -0,0 +1,137 @@ + 'FreeBasic', + 'COMMENT_SINGLE' => array(1 => "'", 2 => '#'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + "append", "as", "asc", "asin", "asm", "atan2", "atn", "beep", "bin", "binary", "bit", + "bitreset", "bitset", "bload", "bsave", "byref", "byte", "byval", "call", + "callocate", "case", "cbyte", "cdbl", "cdecl", "chain", "chdir", "chr", "cint", + "circle", "clear", "clng", "clngint", "close", "cls", "color", "command", + "common", "cons", "const", "continue", "cos", "cshort", "csign", "csng", + "csrlin", "cubyte", "cuint", "culngint", "cunsg", "curdir", "cushort", "custom", + "cvd", "cvi", "cvl", "cvlongint", "cvs", "cvshort", "data", "date", + "deallocate", "declare", "defbyte", "defdbl", "defined", "defint", "deflng", + "deflngint", "defshort", "defsng", "defstr", "defubyte", "defuint", + "defulngint", "defushort", "dim", "dir", "do", "double", "draw", "dylibload", + "dylibsymbol", "else", "elseif", "end", "enum", "environ", 'environ$', "eof", + "eqv", "erase", "err", "error", "exec", "exepath", "exit", "exp", "export", + "extern", "field", "fix", "flip", "for", "fre", "freefile", "function", "get", + "getjoystick", "getkey", "getmouse", "gosub", "goto", "hex", "hibyte", "hiword", + "if", "iif", "imagecreate", "imagedestroy", "imp", "inkey", "inp", "input", + "instr", "int", "integer", "is", "kill", "lbound", "lcase", "left", "len", + "let", "lib", "line", "lobyte", "loc", "local", "locate", "lock", "lof", "log", + "long", "longint", "loop", "loword", "lset", "ltrim", "mid", "mkd", "mkdir", + "mki", "mkl", "mklongint", "mks", "mkshort", "mod", "multikey", "mutexcreate", + "mutexdestroy", "mutexlock", "mutexunlock", "name", "next", "not", "oct", "on", + "once", "open", "option", "or", "out", "output", "overload", "paint", "palette", + "pascal", "pcopy", "peek", "peeki", "peeks", "pipe", "pmap", "point", "pointer", + "poke", "pokei", "pokes", "pos", "preserve", "preset", "print", "private", + "procptr", "pset", "ptr", "public", "put", "random", "randomize", "read", + "reallocate", "redim", "rem", "reset", "restore", "resume", "resume", "next", + "return", "rgb", "rgba", "right", "rmdir", "rnd", "rset", "rtrim", "run", + "sadd", "screen", "screencopy", "screeninfo", "screenlock", "screenptr", + "screenres", "screenset", "screensync", "screenunlock", "seek", "statement", + "seek", "function", "selectcase", "setdate", "setenviron", "setmouse", + "settime", "sgn", "shared", "shell", "shl", "short", "shr", "sin", "single", + "sizeof", "sleep", "space", "spc", "sqr", "static", "stdcall", "step", "stop", + "str", "string", "string", "strptr", "sub", "swap", "system", "tab", "tan", + "then", "threadcreate", "threadwait", "time", "time", "timer", "to", "trans", + "trim", "type", "ubound", "ubyte", "ucase", "uinteger", "ulongint", "union", + "unlock", "unsigned", "until", "ushort", "using", "va_arg", "va_first", + "va_next", "val", "val64", "valint", "varptr", "view", "viewprint", "wait", + "wend", "while", "width", "window", "windowtitle", "with", "write", "xor", + "zstring", "explicit", "escape", "true", "false" + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080;', + 2 => 'color: #339933;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #66cc66;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/gml.php b/plugins/dokuwiki/inc/geshi/gml.php new file mode 100644 index 0000000..6482cda --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/gml.php @@ -0,0 +1,504 @@ +5 and KEYWORDS=>6 sections (actually, they were empty). + * I was planning of using those for the GML functions available only in the + * registered version of the program, but not anymore. + * + * 2005/06/26 (1.0.3) + * - First Release. + * + * TODO (updated 2005/11/11) + * ------------------------- + * - Test it for a while and make the appropiate corrections. + * + ************************************************************************************* + * + * This file is part of GeSHi. + * + * GeSHi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GeSHi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GeSHi; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ************************************************************************************/ + +$language_data = array ( + 'LANG_NAME' => 'GML', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'"), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + // language keywords + 1 => array( + 'break', 'continue', 'do', 'until', 'if', 'else', + 'exit', 'for', 'for', 'repeat', 'return', 'switch', + 'case', 'default', 'var', 'while', 'with', 'div', 'mod', + // GML Language overview + 'self', 'other', 'all', 'noone', 'global', + ), + // modifiers and built-in variables + 2 => array( + // Game play + 'x','y','xprevious','yprevious','xstart','ystart','hspeed','vspeed','direction','speed', + 'friction','gravity','gravity_direction', + 'path_index','path_position','path_positionprevious','path_speed','path_orientation', + 'path_scale','path_endaction', + 'object_index','id','mask_index','solid','persistent','instance_count','instance_id', + 'room_speed','fps','current_time','current_year','current_month','current_day','current_weekday', + 'current_hour','current_minute','current_second','alarm','timeline_index','timeline_position', + 'timeline_speed', + 'room','room_first','room_last','room_width','room_height','room_caption','room_persistent', + 'score','lives','health','show_score','show_lives','show_health','caption_score','caption_lives', + 'caption_health', + 'event_type','event_number','event_object','event_action', + 'error_occurred','error_last', + // User interaction + 'keyboard_lastkey','keyboard_key','keyboard_lastchar','keyboard_string', + 'mouse_x','mouse_y','mouse_button','mouse_lastbutton', + // Game Graphics + 'visible','sprite_index','sprite_width','sprite_height','sprite_xoffset','sprite_yoffset', + 'image_number','image_index','image_speed','depth','image_xscale','image_yscale','image_angle', + 'image_alpha','image_blend','bbox_left','bbox_right','bbox_top','bbox_bottom', + 'background_color','background_showcolor','background_visible','background_foreground', + 'background_index','background_x','background_y','background_width','background_height', + 'background_htiled','background_vtiled','background_xscale','background_yscale', + 'background_hspeed','background_vspeed','background_blend','background_alpha', + 'background','left, top, width, height','x,y','depth','visible','xscale, yscale','blend','alpha', + 'view_enabled','view_current','view_visible','view_yview','view_wview','view_hview','view_xport', + 'view_yport','view_wport','view_hport','view_angle','view_hborder','view_vborder','view_hspeed', + 'view_vspeed','view_object', + 'transition_kind', + // Files, registry and executing programs + 'game_id','working_directory','temp_directory', + 'secure_mode', + // Creating particles + 'xmin', 'xmax', 'ymin', 'ymax','shape','distribution','particle type','number', + 'x', 'y', 'force','dist','kind','additive', 'friction', 'parttype1', 'parttype2' + ), + // functions + 3 => array( + // Computing things + 'random','choose','abs','sign','round','floor','ceil','frac','sqrt','sqr','power','exp','ln', + 'log2','log10','logn','sin','cos','tan','arcsin','arccos','arctan','arctan2','degtorad', + 'radtodeg','min','max','mean','median','point_distance','point_direction','lengthdir_x', + 'lengthdir_y','is_real','is_string', + 'chr','ord','real','string','string_format','string_length','string_pos','string_copy', + 'string_char_at','string_delete','string_insert','string_replace','string_replace_all', + 'string_count','string_lower','string_upper','string_repeat','string_letters','string_digits', + 'string_lettersdigits','clipboard_has_text','clipboard_get_text','clipboard_set_text', + 'date_current_datetime','date_current_date','date_current_time','date_create_datetime', + 'date_create_date','date_create_time','date_valid_datetime','date_valid_date','date_valid_time', + 'date_inc_year','date_inc_month','date_inc_week','date_inc_day','date_inc_hour', + 'date_inc_minute','date_inc_second','date_get_year','date_get_month','date_get_week', + 'date_get_day','date_get_hour', 'date_get_minute','date_get_second','date_get_weekday', + 'date_get_day_of_year','date_get_hour_of_year','date_get_minute_of_year', + 'date_get_second_of_year','date_year_span','date_month_span','date_week_span','date_day_span', + 'date_hour_span','date_minute_span','date_second_span','date_compare_datetime', + 'date_compare_date','date_compare_time','date_date_of','date_time_of','date_datetime_string', + 'date_date_string','date_time_string','date_days_in_month','date_days_in_year','date_leap_year', + 'date_is_today', + // Game play + 'motion_set','motion_add','place_free','place_empty','place_meeting','place_snapped', + 'move_random','move_snap','move_wrap','move_towards_point','move_bounce_solid','move_bounce_all', + 'move_contact_solid','move_contact_all','move_outside_solid','move_outside_all', + 'distance_to_point','distance_to_object','position_empty','position_meeting', + 'path_start','path_end', + 'mp_linear_step','mp_linear_step_object','mp_potential_step','mp_potential_step_object', + 'mp_potential_settings','mp_linear_path','mp_linear_path_object', 'mp_potential_path', + 'mp_potential_path_object','mp_grid_create','mp_grid_destroy','mp_grid_clear_all', + 'mp_grid_clear_cell','mp_grid_clear_rectangle','mp_grid_add_cell','mp_grid_add_rectangle', + 'mp_grid_add_instances','mp_grid_path','mp_grid_draw', + 'collision_point','collision_rectangle','collision_circle','collision_ellipse','collision_line', + 'instance_find','instance_exists','instance_number','instance_position','instance_nearest', + 'instance_furthest','instance_place','instance_create','instance_copy','instance_destroy', + 'instance_change','position_destroy','position_change', + 'instance_deactivate_all','instance_deactivate_object','instance_deactivate_region', + 'instance_activate_all','instance_activate_object','instance_activate_region', + 'sleep', + 'room_goto','room_goto_previous','room_goto_next','room_restart','room_previous','room_next', + 'game_end','game_restart','game_save','game_load', + 'event_perform', 'event_perform_object','event_user','event_inherited', + 'show_debug_message','variable_global_exists','variable_local_exists','variable_global_get', + 'variable_global_array_get','variable_global_array2_get','variable_local_get', + 'variable_local_array_get','variable_local_array2_get','variable_global_set', + 'variable_global_array_set','variable_global_array2_set','variable_local_set', + 'variable_local_array_set','variable_local_array2_set','set_program_priority', + // User interaction + 'keyboard_set_map','keyboard_get_map','keyboard_unset_map','keyboard_check', + 'keyboard_check_pressed','keyboard_check_released','keyboard_check_direct', + 'keyboard_get_numlock','keyboard_set_numlock','keyboard_key_press','keyboard_key_release', + 'keyboard_clear','io_clear','io_handle','keyboard_wait', + 'mouse_check_button','mouse_check_button_pressed','mouse_check_button_released','mouse_clear', + 'io_clear','io_handle','mouse_wait', + 'joystick_exists','joystick_name','joystick_axes','joystick_buttons','joystick_has_pov', + 'joystick_direction','joystick_check_button','joystick_xpos','joystick_ypos','joystick_zpos', + 'joystick_rpos','joystick_upos','joystick_vpos','joystick_pov', + // Game Graphics + 'draw_sprite','draw_sprite_stretched','draw_sprite_tiled','draw_sprite_part','draw_background', + 'draw_background_stretched','draw_background_tiled','draw_background_part','draw_sprite_ext', + 'draw_sprite_stretched_ext','draw_sprite_tiled_ext','draw_sprite_part_ext','draw_sprite_general', + 'draw_background_ext','draw_background_stretched_ext','draw_background_tiled_ext', + 'draw_background_part_ext','draw_background_general', + 'draw_clear','draw_clear_alpha','draw_point','draw_line','draw_rectangle','draw_roundrect', + 'draw_triangle','draw_circle','draw_ellipse','draw_arrow','draw_button','draw_path', + 'draw_healthbar','draw_set_color','draw_set_alpha','draw_get_color','draw_get_alpha', + 'make_color_rgb','make_color_hsv','color_get_red','color_get_green','color_get_blue', + 'color_get_hue','color_get_saturation','color_get_value','merge_color','draw_getpixel', + 'screen_save','screen_save_part', + 'draw_set_font','draw_set_halign','draw_set_valign','draw_text','draw_text_ext','string_width', + 'string_height','string_width_ext','string_height_ext','draw_text_transformed', + 'draw_text_ext_transformed','draw_text_color','draw_text_ext_color', + 'draw_text_transformed_color','draw_text_ext_transformed_color', + 'draw_point_color','draw_line_color','draw_rectangle_color','draw_roundrect_color', + 'draw_triangle_color','draw_circle_color','draw_ellipse_color','draw_primitive_begin', + 'draw_vertex','draw_vertex_color','draw_primitive_end','sprite_get_texture', + 'background_get_texture','texture_preload','texture_set_priority', + 'texture_get_width','texture_get_height','draw_primitive_begin_texture','draw_vertex_texture', + 'draw_vertex_texture_color','draw_primitive_end','texture_set_interpolation', + 'texture_set_blending','texture_set_repeat','draw_set_blend_mode','draw_set_blend_mode_ext', + 'surface_create','surface_free','surface_exists','surface_get_width','surface_get_height', + 'surface_get_texture','surface_set_target','surface_reset_target','surface_getpixel', + 'surface_save','surface_save_part','draw_surface','draw_surface_stretched','draw_surface_tiled', + 'draw_surface_part','draw_surface_ext','draw_surface_stretched_ext','draw_surface_tiled_ext', + 'draw_surface_part_ext','draw_surface_general','surface_copy','surface_copy_part', + 'tile_add','tile_delete','tile_exists','tile_get_x','tile_get_y','tile_get_left','tile_get_top', + 'tile_get_width','tile_get_height','tile_get_depth','tile_get_visible','tile_get_xscale', + 'tile_get_yscale','tile_get_background','tile_get_blend','tile_get_alpha','tile_set_position', + 'tile_set_region','tile_set_background','tile_set_visible','tile_set_depth','tile_set_scale', + 'tile_set_blend','tile_set_alpha','tile_layer_hide','tile_layer_show','tile_layer_delete', + 'tile_layer_shift','tile_layer_find','tile_layer_delete_at','tile_layer_depth', + 'display_get_width','display_get_height','display_get_colordepth','display_get_frequency', + 'display_set_size','display_set_colordepth','display_set_frequency','display_set_all', + 'display_test_all','display_reset','display_mouse_get_x','display_mouse_get_y','display_mouse_set', + 'window_set_visible','window_get_visible','window_set_fullscreen','window_get_fullscreen', + 'window_set_showborder','window_get_showborder','window_set_showicons','window_get_showicons', + 'window_set_stayontop','window_get_stayontop','window_set_sizeable','window_get_sizeable', + 'window_set_caption','window_get_caption','window_set_cursor', 'window_get_cursor', + 'window_set_color','window_get_color','window_set_region_scale','window_get_region_scale', + 'window_set_position','window_set_size','window_set_rectangle','window_center','window_default', + 'window_get_x','window_get_y','window_get_width','window_get_height','window_mouse_get_x', + 'window_mouse_get_y','window_mouse_set', + 'window_set_region_size','window_get_region_width','window_get_region_height', + 'window_view_mouse_get_x','window_view_mouse_get_y','window_view_mouse_set', + 'window_views_mouse_get_x','window_views_mouse_get_y','window_views_mouse_set', + 'screen_redraw','screen_refresh','set_automatic_draw','set_synchronization','screen_wait_vsync', + // Sound and music) + 'sound_play','sound_loop','sound_stop','sound_stop_all','sound_isplaying','sound_volume', + 'sound_global_volume','sound_fade','sound_pan','sound_background_tempo','sound_set_search_directory', + 'sound_effect_set','sound_effect_chorus','sound_effect_echo', 'sound_effect_flanger', + 'sound_effect_gargle','sound_effect_reverb','sound_effect_compressor','sound_effect_equalizer', + 'sound_3d_set_sound_position','sound_3d_set_sound_velocity','sound_3d_set_sound_distance', + 'sound_3d_set_sound_cone', + 'cd_init','cd_present','cd_number','cd_playing','cd_paused','cd_track','cd_length', + 'cd_track_length','cd_position','cd_track_position','cd_play','cd_stop','cd_pause','cd_resume', + 'cd_set_position','cd_set_track_position','cd_open_door','cd_close_door','MCI_command', + // Splash screens, highscores, and other pop-ups + 'show_text','show_image','show_video','show_info','load_info', + 'show_message','show_message_ext','show_question','get_integer','get_string', + 'message_background','message_alpha','message_button','message_text_font','message_button_font', + 'message_input_font','message_mouse_color','message_input_color','message_caption', + 'message_position','message_size','show_menu','show_menu_pos','get_color','get_open_filename', + 'get_save_filename','get_directory','get_directory_alt','show_error', + 'highscore_show','highscore_set_background','highscore_set_border','highscore_set_font', + 'highscore_set_colors','highscore_set_strings','highscore_show_ext','highscore_clear', + 'highscore_add','highscore_add_current','highscore_value','highscore_name','draw_highscore', + // Resources + 'sprite_exists','sprite_get_name','sprite_get_number','sprite_get_width','sprite_get_height', + 'sprite_get_transparent','sprite_get_smooth','sprite_get_preload','sprite_get_xoffset', + 'sprite_get_yoffset','sprite_get_bbox_left','sprite_get_bbox_right','sprite_get_bbox_top', + 'sprite_get_bbox_bottom','sprite_get_bbox_mode','sprite_get_precise', + 'sound_exists','sound_get_name','sound_get_kind','sound_get_preload','sound_discard', + 'sound_restore', + 'background_exists','background_get_name','background_get_width','background_get_height', + 'background_get_transparent','background_get_smooth','background_get_preload', + 'font_exists','font_get_name','font_get_fontname','font_get_bold','font_get_italic', + 'font_get_first','font_get_last', + 'path_exists','path_get_name','path_get_length','path_get_kind','path_get_closed', + 'path_get_precision','path_get_number','path_get_point_x','path_get_point_y', + 'path_get_point_speed','path_get_x','path_get_y','path_get_speed', + 'script_exists','script_get_name','script_get_text', + 'timeline_exists','timeline_get_name', + 'object_exists','object_get_name','object_get_sprite','object_get_solid','object_get_visible', + 'object_get_depth','object_get_persistent','object_get_mask','object_get_parent', + 'object_is_ancestor', + 'room_exists','room_get_name', + // Changing resources + 'sprite_set_offset','sprite_set_bbox_mode','sprite_set_bbox','sprite_set_precise', + 'sprite_duplicate','sprite_assign','sprite_merge','sprite_add','sprite_replace', + 'sprite_create_from_screen','sprite_add_from_screen','sprite_create_from_surface', + 'sprite_add_from_surface','sprite_delete','sprite_set_alpha_from_sprite', + 'sound_add','sound_replace','sound_delete', + 'background_duplicate','background_assign','background_add','background_replace', + 'background_create_color','background_create_gradient','background_create_from_screen', + 'background_create_from_surface','background_delete','background_set_alpha_from_background', + 'font_add','font_add_sprite','font_replace_sprite','font_delete', + 'path_set_kind','path_set_closed','path_set_precision','path_add','path_delete','path_duplicate', + 'path_assign','path_append','path_add_point','path_insert_point','path_change_point', + 'path_delete_point','path_clear_points','path_reverse','path_mirror','path_flip','path_rotate', + 'path_scale','path_shift', + 'execute_string','execute_file','script_execute', + 'timeline_add','timeline_delete','timeline_moment_add','timeline_moment_clear', + 'object_set_sprite','object_set_solid','object_set_visible','object_set_depth', + 'object_set_persistent','object_set_mask','object_set_parent','object_add','object_delete', + 'object_event_add','object_event_clear', + 'room_set_width','room_set_height','room_set_caption','room_set_persistent','room_set_code', + 'room_set_background_color','room_set_background','room_set_view','room_set_view_enabled', + 'room_add','room_duplicate','room_assign','room_instance_add','room_instance_clear', + 'room_tile_add','room_tile_add_ext','room_tile_clear', + // Files, registry and executing programs + 'file_text_open_read','file_text_open_write','file_text_open_append','file_text_close', + 'file_text_write_string','file_text_write_real','file_text_writeln','file_text_read_string', + 'file_text_read_real','file_text_readln','file_text_eof','file_exists','file_delete', + 'file_rename','file_copy','directory_exists','directory_create','file_find_first', + 'file_find_next','file_find_close','file_attributes', 'filename_name','filename_path', + 'filename_dir','filename_drive','filename_ext','filename_change_ext','file_bin_open', + 'file_bin_rewrite','file_bin_close','file_bin_size','file_bin_position','file_bin_seek', + 'file_bin_write_byte','file_bin_read_byte','parameter_count','parameter_string', + 'environment_get_variable', + 'registry_write_string','registry_write_real','registry_read_string','registry_read_real', + 'registry_exists','registry_write_string_ext','registry_write_real_ext', + 'registry_read_string_ext','registry_read_real_ext','registry_exists_ext','registry_set_root', + 'ini_open','ini_close','ini_read_string','ini_read_real','ini_write_string','ini_write_real', + 'ini_key_exists','ini_section_exists','ini_key_delete','ini_section_delete', + 'execute_program','execute_shell', + // Data structures + 'ds_stack_create','ds_stack_destroy','ds_stack_clear','ds_stack_size','ds_stack_empty', + 'ds_stack_push','ds_stack_pop','ds_stack_top', + 'ds_queue_create','ds_queue_destroy','ds_queue_clear','ds_queue_size','ds_queue_empty', + 'ds_queue_enqueue','ds_queue_dequeue','ds_queue_head','ds_queue_tail', + 'ds_list_create','ds_list_destroy','ds_list_clear','ds_list_size','ds_list_empty','ds_list_add', + 'ds_list_insert','ds_list_replace','ds_list_delete','ds_list_find_index','ds_list_find_value', + 'ds_list_sort', + 'ds_map_create','ds_map_destroy','ds_map_clear','ds_map_size','ds_map_empty','ds_map_add', + 'ds_map_replace','ds_map_delete','ds_map_exists','ds_map_find_value','ds_map_find_previous', + 'ds_map_find_next','ds_map_find_first','ds_map_find_last', + 'ds_priority_create','ds_priority_destroy','ds_priority_clear','ds_priority_size', + 'ds_priority_empty','ds_priority_add','ds_priority_change_priority','ds_priority_find_priority', + 'ds_priority_delete_value','ds_priority_delete_min','ds_priority_find_min', + 'ds_priority_delete_max','ds_priority_find_max', + 'ds_grid_create','ds_grid_destroy','ds_grid_resize','ds_grid_width','ds_grid_height', + 'ds_grid_clear','ds_grid_set','ds_grid_add','ds_grid_multiply','ds_grid_set_region', + 'ds_grid_add_region','ds_grid_multiply_region','ds_grid_set_disk','ds_grid_add_disk', + 'ds_grid_multiply_disk','ds_grid_get','ds_grid_get_sum','ds_grid_get_max','ds_grid_get_min', + 'ds_grid_get_mean','ds_grid_get_disk_sum','ds_grid_get_disk_min','ds_grid_get_disk_max', + 'ds_grid_get_disk_mean','ds_grid_value_exists','ds_grid_value_x','ds_grid_value_y', + 'ds_grid_value_disk_exists','ds_grid_value_disk_x','ds_grid_value_disk_y', + // Creating particles + 'effect_create_below','effect_create_above','effect_clear', + 'part_type_create','part_type_destroy','part_type_exists','part_type_clear','part_type_shape', + 'part_type_sprite','part_type_size','part_type_scale', + 'part_type_orientation','part_type_color1','part_type_color2','part_type_color3', + 'part_type_color_mix','part_type_color_rgb','part_type_color_hsv', + 'part_type_alpha1','part_type_alpha2','part_type_alpha3','part_type_blend','part_type_life', + 'part_type_step','part_type_death','part_type_speed','part_type_direction','part_type_gravity', + 'part_system_create','part_system_destroy','part_system_exists','part_system_clear', + 'part_system_draw_order','part_system_depth','part_system_position', + 'part_system_automatic_update','part_system_automatic_draw','part_system_update', + 'part_system_drawit','part_particles_create','part_particles_create_color', + 'part_particles_clear','part_particles_count', + 'part_emitter_create','part_emitter_destroy','part_emitter_destroy_all','part_emitter_exists', + 'part_emitter_clear','part_emitter_region','part_emitter_burst','part_emitter_stream', + 'part_attractor_create','part_attractor_destroy','part_attractor_destroy_all', + 'part_attractor_exists','part_attractor_clear','part_attractor_position','part_attractor_force', + 'part_destroyer_create','part_destroyer_destroy','part_destroyer_destroy_all', + 'part_destroyer_exists','part_destroyer_clear','part_destroyer_region', + 'part_deflector_create','part_deflector_destroy','part_deflector_destroy_all', + 'part_deflector_exists','part_deflector_clear','part_deflector_region','part_deflector_kind', + 'part_deflector_friction', + 'part_changer_create','part_changer_destroy','part_changer_destroy_all','part_changer_exists', + 'part_changer_clear','part_changer_region','part_changer_types','part_changer_kind', + // Multiplayer games + 'mplay_init_ipx','mplay_init_tcpip','mplay_init_modem','mplay_init_serial', + 'mplay_connect_status','mplay_end','mplay_ipaddress', + 'mplay_session_create','mplay_session_find','mplay_session_name','mplay_session_join', + 'mplay_session_mode','mplay_session_status','mplay_session_end', + 'mplay_player_find','mplay_player_name','mplay_player_id', + 'mplay_data_write','mplay_data_read','mplay_data_mode', + 'mplay_message_send','mplay_message_send_guaranteed','mplay_message_receive','mplay_message_id', + 'mplay_message_value','mplay_message_player','mplay_message_name','mplay_message_count', + 'mplay_message_clear', + // Using DLL's + 'external_define','external_call','external_free','execute_string','execute_file','window_handle', + // 3D Graphics + 'd3d_start','d3d_end','d3d_set_hidden','d3d_set_perspective', + 'd3d_set_depth', + 'd3d_primitive_begin','d3d_vertex','d3d_vertex_color','d3d_primitive_end', + 'd3d_primitive_begin_texture','d3d_vertex_texture','d3d_vertex_texture_color','d3d_set_culling', + 'd3d_draw_block','d3d_draw_cylinder','d3d_draw_cone','d3d_draw_ellipsoid','d3d_draw_wall', + 'd3d_draw_floor', + 'd3d_set_projection','d3d_set_projection_ext','d3d_set_projection_ortho', + 'd3d_set_projection_perspective', + 'd3d_transform_set_identity','d3d_transform_set_translation','d3d_transform_set_scaling', + 'd3d_transform_set_rotation_x','d3d_transform_set_rotation_y','d3d_transform_set_rotation_z', + 'd3d_transform_set_rotation_axis','d3d_transform_add_translation','d3d_transform_add_scaling', + 'd3d_transform_add_rotation_x','d3d_transform_add_rotation_y','d3d_transform_add_rotation_z', + 'd3d_transform_add_rotation_axis','d3d_transform_stack_clear','d3d_transform_stack_empty', + 'd3d_transform_stack_push','d3d_transform_stack_pop','d3d_transform_stack_top', + 'd3d_transform_stack_discard', + 'd3d_set_fog', + 'd3d_set_lighting','d3d_set_shading','d3d_light_define_direction','d3d_light_define_point', + 'd3d_light_enable','d3d_vertex_normal','d3d_vertex_normal_color','d3d_vertex_normal_texture', + 'd3d_vertex_normal_texture_color', + 'd3d_model_create','d3d_model_destroy','d3d_model_clear','d3d_model_save','d3d_model_load', + 'd3d_model_draw','d3d_model_primitive_begin','d3d_model_vertex','d3d_model_vertex_color', + 'd3d_model_vertex_texture','d3d_model_vertex_texture_color','d3d_model_vertex_normal', + 'd3d_model_vertex_normal_color','d3d_model_vertex_normal_texture', + 'd3d_model_vertex_normal_texture_color','d3d_model_primitive_end','d3d_model_block', + 'd3d_model_cylinder','d3d_model_cone','d3d_model_ellipsoid','d3d_model_wall','d3d_model_floor' + ), + // constants + 4 => array( + 'true', 'false', 'pi', + 'ev_destroy','ev_step','ev_alarm','ev_keyboard','ev_mouse','ev_collision','ev_other','ev_draw', + 'ev_keypress','ev_keyrelease','ev_left_button','ev_right_button','ev_middle_button', + 'ev_no_button','ev_left_press','ev_right_press','ev_middle_press','ev_left_release', + 'ev_right_release','ev_middle_release','ev_mouse_enter','ev_mouse_leave','ev_mouse_wheel_up', + 'ev_mouse_wheel_down','ev_global_left_button','ev_global_right_button','ev_global_middle_button', + 'ev_global_left_press','ev_global_right_press','ev_global_middle_press','ev_global_left_release', + 'ev_global_right_release','ev_global_middle_release','ev_joystick1_left','ev_joystick1_right', + 'ev_joystick1_up','ev_joystick1_down','ev_joystick1_button1','ev_joystick1_button2', + 'ev_joystick1_button3','ev_joystick1_button4','ev_joystick1_button5','ev_joystick1_button6', + 'ev_joystick1_button7','ev_joystick1_button8','ev_joystick2_left','ev_joystick2_right', + 'ev_joystick2_up','ev_joystick2_down','ev_joystick2_button1','ev_joystick2_button2', + 'ev_joystick2_button3','ev_joystick2_button4','ev_joystick2_button5','ev_joystick2_button6', + 'ev_joystick2_button7','ev_joystick2_button8', + 'ev_outside','ev_boundary','ev_game_start','ev_game_end','ev_room_start','ev_room_end', + 'ev_no_more_lives','ev_no_more_health','ev_animation_end','ev_end_of_path','ev_user0','ev_user1', + 'ev_user2','ev_user3','ev_user4','ev_user5','ev_user6','ev_user7','ev_user8','ev_user9', + 'ev_user10','ev_user11','ev_user12','ev_user13','ev_user14','ev_user15','ev_step_normal', + 'ev_step_begin','ev_step_end', + 'vk_nokey','vk_anykey','vk_left','vk_right','vk_up','vk_down','vk_enter','vk_escape','vk_space', + 'vk_shift','vk_control','vk_alt','vk_backspace','vk_tab','vk_home','vk_end','vk_delete', + 'vk_insert','vk_pageup','vk_pagedown','vk_pause','vk_printscreen', + 'vk_f1','vk_f2','vk_f3','vk_f4','vk_f5','vk_f6','vk_f7','vk_f8','vk_f9','vk_f10','vk_f11','vk_f12', + 'vk_numpad0','vk_numpad1','vk_numpad2','vk_numpad3','vk_numpad4','vk_numpad5','vk_numpad6', + 'vk_numpad7','vk_numpad8','vk_numpad9', 'vk_multiply','vk_divide','vk_add','vk_subtract', + 'vk_decimal','vk_lshift','vk_lcontrol','vk_lalt','vk_rshift','vk_rcontrol','vk_ralt', + 'c_aqua','c_black','c_blue','c_dkgray','c_fuchsia','c_gray','c_green','c_lime','c_ltgray', + 'c_maroon','c_navy','c_olive','c_purple','c_red','c_silver','c_teal','c_white','c_yellow', + 'fa_left', 'fa_center','fa_right','fa_top','fa_middle','fa_bottom', + 'pr_pointlist','pr_linelist','pr_linestrip','pr_trianglelist','pr_trianglestrip', + 'pr_trianglefan', + 'cr_none','cr_arrow','cr_cross','cr_beam','cr_size_nesw','cr_size_ns','cr_size_nwse', + 'cr_size_we','cr_uparrow','cr_hourglass','cr_drag','cr_nodrop','cr_hsplit','cr_vsplit', + 'cr_multidrag','cr_sqlwait','cr_no','cr_appstart','cr_help','cr_handpoint','cr_size_all', + 'se_chorus','se_echo','se_flanger','se_gargle','se_reverb','se_compressor','se_equalizer', + 'fa_readonly','fa_hidden','fa_sysfile','fa_volumeid','fa_directory','fa_archive', + 'pt_shape_pixel','pt_shape_disk','pt_shape_square','pt_shape_line','pt_shape_star', + 'pt_shape_circle','pt_shape_ring','pt_shape_sphere','pt_shape_flare','pt_shape_spark', + 'pt_shape_explosion','pt_shape_cloud','pt_shape_smoke','pt_shape_snow', + 'ps_shape_rectangle','ps_shape_ellipse ','ps_shape_diamond','ps_shape_line', + 'ps_distr_linear','ps_distr_gaussian','ps_force_constant','ps_force_linear','ps_force_quadratic', + 'ps_deflect_horizontal', 'ps_deflect_vertical', + 'ps_change_motion','ps_change_shape','ps_change_all' + ), + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '&&', '||', '^^', '<', '<=', '==', '!=', '>', '>=', + '|', '&', '^', '<<', '>>', '+', '-', '*', '/', '!', '-', '~' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => true, + 2 => true, + 3 => true, + 4 => true, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'font-weight: bold; color: #000000;', + 2 => 'font-weight: bold; color: #000000;', + 3 => 'color: navy;', + 4 => 'color: brown', + ), + 'COMMENTS' => array( + 1 => 'font-style: italic; color: green;', + 'MULTI' => 'font-style: italic; color: green;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' //'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #202020;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66; font-weight: bold;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + // All GML functions have been indexed, but need some corrections. + 3 => 'http://www.zonamakers.com/gmlreference/{FNAME}.html', // (provisional, could change soon!) + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/html4strict.php b/plugins/dokuwiki/inc/geshi/html4strict.php new file mode 100644 index 0000000..2f9bf74 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/html4strict.php @@ -0,0 +1,256 @@ + 'HTML', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(''), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + ), + 2 => array( + '<a>', '<abbr>', '<acronym>', '<address>', '<applet>', + '<a', '<abbr', '<acronym', '<address', '<applet', + '</a>', '</abbr>', '</acronym>', '</address>', '</applet>', + '</a', '</abbr', '</acronym', '</address', '</applet', + + '<base>', '<basefont>', '<bdo>', '<big>', '<blockquote>', '<body>', '<br>', '<button>', '<b>', + '<base', '<basefont', '<bdo', '<big', '<blockquote', '<body', '<br', '<button', '<b', + '</base>', '</basefont>', '</bdo>', '</big>', '</blockquote>', '</body>', '</br>', '</button>', '</b>', + '</base', '</basefont', '</bdo', '</big', '</blockquote', '</body', '</br', '</button', '</b', + + '<caption>', '<center>', '<cite>', '<code>', '<colgroup>', '<col>', + '<caption', '<center', '<cite', '<code', '<colgroup', '<col', + '</caption>', '</center>', '</cite>', '</code>', '</colgroup>', '</col>', + '</caption', '</center', '</cite', '</code', '</colgroup', '</col', + + '<dd>', '<del>', '<dfn>', '<dir>', '<div>', '<dl>', '<dt>', + '<dd', '<del', '<dfn', '<dir', '<div', '<dl', '<dt', + '</dd>', '</del>', '</dfn>', '</dir>', '</div>', '</dl>', '</dt>', + '</dd', '</del', '</dfn', '</dir', '</div', '</dl', '</dt', + + '<em>', + '<em', + '</em>', + '</em', + + '<fieldset>', '<font>', '<form>', '<frame>', '<frameset>', + '<fieldset', '<font', '<form', '<frame', '<frameset', + '</fieldset>', '</font>', '</form>', '</frame>', '</frameset>', + '</fieldset', '</font', '</form', '</frame', '</frameset', + + '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<head>', '<hr>', '<html>', + '<h1', '<h2', '<h3', '<h4', '<h5', '<h6', '<head', '<hr', '<html', + '</h1>', '</h2>', '</h3>', '</h4>', '</h5>', '</h6>', '</head>', '</hr>', '</html>', + '</h1', '</h2', '</h3', '</h4', '</h5', '</h6', '</head', '</hr', '</html', + + '<iframe>', '<ilayer>', '<img>', '<input>', '<ins>', '<isindex>', '<i>', + '<iframe', '<ilayer', '<img', '<input', '<ins', '<isindex', '<i', + '</iframe>', '</ilayer>', '</img>', '</input>', '</ins>', '</isindex>', '</i>', + '</iframe', '</ilayer', '</img', '</input', '</ins', '</isindex', '</i', + + '<kbd>', + '<kbd', + '&t;/kbd>', + '</kbd', + + '<label>', '<legend>', '<link>', '<li>', + '<label', '<legend', '<link', '<li', + '</label>', '</legend>', '</link>', '</li>', + '</label', '</legend', '</link', '</li', + + '<map>', '<meta>', + '<map', '<meta', + '</map>', '</meta>', + '</map', '</meta', + + '<noframes>', '<noscript>', + '<noframes', '<noscript', + '</noframes>', '</noscript>', + '</noframes', '</noscript', + + '<object>', '<ol>', '<optgroup>', '<option>', + '<object', '<ol', '<optgroup', '<option', + '</object>', '</ol>', '</optgroup>', '</option>', + '</object', '</ol', '</optgroup', '</option', + + '<param>', '<pre>', '<p>', + '<param', '<pre', '<p', + '</param>', '</pre>', '</p>', + '</param', '</pre', '</p', + + '<q>', + '<q', + '</q>', + '</q', + + '<samp>', '<script>', '<select>', '<small>', '<span>', '<strike>', '<strong>', '<style>', '<sub>', '<sup>', '<s>', + '<samp', '<script', '<select', '<small', '<span', '<strike', '<strong', '<style', '<sub', '<sup', '<s', + '</samp>', '</script>', '</select>', '</small>', '</span>', '</strike>', '</strong>', '</style>', '</sub>', '</sup>', '</s>', + '</samp', '</script', '</select', '</small', '</span', '</strike', '</strong', '</style', '</sub', '</sup', '</s', + + '<table>', '<tbody>', '<td>', '<textarea>', '<text>', '<tfoot>', '<thead>', '<th>', '<title>', '<tr>', '<tt>', + '<table', '<tbody', '<td', '<textarea', '<text', '<tfoot', '<tfoot', '<thead', '<th', '<title', '<tr', '<tt', + '</table>', '</tbody>', '</td>', '</textarea>', '</text>', '</tfoot>', '</thead', '</tfoot', '</th>', '</title>', '</tr>', '</tt>', + '</table', '</tbody', '</td', '</textarea', '</text', '</tfoot', '</tfoot', '</thead', '</th', '</title', '</tr', '</tt', + + '<ul>', '<u>', + '<ul', '<u', + '</ul>', '</ul>', + '</ul', '</u', + + '<var>', + '<var', + '</var>', + '</var', + + '>', '<' + ), + 3 => array( + 'abbr', 'accept-charset', 'accept', 'accesskey', 'action', 'align', 'alink', 'alt', 'archive', 'axis', + 'background', 'bgcolor', 'border', + 'cellpadding', 'cellspacing', 'char', 'char', 'charoff', 'charset', 'checked', 'cite', 'class', 'classid', 'clear', 'code', 'codebase', 'codetype', 'color', 'cols', 'colspan', 'compact', 'content', 'coords', + 'data', 'datetime', 'declare', 'defer', 'dir', 'disabled', + 'enctype', + 'face', 'for', 'frame', 'frameborder', + 'headers', 'height', 'href', 'hreflang', 'hspace', 'http-equiv', + 'id', 'ismap', + 'label', 'lang', 'language', 'link', 'longdesc', + 'marginheight', 'marginwidth', 'maxlength', 'media', 'method', 'multiple', + 'name', 'nohref', 'noresize', 'noshade', 'nowrap', + 'object', 'onblur', 'onchange', 'onclick', 'ondblclick', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onreset', 'onselect', 'onsubmit', 'onunload', + 'profile', 'prompt', + 'readonly', 'rel', 'rev', 'rowspan', 'rows', 'rules', + 'scheme', 'scope', 'scrolling', 'selected', 'shape', 'size', 'span', 'src', 'standby', 'start', 'style', 'summary', + 'tabindex', 'target', 'text', 'title', 'type', + 'usemap', + 'valign', 'value', 'valuetype', 'version', 'vlink', 'vspace', + 'width' + ) + ), + 'SYMBOLS' => array( + '/', '=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + 0 => 'color: #00bbdd;', + 1 => 'color: #ddbb00;', + 2 => 'color: #009900;' + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => 'http://december.com/html/4/element/{FNAME}.html', + 3 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + ' '>' + ), + 1 => array( + '&' => ';' + ), + 2 => array( + '<' => '>' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => false, + 1 => false, + 2 => true + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/html5.php b/plugins/dokuwiki/inc/geshi/html5.php new file mode 100644 index 0000000..64101b8 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/html5.php @@ -0,0 +1,210 @@ + 'HTML5', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 2 => array( + 'a', 'abbr', 'address', 'article', 'area', 'aside', 'audio', + + 'base', 'bdo', 'blockquote', 'body', 'br', 'button', 'b', + + 'caption', 'cite', 'code', 'colgroup', 'col', 'canvas', 'command', 'datalist', 'details', + + 'dd', 'del', 'dfn', 'div', 'dl', 'dt', + + 'em', 'embed', + + 'fieldset', 'form', 'figcaption', 'figure', 'footer', + + 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'html', 'header', 'hgroup', + + 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'i', + + 'kbd', 'keygen', + + 'label', 'legend', 'link', 'li', + + 'map', 'meta', 'mark', 'meter', + + 'noscript', 'nav', + + 'object', 'ol', 'optgroup', 'option', 'output', + + 'param', 'pre', 'p', 'progress', + + 'q', + + 'rp', 'rt', 'ruby', + + 'samp', 'script', 'select', 'small', 'span', 'strong', 'style', 'sub', 'sup', 's', 'section', 'source', 'summary', + + 'table', 'tbody', 'td', 'textarea', 'text', 'tfoot', 'thead', 'th', 'title', 'tr', 'time', + + 'ul', + + 'var', 'video', + + 'wbr', + ), + 3 => array( + 'abbr', 'accept-charset', 'accept', 'accesskey', 'action', 'align', 'alink', 'alt', 'archive', 'axis', 'autocomplete', 'autofocus', + 'background', 'bgcolor', 'border', + 'cellpadding', 'cellspacing', 'char', 'charoff', 'charset', 'checked', 'cite', 'class', 'classid', 'clear', 'code', 'codebase', 'codetype', 'color', 'cols', 'colspan', 'compact', 'content', 'coords', 'contenteditable', 'contextmenu', + 'data', 'datetime', 'declare', 'defer', 'dir', 'disabled', 'draggable', 'dropzone', + 'enctype', + 'face', 'for', 'frame', 'frameborder', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', + 'headers', 'height', 'href', 'hreflang', 'hspace', 'http-equiv', 'hidden', + 'id', 'ismap', + 'label', 'lang', 'language', 'link', 'longdesc', + 'marginheight', 'marginwidth', 'maxlength', 'media', 'method', 'multiple', 'min', 'max', + 'name', 'nohref', 'noresize', 'noshade', 'nowrap', 'novalidate', + 'object', 'onblur', 'onchange', 'onclick', 'ondblclick', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onselect', 'onsubmit', 'onunload', 'onafterprint', 'onbeforeprint', 'onbeforeonload', 'onerror', 'onhaschange', 'onmessage', 'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onredo', 'onresize', 'onstorage', 'onundo', 'oncontextmenu', 'onformchange', 'onforminput', 'oninput', 'oninvalid', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onmousewheel', 'onscroll', 'oncanplay', 'oncanplaythrough', 'ondurationchange', 'onemptied', 'onended', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onreadystatechange', 'onseeked', 'onseeking', 'onstalled', 'onsuspend', 'ontimeupdate', 'onvolumechange', 'onwaiting', + 'profile', 'prompt', 'pattern', 'placeholder', + 'readonly', 'rel', 'rev', 'rowspan', 'rows', 'rules', 'required', + 'scheme', 'scope', 'scrolling', 'selected', 'shape', 'size', 'span', 'src', 'standby', 'start', 'style', 'summary', 'spellcheck', 'step', + 'tabindex', 'target', 'text', 'title', 'type', + 'usemap', + 'valign', 'value', 'valuetype', 'version', 'vlink', 'vspace', + 'width' + ) + ), + 'SYMBOLS' => array( + '/', '=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + -2 => 'color: #404040;', // CDATA + -1 => 'color: #808080; font-style: italic;', // comments + 0 => 'color: #00bbdd;', + 1 => 'color: #ddbb00;', + 2 => 'color: #009900;' + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 2 => 'http://december.com/html/4/element/{FNAMEL}.html', + 3 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, + 'SCRIPT_DELIMITERS' => array( + -2 => array( + ' ']]>' + ), + -1 => array( + '' + ), + 0 => array( + ' '>' + ), + 1 => array( + '&' => ';' + ), + 2 => array( + '<' => '>' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + -2 => false, + -1 => false, + 0 => false, + 1 => false, + 2 => true + ), + 'TAB_WIDTH' => 4, + 'PARSER_CONTROL' => array( + 'KEYWORDS' => array( + 2 => array( + 'DISALLOWED_BEFORE' => '(?<=<|<\/)', + 'DISALLOWED_AFTER' => '(?=\s|\/|>)', + ) + ) + ) +); diff --git a/plugins/dokuwiki/inc/geshi/ini.php b/plugins/dokuwiki/inc/geshi/ini.php new file mode 100644 index 0000000..6792829 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/ini.php @@ -0,0 +1,125 @@ + 'INI', + 'COMMENT_SINGLE' => array(0 => ';'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + ), + 'SYMBOLS' => array( + '[', ']', '=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + ), + 'COMMENTS' => array( + 0 => 'color: #666666; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => '' + ), + 'STRINGS' => array( + 0 => 'color: #933;' + ), + 'NUMBERS' => array( + 0 => '' + ), + 'METHODS' => array( + 0 => '' + ), + 'SYMBOLS' => array( + 0 => 'color: #000066; font-weight:bold;' + ), + 'REGEXPS' => array( + 0 => 'color: #000066; font-weight:bold;', + 1 => 'color: #000099;', + 2 => 'color: #660066;' + ), + 'SCRIPT' => array( + 0 => '' + ) + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '\[.+\]', + 1 => array( + GESHI_SEARCH => '([a-zA-Z0-9_]+\s*)=(.+)', + GESHI_REPLACE => '\\1', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '', + GESHI_AFTER => '=\\2' + ), + 2 => array( + // Evil hackery to get around GeSHi bug: <>" and ; are added so s can be matched + // Explicit match on variable names because if a comment is before the first < of the span + // gets chewed up... + GESHI_SEARCH => '([<>";a-zA-Z0-9_]+\s*)=(.+)', + GESHI_REPLACE => '\\2', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '\\1=', + GESHI_AFTER => '' + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/inno.php b/plugins/dokuwiki/inc/geshi/inno.php new file mode 100644 index 0000000..91273b4 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/inno.php @@ -0,0 +1,215 @@ + 'Inno', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('(*' => '*)'), + 'CASE_KEYWORDS' => 0, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array('Setup','Types','Components','Tasks','Dirs','Files','Icons','INI','InstallDelete','Languages','Messages', + 'CustomMessage','LangOptions','Registry','RUN','UninstallDelete','UninstallRun' + ,'app','win','sys','syswow64','src','sd','pf','pf32','pf64','cf','cf32','cf64','tmp','fonts','dao', + 'group','localappdata','sendto','userappdata','commonappdata','userdesktop','commondesktop','userdocs', + 'commondocs','userfavorites','commonfavorites','userprograms','commonprograms','userstartmenu', + 'commonstartmenu','userstartup','commonstartup','usertemplates','commontemplates' + ), + 2 => array( + 'nil', 'false', 'true', 'var', 'type', 'const','And', 'Array', 'As', 'Begin', 'Case', 'Class', 'Constructor', 'Destructor', 'Div', 'Do', 'DownTo', 'Else', + 'End', 'Except', 'File', 'Finally', 'For', 'Function', 'Goto', 'If', 'Implementation', 'In', 'Inherited', 'Interface', + 'Is', 'Mod', 'Not', 'Object', 'Of', 'On', 'Or', 'Packed', 'Procedure', 'Property', 'Raise', 'Record', + 'Repeat', 'Set', 'Shl', 'Shr', 'Then', 'ThreadVar', 'To', 'Try', 'Unit', 'Until', 'Uses', 'While', 'With', 'Xor', + + 'HKCC','HKCR','HKCU','HKLM','HKU','alwaysoverwrite','alwaysskipifsameorolder','append', + 'binary','classic','closeonexit','comparetimestamp','confirmoverwrite', + 'createkeyifdoesntexist','createonlyiffileexists','createvalueifdoesntexist', + 'deleteafterinstall','deletekey','deletevalue','dirifempty','dontcloseonexit', + 'dontcopy','dontcreatekey','disablenouninstallwarning','dword','exclusive','expandsz', + 'external','files','filesandordirs','fixed','fontisnttruetype','ignoreversion','iscustom','isreadme', + 'modern','multisz','new','noerror','none','normal','nowait','onlyifdestfileexists', + 'onlyifdoesntexist','onlyifnewer','overwrite','overwritereadonly','postinstall', + 'preservestringtype','promptifolder','regserver','regtypelib','restart','restartreplace', + 'runhidden','runmaximized','runminimized','sharedfile','shellexec','showcheckbox', + 'skipifnotsilent','skipifsilent','silent','skipifdoesntexist', + 'skipifsourcedoesntexist','sortfilesbyextension','unchecked','uninsalwaysuninstall', + 'uninsclearvalue','uninsdeleteentry','uninsdeletekey','uninsdeletekeyifempty', + 'uninsdeletesection','uninsdeletesectionifempty','uninsdeletevalue', + 'uninsneveruninstall','useapppaths','verysilent','waituntilidle' + + + ), + 3 => array( + 'Abs', 'Addr', 'AnsiCompareStr', 'AnsiCompareText', 'AnsiContainsStr', 'AnsiEndsStr', 'AnsiIndexStr', 'AnsiLeftStr', + 'AnsiLowerCase', 'AnsiMatchStr', 'AnsiMidStr', 'AnsiPos', 'AnsiReplaceStr', 'AnsiReverseString', 'AnsiRightStr', + 'AnsiStartsStr', 'AnsiUpperCase', 'ArcCos', 'ArcSin', 'ArcTan', 'Assigned', 'BeginThread', 'Bounds', 'CelsiusToFahrenheit', + 'ChangeFileExt', 'Chr', 'CompareStr', 'CompareText', 'Concat', 'Convert', 'Copy', 'Cos', 'CreateDir', 'CurrToStr', + 'CurrToStrF', 'Date', 'DateTimeToFileDate', 'DateTimeToStr', 'DateToStr', 'DayOfTheMonth', 'DayOfTheWeek', 'DayOfTheYear', + 'DayOfWeek', 'DaysBetween', 'DaysInAMonth', 'DaysInAYear', 'DaySpan', 'DegToRad', 'DeleteFile', 'DiskFree', 'DiskSize', + 'DupeString', 'EncodeDate', 'EncodeDateTime', 'EncodeTime', 'EndOfADay', 'EndOfAMonth', 'Eof', 'Eoln', 'Exp', 'ExtractFileDir', + 'ExtractFileDrive', 'ExtractFileExt', 'ExtractFileName', 'ExtractFilePath', 'FahrenheitToCelsius', 'FileAge', + 'FileDateToDateTime', 'FileExists', 'FilePos', 'FileSearch', 'FileSetDate', 'FileSize', 'FindClose', 'FindCmdLineSwitch', + 'FindFirst', 'FindNext', 'FloatToStr', 'FloatToStrF', 'Format', 'FormatCurr', 'FormatDateTime', 'FormatFloat', 'Frac', + 'GetCurrentDir', 'GetLastError', 'GetMem', 'High', 'IncDay', 'IncMinute', 'IncMonth', 'IncYear', 'InputBox', + 'InputQuery', 'Int', 'IntToHex', 'IntToStr', 'IOResult', 'IsInfinite', 'IsLeapYear', 'IsMultiThread', 'IsNaN', + 'LastDelimiter', 'Length', 'Ln', 'Lo', 'Log10', 'Low', 'LowerCase', 'Max', 'Mean', 'MessageDlg', 'MessageDlgPos', + 'MonthOfTheYear', 'Now', 'Odd', 'Ord', 'ParamCount', 'ParamStr', 'Pi', 'Point', 'PointsEqual', 'Pos', 'Pred', + 'Printer', 'PromptForFileName', 'PtInRect', 'RadToDeg', 'Random', 'RandomRange', 'RecodeDate', 'RecodeTime', 'Rect', + 'RemoveDir', 'RenameFile', 'Round', 'SeekEof', 'SeekEoln', 'SelectDirectory', 'SetCurrentDir', 'Sin', 'SizeOf', + 'Slice', 'Sqr', 'Sqrt', 'StringOfChar', 'StringReplace', 'StringToWideChar', 'StrToCurr', 'StrToDate', 'StrToDateTime', + 'StrToFloat', 'StrToInt', 'StrToInt64', 'StrToInt64Def', 'StrToIntDef', 'StrToTime', 'StuffString', 'Succ', 'Sum', 'Tan', + 'Time', 'TimeToStr', 'Tomorrow', 'Trunc', 'UpCase', 'UpperCase', 'VarType', 'WideCharToString', 'WrapText', 'Yesterday', + 'Append', 'AppendStr', 'Assign', 'AssignFile', 'AssignPrn', 'Beep', 'BlockRead', 'BlockWrite', 'Break', + 'ChDir', 'Close', 'CloseFile', 'Continue', 'DateTimeToString', 'Dec', 'DecodeDate', 'DecodeDateTime', + 'DecodeTime', 'Delete', 'Dispose', 'EndThread', 'Erase', 'Exclude', 'Exit', 'FillChar', 'Flush', 'FreeAndNil', + 'FreeMem', 'GetDir', 'GetLocaleFormatSettings', 'Halt', 'Inc', 'Include', 'Insert', 'MkDir', 'Move', 'New', + 'ProcessPath', 'Randomize', 'Read', 'ReadLn', 'ReallocMem', 'Rename', 'ReplaceDate', 'ReplaceTime', + 'Reset', 'ReWrite', 'RmDir', 'RunError', 'Seek', 'SetLength', 'SetString', 'ShowMessage', 'ShowMessageFmt', + 'ShowMessagePos', 'Str', 'Truncate', 'Val', 'Write', 'WriteLn', + + 'AdminPrivilegesRequired','AfterInstall','AllowCancelDuringInstall','AllowNoIcons','AllowRootDirectory','AllowUNCPath','AlwaysRestart','AlwaysShowComponentsList','AlwaysShowDirOnReadyPage','AlwaysShowGroupOnReadyPage ','AlwaysUsePersonalGroup','AppComments','AppContact','AppCopyright','AppendDefaultDirName', + 'AppendDefaultGroupName','AppId','AppModifyPath','AppMutex','AppName','AppPublisher', + 'AppPublisherURL','AppReadmeFile','AppSupportURL','AppUpdatesURL','AppVerName','AppVersion', + 'Attribs','BackColor','BackColor2','BackColorDirection','BackSolid','BeforeInstall', + 'ChangesAssociations','ChangesEnvironment','Check','CodeFile','Comment','Components','Compression','CopyMode', + 'CreateAppDir','CreateUninstallRegKey','DefaultDirName','DefaultGroupName', + 'DefaultUserInfoName','DefaultUserInfoOrg','DefaultUserInfoSerial', + 'Description','DestDir','DestName','DirExistsWarning', + 'DisableDirPage','DisableFinishedPage', + 'DisableProgramGroupPage','DisableReadyMemo','DisableReadyPage', + 'DisableStartupPrompt','DiskClusterSize','DiskSliceSize','DiskSpaceMBLabel', + 'DiskSpanning','DontMergeDuplicateFiles','EnableDirDoesntExistWarning','Encryption', + 'Excludes','ExtraDiskSpaceRequired','Filename','Flags','FlatComponentsList','FontInstall', + 'GroupDescription','HotKey','IconFilename','IconIndex','InfoAfterFile','InfoBeforeFile', + 'InternalCompressLevel','Key','LanguageDetectionMethod','Languages', + 'LicenseFile','MergeDuplicateFiles','MessagesFile','MinVersion','Name', + 'OnlyBelowVersion','OutputBaseFilename','OutputManifestFile','OutputDir', + 'Parameters','Password','Permissions','PrivilegesRequired','ReserveBytes', + 'RestartIfNeededByRun','Root','RunOnceId','Section','SetupIconFile', + 'ShowComponentSizes','ShowLanguageDialog','ShowTasksTreeLines','SlicesPerDisk', + 'SolidCompression','Source','SourceDir','StatusMsg','Subkey','Tasks', + 'TimeStampRounding','TimeStampsInUTC','TouchDate','TouchTime','Type','Types', + 'UninstallDisplayIcon','UninstallDisplayName','UninstallFilesDir','UninstallIconFile', + 'UninstallLogMode','UninstallRestartComputer','UninstallStyle','Uninstallable', + 'UpdateUninstallLogAppName','UsePreviousAppDir','UsePreviousGroup', + 'UsePreviousTasks','UsePreviousSetupType','UsePreviousUserInfo', + 'UserInfoPage','UseSetupLdr','ValueData','ValueName','ValueType', + 'VersionInfoVersion','VersionInfoCompany','VersionInfoDescription','VersionInfoTextVersion', + 'WindowResizable','WindowShowCaption','WindowStartMaximized', + 'WindowVisible','WizardImageBackColor','WizardImageFile','WizardImageStretch','WizardSmallImageBackColor','WizardSmallImageFile','WizardStyle','WorkingDir' + + + ), + 4 => array( + 'AnsiChar', 'AnsiString', 'Boolean', 'Byte', 'Cardinal', 'Char', 'Comp', 'Currency', 'Double', 'Extended', + 'Int64', 'Integer', 'LongInt', 'LongWord', 'PAnsiChar', 'PAnsiString', 'PChar', 'PCurrency', 'PDateTime', + 'PExtended', 'PInt64', 'Pointer', 'PShortString', 'PString', 'PVariant', 'PWideChar', 'PWideString', + 'Real', 'Real48', 'ShortInt', 'ShortString', 'Single', 'SmallInt', 'String', 'TBits', 'TConvType', 'TDateTime', + 'Text', 'TextFile', 'TFloatFormat', 'TFormatSettings', 'TList', 'TObject', 'TOpenDialog', 'TPoint', + 'TPrintDialog', 'TRect', 'TReplaceFlags', 'TSaveDialog', 'TSearchRec', 'TStringList', 'TSysCharSet', + 'TThreadFunc', 'Variant', 'WideChar', 'WideString', 'Word' + ), + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '@', '%', '&', '*', '|', '/', '<', '>' + ), + + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000000; font-weight: bold;',/*bold Black*/ + 2 => 'color: #000000;font-style: italic;',/*Black*/ + 3 => 'color: #0000FF;',/*blue*/ + 4 => 'color: #CC0000;'/*red*/ + ), + 'COMMENTS' => array( + 1 => 'color: #33FF00; font-style: italic;', + 'MULTI' => 'color: #33FF00; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'REGEXPS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #000000; font-weight: bold;', + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/java.php b/plugins/dokuwiki/inc/geshi/java.php new file mode 100644 index 0000000..5ef9e9d --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/java.php @@ -0,0 +1,1390 @@ + 'Java', + 'COMMENT_SINGLE' => array(1 => '//', 2 => 'import'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'for', 'foreach', 'if', 'else', 'while', 'do', + 'switch', 'case' + ), + 2 => array( + 'null', 'return', 'false', 'final', 'true', 'public', + 'private', 'protected', 'extends', 'break', 'class', + 'new', 'try', 'catch', 'throws', 'finally', 'implements', + 'interface', 'throw', 'native', 'synchronized', 'this', + 'abstract', 'transient', 'instanceof', 'assert', 'continue', + 'default', 'enum', 'package', 'static', 'strictfp', 'super', + 'volatile', 'const', 'goto' + ), + 3 => array( + 'AbstractAction', 'AbstractBorder', 'AbstractButton', 'AbstractCellEditor', + 'AbstractCollection', 'AbstractColorChooserPanel', 'AbstractDocument', + 'AbstractDocument.AttributeContext', 'AbstractDocument.Content', + 'AbstractDocument.ElementEdit', 'AbstractLayoutCache', + 'AbstractLayoutCache.NodeDimensions', 'AbstractList', 'AbstractListModel', + 'AbstractMap', 'AbstractMethodError', 'AbstractSequentialList', + 'AbstractSet', 'AbstractTableModel', 'AbstractUndoableEdit', 'AbstractWriter', + 'AccessControlContext', 'AccessControlException', 'AccessController', + 'AccessException', 'Accessible', 'AccessibleAction', 'AccessibleBundle', + 'AccessibleComponent', 'AccessibleContext', 'AccessibleHyperlink', + 'AccessibleHypertext', 'AccessibleIcon', 'AccessibleObject', + 'AccessibleRelation', 'AccessibleRelationSet', 'AccessibleResourceBundle', + 'AccessibleRole', 'AccessibleSelection', 'AccessibleState', + 'AccessibleStateSet', 'AccessibleTable', 'AccessibleTableModelChange', + 'AccessibleText', 'AccessibleValue', 'Acl', 'AclEntry', 'AclNotFoundException', + 'Action', 'ActionEvent', 'ActionListener', 'ActionMap', 'ActionMapUIResource', + 'Activatable', 'ActivateFailedException', 'ActivationDesc', + 'ActivationException', 'ActivationGroup', 'ActivationGroupDesc', + 'ActivationGroupDesc.CommandEnvironment', 'ActivationGroupID', 'ActivationID', + 'ActivationInstantiator', 'ActivationMonitor', 'ActivationSystem', + 'Activator', 'ActiveEvent', 'Adjustable', 'AdjustmentEvent', 'AdjustmentListener', + 'Adler32', 'AffineTransform', 'AffineTransformOp', 'AlgorithmParameterGenerator', + 'AlgorithmParameterGeneratorSpi', 'AlgorithmParameters', 'AlgorithmParameterSpec', + 'AlgorithmParametersSpi', 'AllPermission', 'AlphaComposite', 'AlreadyBound', + 'AlreadyBoundException', 'AlreadyBoundHelper', 'AlreadyBoundHolder', + 'AncestorEvent', 'AncestorListener', 'Annotation', 'Any', 'AnyHolder', + 'AnySeqHelper', 'AnySeqHolder', 'Applet', 'AppletContext', 'AppletInitializer', + 'AppletStub', 'ApplicationException', 'Arc2D', 'Arc2D.Double', 'Arc2D.Float', + 'Area', 'AreaAveragingScaleFilter', 'ARG_IN', 'ARG_INOUT', 'ARG_OUT', + 'ArithmeticException', 'Array', 'ArrayIndexOutOfBoundsException', + 'ArrayList', 'Arrays', 'ArrayStoreException', 'AsyncBoxView', + 'Attribute', 'AttributedCharacterIterator', 'AttributedCharacterIterator.Attribute', + 'AttributedString', 'AttributeInUseException', 'AttributeList', + 'AttributeModificationException', 'Attributes', 'Attributes.Name', + 'AttributeSet', 'AttributeSet.CharacterAttribute', 'AttributeSet.ColorAttribute', + 'AttributeSet.FontAttribute', 'AttributeSet.ParagraphAttribute', + 'AudioClip', 'AudioFileFormat', 'AudioFileFormat.Type', 'AudioFileReader', + 'AudioFileWriter', 'AudioFormat', 'AudioFormat.Encoding', 'AudioInputStream', + 'AudioPermission', 'AudioSystem', 'AuthenticationException', + 'AuthenticationNotSupportedException', 'Authenticator', 'Autoscroll', + 'AWTError', 'AWTEvent', 'AWTEventListener', 'AWTEventMulticaster', + 'AWTException', 'AWTPermission', 'BAD_CONTEXT', 'BAD_INV_ORDER', 'BAD_OPERATION', + 'BAD_PARAM', 'BAD_POLICY', 'BAD_POLICY_TYPE', 'BAD_POLICY_VALUE', 'BAD_TYPECODE', + 'BadKind', 'BadLocationException', 'BandCombineOp', 'BandedSampleModel','BasicArrowButton', + 'BasicAttribute', 'BasicAttributes', 'BasicBorders', 'BasicBorders.ButtonBorder', + 'BasicBorders.FieldBorder', 'BasicBorders.MarginBorder', 'BasicBorders.MenuBarBorder', + 'BasicBorders.RadioButtonBorder', 'BasicBorders.SplitPaneBorder', + 'BasicBorders.ToggleButtonBorder', 'BasicButtonListener', 'BasicButtonUI', + 'BasicCheckBoxMenuItemUI', 'BasicCheckBoxUI', 'BasicColorChooserUI', 'BasicComboBoxEditor', + 'BasicComboBoxEditor.UIResource', 'BasicComboBoxRenderer', 'BasicComboBoxRenderer.UIResource', + 'BasicComboBoxUI', 'BasicComboPopup', 'BasicDesktopIconUI', 'BasicDesktopPaneUI', + 'BasicDirectoryModel', 'BasicEditorPaneUI', 'BasicFileChooserUI', + 'BasicGraphicsUtils', 'BasicHTML', 'BasicIconFactory', 'BasicInternalFrameTitlePane', + 'BasicInternalFrameUI', 'BasicLabelUI', 'BasicListUI', 'BasicLookAndFeel', + 'BasicMenuBarUI', 'BasicMenuItemUI', 'BasicMenuUI', 'BasicOptionPaneUI', + 'BasicOptionPaneUI.ButtonAreaLayout', 'BasicPanelUI', 'BasicPasswordFieldUI', + 'BasicPermission', 'BasicPopupMenuSeparatorUI', 'BasicPopupMenuUI', + 'BasicProgressBarUI', 'BasicRadioButtonMenuItemUI', 'BasicRadioButtonUI', + 'BasicRootPaneUI', 'BasicScrollBarUI', 'BasicScrollPaneUI', 'BasicSeparatorUI', + 'BasicSliderUI', 'BasicSplitPaneDivider', 'BasicSplitPaneUI', 'BasicStroke', + 'BasicTabbedPaneUI', 'BasicTableHeaderUI', 'BasicTableUI', 'BasicTextAreaUI', + 'BasicTextFieldUI', 'BasicTextPaneUI', 'BasicTextUI', 'BasicTextUI.BasicCaret', + 'BasicTextUI.BasicHighlighter', 'BasicToggleButtonUI', 'BasicToolBarSeparatorUI', + 'BasicToolBarUI', 'BasicToolTipUI', 'BasicTreeUI', 'BasicViewportUI', + 'BatchUpdateException', 'BeanContext', 'BeanContextChild', + 'BeanContextChildComponentProxy', 'BeanContextChildSupport', 'BeanContextContainerProxy', + 'BeanContextEvent', 'BeanContextMembershipEvent', 'BeanContextMembershipListener', + 'BeanContextProxy', 'BeanContextServiceAvailableEvent', 'BeanContextServiceProvider', + 'BeanContextServiceProviderBeanInfo', 'BeanContextServiceRevokedEvent', + 'BeanContextServiceRevokedListener', 'BeanContextServices', + 'BeanContextServicesListener', 'BeanContextServicesSupport', + 'BeanContextServicesSupport.BCSSServiceProvider', 'BeanContextSupport', + 'BeanContextSupport.BCSIterator', 'BeanDescriptor', 'BeanInfo', 'Beans', + 'BevelBorder', 'BigDecimal', 'BigInteger', 'BinaryRefAddr', 'BindException', + 'Binding', 'BindingHelper', 'BindingHolder', 'BindingIterator', + 'BindingIteratorHelper', 'BindingIteratorHolder', 'BindingIteratorOperations', + 'BindingListHelper', 'BindingListHolder', 'BindingType', 'BindingTypeHelper', + 'BindingTypeHolder', 'BitSet', 'Blob', 'BlockView', 'Book', 'Boolean', + 'BooleanControl', 'BooleanControl.Type', 'BooleanHolder', 'BooleanSeqHelper', + 'BooleanSeqHolder', 'Border', 'BorderFactory', 'BorderLayout', 'BorderUIResource', + 'BorderUIResource.BevelBorderUIResource', 'BorderUIResource.CompoundBorderUIResource', + 'BorderUIResource.EmptyBorderUIResource', 'BorderUIResource.EtchedBorderUIResource', + 'BorderUIResource.LineBorderUIResource', 'BorderUIResource.MatteBorderUIResource', + 'BorderUIResource.TitledBorderUIResource', 'BoundedRangeModel', 'Bounds', + 'Box', 'Box.Filler', 'BoxedValueHelper', 'BoxLayout', 'BoxView', + 'BreakIterator', 'BufferedImage', 'BufferedImageFilter', 'BufferedImageOp', + 'BufferedInputStream', 'BufferedOutputStream', 'BufferedReader', 'BufferedWriter', + 'Button', 'ButtonGroup', 'ButtonModel', 'ButtonUI', 'Byte', 'ByteArrayInputStream', + 'ByteArrayOutputStream', 'ByteHolder', 'ByteLookupTable', 'Calendar', + 'CallableStatement', 'CannotProceed', 'CannotProceedException', 'CannotProceedHelper', + 'CannotProceedHolder', 'CannotRedoException', 'CannotUndoException', + 'Canvas', 'CardLayout', 'Caret', 'CaretEvent', 'CaretListener', 'CellEditor', + 'CellEditorListener', 'CellRendererPane', 'Certificate', 'Certificate.CertificateRep', + 'CertificateEncodingException', 'CertificateException', 'CertificateExpiredException', + 'CertificateFactory', 'CertificateFactorySpi', 'CertificateNotYetValidException', + 'CertificateParsingException', 'ChangedCharSetException', 'ChangeEvent', + 'ChangeListener', 'Character', 'Character.Subset', 'Character.UnicodeBlock', + 'CharacterIterator', 'CharArrayReader', 'CharArrayWriter', 'CharConversionException', + 'CharHolder', 'CharSeqHelper', 'CharSeqHolder', 'Checkbox', 'CheckboxGroup', + 'CheckboxMenuItem', 'CheckedInputStream', 'CheckedOutputStream', 'Checksum', + 'Choice', 'ChoiceFormat', 'Class', 'ClassCastException', 'ClassCircularityError', + 'ClassDesc', 'ClassFormatError', 'ClassLoader', 'ClassNotFoundException', + 'Clip', 'Clipboard', 'ClipboardOwner', 'Clob', 'Cloneable', 'CloneNotSupportedException', + 'CMMException', 'CodeSource', 'CollationElementIterator', 'CollationKey', + 'Collator', 'Collection', 'Collections', 'Color', 'ColorChooserComponentFactory', + 'ColorChooserUI', 'ColorConvertOp', 'ColorModel', 'ColorSelectionModel', + 'ColorSpace', 'ColorUIResource', 'ComboBoxEditor', 'ComboBoxModel', 'ComboBoxUI', + 'ComboPopup', 'COMM_FAILURE', 'CommunicationException', 'Comparable', + 'Comparator', 'Compiler', 'CompletionStatus', 'CompletionStatusHelper', + 'Component', 'ComponentAdapter', 'ComponentColorModel', 'ComponentEvent', + 'ComponentInputMap', 'ComponentInputMapUIResource', 'ComponentListener', + 'ComponentOrientation', 'ComponentSampleModel', 'ComponentUI', 'ComponentView', + 'Composite', 'CompositeContext', 'CompositeName','CompositeView', 'CompoundBorder', + 'CompoundControl', 'CompoundControl.Type', 'CompoundEdit', 'CompoundName', + 'ConcurrentModificationException', 'ConfigurationException', 'ConnectException', + 'ConnectException', 'ConnectIOException', 'Connection', 'Constructor', + 'Container', 'ContainerAdapter', 'ContainerEvent', 'ContainerListener', + 'ContentHandler', 'ContentHandlerFactory', 'ContentModel', 'Context', 'ContextList', + 'ContextNotEmptyException', 'ContextualRenderedImageFactory', 'Control', + 'Control.Type', 'ControlFactory', 'ControllerEventListener', 'ConvolveOp', + 'CRC32', 'CRL', 'CRLException', 'CropImageFilter', 'CSS', 'CSS.Attribute', + 'CTX_RESTRICT_SCOPE', 'CubicCurve2D', 'CubicCurve2D.Double', 'CubicCurve2D.Float', + 'Current', 'CurrentHelper', 'CurrentHolder', 'CurrentOperations', 'Cursor', + 'Customizer', 'CustomMarshal', 'CustomValue', 'DATA_CONVERSION', 'DatabaseMetaData', + 'DataBuffer', 'DataBufferByte', 'DataBufferInt', 'DataBufferShort', 'DataBufferUShort', + 'DataFlavor', 'DataFormatException', 'DatagramPacket', 'DatagramSocket', + 'DatagramSocketImpl', 'DatagramSocketImplFactory', 'DataInput', 'DataInputStream', + 'DataLine', 'DataLine.Info', 'DataOutput', 'DataOutputStream', 'DataOutputStream', + 'DataTruncation', 'Date', 'DateFormat', 'DateFormatSymbols', 'DebugGraphics', + 'DecimalFormat', 'DecimalFormatSymbols', 'DefaultBoundedRangeModel', + 'DefaultButtonModel', 'DefaultCaret', 'DefaultCellEditor', 'DefaultColorSelectionModel', + 'DefaultComboBoxModel', 'DefaultDesktopManager', 'DefaultEditorKit', + 'DefaultEditorKit.BeepAction', 'DefaultEditorKit.CopyAction', + 'DefaultEditorKit.CutAction', 'DefaultEditorKit.DefaultKeyTypedAction', + 'DefaultEditorKit.InsertBreakAction', 'DefaultEditorKit.InsertContentAction', + 'DefaultEditorKit.InsertTabAction', 'DefaultEditorKit.PasteAction,', + 'DefaultFocusManager', 'DefaultHighlighter', 'DefaultHighlighter.DefaultHighlightPainter', + 'DefaultListCellRenderer', 'DefaultListCellRenderer.UIResource', 'DefaultListModel', + 'DefaultListSelectionModel', 'DefaultMenuLayout', 'DefaultMetalTheme', + 'DefaultMutableTreeNode', 'DefaultSingleSelectionModel', 'DefaultStyledDocument', + 'DefaultStyledDocument.AttributeUndoableEdit', 'DefaultStyledDocument.ElementSpec', + 'DefaultTableCellRenderer', 'DefaultTableCellRenderer.UIResource', 'DefaultTableColumnModel', + 'DefaultTableModel', 'DefaultTextUI', 'DefaultTreeCellEditor', 'DefaultTreeCellRenderer', + 'DefaultTreeModel', 'DefaultTreeSelectionModel', 'DefinitionKind', 'DefinitionKindHelper', + 'Deflater', 'DeflaterOutputStream', 'Delegate', 'DesignMode', 'DesktopIconUI', + 'DesktopManager', 'DesktopPaneUI', 'DGC', 'Dialog', 'Dictionary', 'DigestException', + 'DigestInputStream', 'DigestOutputStream', 'Dimension', 'Dimension2D', + 'DimensionUIResource', 'DirContext', 'DirectColorModel', 'DirectoryManager', + 'DirObjectFactory', 'DirStateFactory', 'DirStateFactory.Result', 'DnDConstants', + 'Document', 'DocumentEvent', 'DocumentEvent.ElementChange', 'DocumentEvent.EventType', + 'DocumentListener', 'DocumentParser', 'DomainCombiner', 'DomainManager', + 'DomainManagerOperations', 'Double', 'DoubleHolder', 'DoubleSeqHelper', + 'DoubleSeqHolder', 'DragGestureEvent', 'DragGestureListener', 'DragGestureRecognizer', + 'DragSource', 'DragSourceContext', 'DragSourceDragEvent', 'DragSourceDropEvent', + 'DragSourceEvent', 'DragSourceListener', 'Driver', 'DriverManager', + 'DriverPropertyInfo', 'DropTarget', 'DropTarget.DropTargetAutoScroller', + 'DropTargetContext', 'DropTargetDragEvent', 'DropTargetDropEvent', + 'DropTargetEvent', 'DropTargetListener', 'DSAKey', 'DSAKeyPairGenerator', + 'DSAParameterSpec', 'DSAParams', 'DSAPrivateKey', 'DSAPrivateKeySpec', + 'DSAPublicKey', 'DSAPublicKeySpec', 'DTD', 'DTDConstants', 'DynamicImplementation', + 'DynAny', 'DynArray', 'DynEnum', 'DynFixed', 'DynSequence', 'DynStruct', + 'DynUnion', 'DynValue', 'EditorKit', 'Element', 'ElementIterator', 'Ellipse2D', + 'Ellipse2D.Double', 'Ellipse2D.Float', 'EmptyBorder', 'EmptyStackException', + 'EncodedKeySpec', 'Entity', 'EnumControl', 'EnumControl.Type','Enumeration', + 'Environment', 'EOFException', 'Error', 'EtchedBorder', 'Event', 'EventContext', + 'EventDirContext', 'EventListener', 'EventListenerList', 'EventObject', 'EventQueue', + 'EventSetDescriptor', 'Exception', 'ExceptionInInitializerError', 'ExceptionList', + 'ExpandVetoException', 'ExportException', 'ExtendedRequest', 'ExtendedResponse', + 'Externalizable', 'FeatureDescriptor', 'Field', 'FieldNameHelper', + 'FieldPosition', 'FieldView', 'File', 'FileChooserUI', 'FileDescriptor', + 'FileDialog', 'FileFilter', 'FileFilter', 'FileInputStream', 'FilenameFilter', + 'FileNameMap', 'FileNotFoundException', 'FileOutputStream', 'FilePermission', + 'FileReader', 'FileSystemView', 'FileView', 'FileWriter', 'FilteredImageSource', + 'FilterInputStream', 'FilterOutputStream', 'FilterReader', 'FilterWriter', + 'FixedHeightLayoutCache', 'FixedHolder', 'FlatteningPathIterator', 'FlavorMap', + 'Float', 'FloatControl', 'FloatControl.Type', 'FloatHolder', 'FloatSeqHelper', + 'FloatSeqHolder', 'FlowLayout', 'FlowView', 'FlowView.FlowStrategy', 'FocusAdapter', + 'FocusEvent', 'FocusListener', 'FocusManager', 'Font', 'FontFormatException', + 'FontMetrics', 'FontRenderContext', 'FontUIResource', 'Format', 'FormatConversionProvider', + 'FormView', 'Frame', 'FREE_MEM', 'GapContent', 'GeneralPath', 'GeneralSecurityException', + 'GlyphJustificationInfo', 'GlyphMetrics', 'GlyphVector', 'GlyphView', 'GlyphView.GlyphPainter', + 'GradientPaint', 'GraphicAttribute', 'Graphics', 'Graphics2D', 'GraphicsConfigTemplate', + 'GraphicsConfiguration', 'GraphicsDevice', 'GraphicsEnvironment', 'GrayFilter', + 'GregorianCalendar', 'GridBagConstraints', 'GridBagLayout', 'GridLayout', 'Group', 'Guard', + 'GuardedObject', 'GZIPInputStream', 'GZIPOutputStream', + 'HasControls', + 'HashMap', + 'HashSet', + 'Hashtable', + 'HierarchyBoundsAdapter', + 'HierarchyBoundsListener', + 'HierarchyEvent', + 'HierarchyListener', + 'Highlighter', + 'Highlighter.Highlight', + 'Highlighter.HighlightPainter', + 'HTML', + 'HTML.Attribute', + 'HTML.Tag', + 'HTML.UnknownTag', + 'HTMLDocument', + 'HTMLDocument.Iterator', + 'HTMLEditorKit', + 'HTMLEditorKit.HTMLFactory', + 'HTMLEditorKit.HTMLTextAction', + 'HTMLEditorKit.InsertHTMLTextAction', + 'HTMLEditorKit.LinkController', + 'HTMLEditorKit.Parser', + 'HTMLEditorKit.ParserCallback', + 'HTMLFrameHyperlinkEvent', + 'HTMLWriter', + 'HttpURLConnection', + 'HyperlinkEvent', + 'HyperlinkEvent.EventType', + 'HyperlinkListener', + 'ICC_ColorSpace', + 'ICC_Profile', + 'ICC_ProfileGray', + 'ICC_ProfileRGB', + 'Icon', + 'IconUIResource', + 'IconView', + 'IdentifierHelper', + 'Identity', + 'IdentityScope', + 'IDLEntity', + 'IDLType', + 'IDLTypeHelper', 'IDLTypeOperations', + 'IllegalAccessError', + 'IllegalAccessException', + 'IllegalArgumentException', + 'IllegalComponentStateException', + 'IllegalMonitorStateException', + 'IllegalPathStateException', + 'IllegalStateException', + 'IllegalThreadStateException', + 'Image', + 'ImageConsumer', + 'ImageFilter', + 'ImageGraphicAttribute', + 'ImageIcon', + 'ImageObserver', + 'ImageProducer', + 'ImagingOpException', + 'IMP_LIMIT', + 'IncompatibleClassChangeError', + 'InconsistentTypeCode', + 'IndexColorModel', + 'IndexedPropertyDescriptor', + 'IndexOutOfBoundsException', + 'IndirectionException', + 'InetAddress', + 'Inflater', + 'InflaterInputStream', + 'InheritableThreadLocal', + 'InitialContext', + 'InitialContextFactory', + 'InitialContextFactoryBuilder', + 'InitialDirContext', + 'INITIALIZE', + 'Initializer', + 'InitialLdapContext', + 'InlineView', + 'InputContext', + 'InputEvent', + 'InputMap', + 'InputMapUIResource', + 'InputMethod', + 'InputMethodContext', + 'InputMethodDescriptor', + 'InputMethodEvent', + 'InputMethodHighlight', + 'InputMethodListener', + 'InputMethodRequests', + 'InputStream', + 'InputStream', + 'InputStream', + 'InputStreamReader', + 'InputSubset', + 'InputVerifier', + 'Insets', + 'InsetsUIResource', + 'InstantiationError', + 'InstantiationException', + 'Instrument', + 'InsufficientResourcesException', + 'Integer', + 'INTERNAL', + 'InternalError', 'InternalFrameAdapter', + 'InternalFrameEvent', + 'InternalFrameListener', + 'InternalFrameUI', + 'InterruptedException', + 'InterruptedIOException', + 'InterruptedNamingException', + 'INTF_REPOS', + 'IntHolder', + 'IntrospectionException', + 'Introspector', + 'INV_FLAG', + 'INV_IDENT', + 'INV_OBJREF', + 'INV_POLICY', + 'Invalid', + 'INVALID_TRANSACTION', + 'InvalidAlgorithmParameterException', + 'InvalidAttributeIdentifierException', + 'InvalidAttributesException', + 'InvalidAttributeValueException', + 'InvalidClassException', + 'InvalidDnDOperationException', + 'InvalidKeyException', + 'InvalidKeySpecException', + 'InvalidMidiDataException', + 'InvalidName', + 'InvalidName', + 'InvalidNameException', + 'InvalidNameHelper', + 'InvalidNameHolder', + 'InvalidObjectException', + 'InvalidParameterException', + 'InvalidParameterSpecException', + 'InvalidSearchControlsException', + 'InvalidSearchFilterException', + 'InvalidSeq', + 'InvalidTransactionException', + 'InvalidValue', + 'InvocationEvent', + 'InvocationHandler', + 'InvocationTargetException', + 'InvokeHandler', + 'IOException', + 'IRObject', + 'IRObjectOperations', 'IstringHelper', 'ItemEvent', 'ItemListener', + 'ItemSelectable', 'Iterator', 'JApplet', 'JarEntry', 'JarException', + 'JarFile', 'JarInputStream', 'JarOutputStream', 'JarURLConnection', + 'JButton', 'JCheckBox', 'JCheckBoxMenuItem', 'JColorChooser', + 'JComboBox', + 'JComboBox.KeySelectionManager', + 'JComponent', + 'JDesktopPane', + 'JDialog', + 'JEditorPane', + 'JFileChooser', + 'JFrame', + 'JInternalFrame', + 'JInternalFrame.JDesktopIcon', + 'JLabel', + 'JLayeredPane', + 'JList', + 'JMenu', + 'JMenuBar', + 'JMenuItem', + 'JobAttributes', + 'JobAttributes.DefaultSelectionType', + 'JobAttributes.DestinationType', + 'JobAttributes.DialogType', + 'JobAttributes.MultipleDocumentHandlingType', + 'JobAttributes.SidesType', + 'JOptionPane', + 'JPanel', + 'JPasswordField', + 'JPopupMenu', + 'JPopupMenu.Separator', + 'JProgressBar', + 'JRadioButton', + 'JRadioButtonMenuItem', + 'JRootPane', + 'JScrollBar', + 'JScrollPane', + 'JSeparator', + 'JSlider', + 'JSplitPane', + 'JTabbedPane', + 'JTable', + 'JTableHeader', + 'JTextArea', + 'JTextComponent', + 'JTextComponent.KeyBinding', 'JTextField', + 'JTextPane', + 'JToggleButton', + 'JToggleButton.ToggleButtonModel', + 'JToolBar', + 'JToolBar.Separator', + 'JToolTip', + 'JTree', + 'JTree.DynamicUtilTreeNode', + 'JTree.EmptySelectionModel', + 'JViewport', + 'JWindow', + 'Kernel', + 'Key', + 'KeyAdapter', + 'KeyEvent', + 'KeyException', + 'KeyFactory', + 'KeyFactorySpi', + 'KeyListener', + 'KeyManagementException', + 'Keymap', + 'KeyPair', + 'KeyPairGenerator', + 'KeyPairGeneratorSpi', + 'KeySpec', + 'KeyStore', + 'KeyStoreException', + 'KeyStoreSpi', + 'KeyStroke', + 'Label', + 'LabelUI', + 'LabelView', + 'LastOwnerException', + 'LayeredHighlighter', + 'LayeredHighlighter.LayerPainter', + 'LayoutManager', + 'LayoutManager2', + 'LayoutQueue', + 'LdapContext', + 'LdapReferralException', + 'Lease', + 'LimitExceededException', + 'Line', + 'Line.Info', + 'Line2D', + 'Line2D.Double', + 'Line2D.Float', + 'LineBorder', + 'LineBreakMeasurer', + 'LineEvent', + 'LineEvent.Type', + 'LineListener', + 'LineMetrics', + 'LineNumberInputStream', + 'LineNumberReader', + 'LineUnavailableException', + 'LinkageError', + 'LinkedList', + 'LinkException', + 'LinkLoopException', + 'LinkRef', + 'List', + 'List', + 'ListCellRenderer', + 'ListDataEvent', + 'ListDataListener', + 'ListIterator', + 'ListModel', + 'ListResourceBundle', + 'ListSelectionEvent', + 'ListSelectionListener', + 'ListSelectionModel', + 'ListUI', + 'ListView', + 'LoaderHandler', + 'Locale', + 'LocateRegistry', + 'LogStream', + 'Long', + 'LongHolder', + 'LongLongSeqHelper', + 'LongLongSeqHolder', + 'LongSeqHelper', + 'LongSeqHolder', + 'LookAndFeel', + 'LookupOp', + 'LookupTable', + 'MalformedLinkException', + 'MalformedURLException', + 'Manifest', 'Map', + 'Map.Entry', + 'MARSHAL', + 'MarshalException', + 'MarshalledObject', + 'Math', + 'MatteBorder', + 'MediaTracker', + 'Member', + 'MemoryImageSource', + 'Menu', + 'MenuBar', + 'MenuBarUI', + 'MenuComponent', + 'MenuContainer', + 'MenuDragMouseEvent', + 'MenuDragMouseListener', + 'MenuElement', + 'MenuEvent', + 'MenuItem', + 'MenuItemUI', + 'MenuKeyEvent', + 'MenuKeyListener', + 'MenuListener', + 'MenuSelectionManager', + 'MenuShortcut', + 'MessageDigest', + 'MessageDigestSpi', + 'MessageFormat', + 'MetaEventListener', + 'MetalBorders', + 'MetalBorders.ButtonBorder', + 'MetalBorders.Flush3DBorder', + 'MetalBorders.InternalFrameBorder', + 'MetalBorders.MenuBarBorder', + 'MetalBorders.MenuItemBorder', + 'MetalBorders.OptionDialogBorder', + 'MetalBorders.PaletteBorder', + 'MetalBorders.PopupMenuBorder', + 'MetalBorders.RolloverButtonBorder', + 'MetalBorders.ScrollPaneBorder', + 'MetalBorders.TableHeaderBorder', + 'MetalBorders.TextFieldBorder', + 'MetalBorders.ToggleButtonBorder', + 'MetalBorders.ToolBarBorder', + 'MetalButtonUI', + 'MetalCheckBoxIcon', + 'MetalCheckBoxUI', + 'MetalComboBoxButton', + 'MetalComboBoxEditor', + 'MetalComboBoxEditor.UIResource', + 'MetalComboBoxIcon', + 'MetalComboBoxUI', + 'MetalDesktopIconUI', + 'MetalFileChooserUI', + 'MetalIconFactory', + 'MetalIconFactory.FileIcon16', + 'MetalIconFactory.FolderIcon16', + 'MetalIconFactory.PaletteCloseIcon', + 'MetalIconFactory.TreeControlIcon', + 'MetalIconFactory.TreeFolderIcon', + 'MetalIconFactory.TreeLeafIcon', + 'MetalInternalFrameTitlePane', + 'MetalInternalFrameUI', + 'MetalLabelUI', + 'MetalLookAndFeel', + 'MetalPopupMenuSeparatorUI', + 'MetalProgressBarUI', + 'MetalRadioButtonUI', + 'MetalScrollBarUI', + 'MetalScrollButton', + 'MetalScrollPaneUI', + 'MetalSeparatorUI', + 'MetalSliderUI', + 'MetalSplitPaneUI', + 'MetalTabbedPaneUI', + 'MetalTextFieldUI', + 'MetalTheme', + 'MetalToggleButtonUI', + 'MetalToolBarUI', + 'MetalToolTipUI', + 'MetalTreeUI', + 'MetaMessage', + 'Method', + 'MethodDescriptor', + 'MidiChannel', + 'MidiDevice', + 'MidiDevice.Info', + 'MidiDeviceProvider', + 'MidiEvent', + 'MidiFileFormat', + 'MidiFileReader', + 'MidiFileWriter', + 'MidiMessage', + 'MidiSystem', + 'MidiUnavailableException', + 'MimeTypeParseException', + 'MinimalHTMLWriter', + 'MissingResourceException', + 'Mixer', + 'Mixer.Info', + 'MixerProvider', + 'ModificationItem', + 'Modifier', + 'MouseAdapter', + 'MouseDragGestureRecognizer', + 'MouseEvent', + 'MouseInputAdapter', + 'MouseInputListener', + 'MouseListener', + 'MouseMotionAdapter', + 'MouseMotionListener', + 'MultiButtonUI', + 'MulticastSocket', + 'MultiColorChooserUI', + 'MultiComboBoxUI', + 'MultiDesktopIconUI', + 'MultiDesktopPaneUI', + 'MultiFileChooserUI', + 'MultiInternalFrameUI', + 'MultiLabelUI', 'MultiListUI', + 'MultiLookAndFeel', + 'MultiMenuBarUI', + 'MultiMenuItemUI', + 'MultiOptionPaneUI', + 'MultiPanelUI', + 'MultiPixelPackedSampleModel', + 'MultipleMaster', + 'MultiPopupMenuUI', + 'MultiProgressBarUI', + 'MultiScrollBarUI', + 'MultiScrollPaneUI', + 'MultiSeparatorUI', + 'MultiSliderUI', + 'MultiSplitPaneUI', + 'MultiTabbedPaneUI', + 'MultiTableHeaderUI', + 'MultiTableUI', + 'MultiTextUI', + 'MultiToolBarUI', + 'MultiToolTipUI', + 'MultiTreeUI', + 'MultiViewportUI', + 'MutableAttributeSet', + 'MutableComboBoxModel', + 'MutableTreeNode', + 'Name', + 'NameAlreadyBoundException', + 'NameClassPair', + 'NameComponent', + 'NameComponentHelper', + 'NameComponentHolder', + 'NamedValue', + 'NameHelper', + 'NameHolder', + 'NameNotFoundException', + 'NameParser', + 'NamespaceChangeListener', + 'NameValuePair', + 'NameValuePairHelper', + 'Naming', + 'NamingContext', + 'NamingContextHelper', + 'NamingContextHolder', + 'NamingContextOperations', + 'NamingEnumeration', + 'NamingEvent', + 'NamingException', + 'NamingExceptionEvent', + 'NamingListener', + 'NamingManager', + 'NamingSecurityException', + 'NegativeArraySizeException', + 'NetPermission', + 'NO_IMPLEMENT', + 'NO_MEMORY', + 'NO_PERMISSION', + 'NO_RESOURCES', + 'NO_RESPONSE', + 'NoClassDefFoundError', + 'NoInitialContextException', 'NoninvertibleTransformException', + 'NoPermissionException', + 'NoRouteToHostException', + 'NoSuchAlgorithmException', + 'NoSuchAttributeException', + 'NoSuchElementException', + 'NoSuchFieldError', + 'NoSuchFieldException', + 'NoSuchMethodError', + 'NoSuchMethodException', + 'NoSuchObjectException', + 'NoSuchProviderException', + 'NotActiveException', + 'NotBoundException', + 'NotContextException', + 'NotEmpty', + 'NotEmptyHelper', + 'NotEmptyHolder', + 'NotFound', + 'NotFoundHelper', + 'NotFoundHolder', + 'NotFoundReason', + 'NotFoundReasonHelper', + 'NotFoundReasonHolder', + 'NotOwnerException', + 'NotSerializableException', + 'NullPointerException', + 'Number', + 'NumberFormat', 'NumberFormatException', 'NVList', + 'OBJ_ADAPTER', 'Object', 'OBJECT_NOT_EXIST', 'ObjectChangeListener', + 'ObjectFactory', + 'ObjectFactoryBuilder', + 'ObjectHelper', + 'ObjectHolder', + 'ObjectImpl', 'ObjectImpl', + 'ObjectInput', + 'ObjectInputStream', + 'ObjectInputStream.GetField', + 'ObjectInputValidation', + 'ObjectOutput', + 'ObjectOutputStream', + 'ObjectOutputStream.PutField', + 'ObjectStreamClass', + 'ObjectStreamConstants', + 'ObjectStreamException', + 'ObjectStreamField', + 'ObjectView', + 'ObjID', + 'Observable', + 'Observer', + 'OctetSeqHelper', + 'OctetSeqHolder', + 'OMGVMCID', + 'OpenType', + 'Operation', + 'OperationNotSupportedException', + 'Option', + 'OptionalDataException', + 'OptionPaneUI', + 'ORB', + 'OutOfMemoryError', + 'OutputStream', + 'OutputStreamWriter', + 'OverlayLayout', + 'Owner', + 'Package', + 'PackedColorModel', + 'Pageable', + 'PageAttributes', + 'PageAttributes.ColorType', + 'PageAttributes.MediaType', + 'PageAttributes.OrientationRequestedType', + 'PageAttributes.OriginType', + 'PageAttributes.PrintQualityType', + 'PageFormat', + 'Paint', + 'PaintContext', + 'PaintEvent', + 'Panel', + 'PanelUI', + 'Paper', + 'ParagraphView', + 'ParagraphView', + 'ParameterBlock', + 'ParameterDescriptor', + 'ParseException', + 'ParsePosition', + 'Parser', + 'ParserDelegator', + 'PartialResultException', + 'PasswordAuthentication', + 'PasswordView', + 'Patch', + 'PathIterator', + 'Permission', + 'Permission', + 'PermissionCollection', + 'Permissions', + 'PERSIST_STORE', + 'PhantomReference', + 'PipedInputStream', + 'PipedOutputStream', + 'PipedReader', + 'PipedWriter', + 'PixelGrabber', + 'PixelInterleavedSampleModel', + 'PKCS8EncodedKeySpec', + 'PlainDocument', + 'PlainView', + 'Point', + 'Point2D', + 'Point2D.Double', + 'Point2D.Float', + 'Policy', + 'Policy', + 'PolicyError', + 'PolicyHelper', + 'PolicyHolder', + 'PolicyListHelper', + 'PolicyListHolder', + 'PolicyOperations', 'PolicyTypeHelper', + 'Polygon', + 'PopupMenu', + 'PopupMenuEvent', + 'PopupMenuListener', + 'PopupMenuUI', + 'Port', + 'Port.Info', + 'PortableRemoteObject', + 'PortableRemoteObjectDelegate', + 'Position', + 'Position.Bias', + 'PreparedStatement', + 'Principal', + 'Principal', + 'PrincipalHolder', + 'Printable', + 'PrinterAbortException', + 'PrinterException', + 'PrinterGraphics', + 'PrinterIOException', + 'PrinterJob', + 'PrintGraphics', + 'PrintJob', + 'PrintStream', + 'PrintWriter', + 'PRIVATE_MEMBER', + 'PrivateKey', + 'PrivilegedAction', + 'PrivilegedActionException', + 'PrivilegedExceptionAction', + 'Process', + 'ProfileDataException', + 'ProgressBarUI', + 'ProgressMonitor', + 'ProgressMonitorInputStream', + 'Properties', + 'PropertyChangeEvent', + 'PropertyChangeListener', + 'PropertyChangeSupport', + 'PropertyDescriptor', + 'PropertyEditor', + 'PropertyEditorManager', + 'PropertyEditorSupport', + 'PropertyPermission', + 'PropertyResourceBundle', + 'PropertyVetoException', + 'ProtectionDomain', + 'ProtocolException', + 'Provider', + 'ProviderException', + 'Proxy', + 'PUBLIC_MEMBER', + 'PublicKey', + 'PushbackInputStream', + 'PushbackReader', + 'QuadCurve2D', + 'QuadCurve2D.Double', + 'QuadCurve2D.Float', + 'Random', + 'RandomAccessFile', 'Raster', 'RasterFormatException', 'RasterOp', + 'Reader', 'Receiver', 'Rectangle', 'Rectangle2D', 'Rectangle2D.Double', + 'Rectangle2D.Float', 'RectangularShape', 'Ref', 'RefAddr', 'Reference', + 'Referenceable', 'ReferenceQueue', 'ReferralException', + 'ReflectPermission', 'Registry', 'RegistryHandler', 'RemarshalException', + 'Remote', 'RemoteCall', 'RemoteException', 'RemoteObject', 'RemoteRef', + 'RemoteServer', + 'RemoteStub', + 'RenderableImage', + 'RenderableImageOp', + 'RenderableImageProducer', + 'RenderContext', + 'RenderedImage', + 'RenderedImageFactory', + 'Renderer', + 'RenderingHints', + 'RenderingHints.Key', + 'RepaintManager', + 'ReplicateScaleFilter', + 'Repository', + 'RepositoryIdHelper', + 'Request', + 'RescaleOp', + 'Resolver', + 'ResolveResult', + 'ResourceBundle', + 'ResponseHandler', + 'ResultSet', + 'ResultSetMetaData', + 'ReverbType', + 'RGBImageFilter', + 'RMIClassLoader', + 'RMIClientSocketFactory', + 'RMIFailureHandler', + 'RMISecurityException', + 'RMISecurityManager', + 'RMIServerSocketFactory', + 'RMISocketFactory', + 'Robot', + 'RootPaneContainer', + 'RootPaneUI', + 'RoundRectangle2D', + 'RoundRectangle2D.Double', + 'RoundRectangle2D.Float', + 'RowMapper', + 'RSAKey', + 'RSAKeyGenParameterSpec', + 'RSAPrivateCrtKey', + 'RSAPrivateCrtKeySpec', + 'RSAPrivateKey', + 'RSAPrivateKeySpec', + 'RSAPublicKey', + 'RSAPublicKeySpec', + 'RTFEditorKit', + 'RuleBasedCollator', + 'Runnable', + 'Runtime', + 'RunTime', + 'RuntimeException', + 'RunTimeOperations', + 'RuntimePermission', + 'SampleModel', + 'SchemaViolationException', + 'Scrollable', + 'Scrollbar', + 'ScrollBarUI', + 'ScrollPane', + 'ScrollPaneConstants', + 'ScrollPaneLayout', + 'ScrollPaneLayout.UIResource', + 'ScrollPaneUI', + 'SearchControls', + 'SearchResult', + 'SecureClassLoader', + 'SecureRandom', + 'SecureRandomSpi', + 'Security', + 'SecurityException', + 'SecurityManager', + 'SecurityPermission', + 'Segment', + 'SeparatorUI', + 'Sequence', + 'SequenceInputStream', + 'Sequencer', + 'Sequencer.SyncMode', + 'Serializable', + 'SerializablePermission', + 'ServantObject', + 'ServerCloneException', + 'ServerError', 'ServerException', + 'ServerNotActiveException', + 'ServerRef', + 'ServerRequest', + 'ServerRuntimeException', + 'ServerSocket', + 'ServiceDetail', + 'ServiceDetailHelper', + 'ServiceInformation', + 'ServiceInformationHelper', + 'ServiceInformationHolder', + 'ServiceUnavailableException', + 'Set', + 'SetOverrideType', + 'SetOverrideTypeHelper', + 'Shape', + 'ShapeGraphicAttribute', + 'Short', + 'ShortHolder', + 'ShortLookupTable', + 'ShortMessage', + 'ShortSeqHelper', + 'ShortSeqHolder', + 'Signature', + 'SignatureException', + 'SignatureSpi', + 'SignedObject', + 'Signer', + 'SimpleAttributeSet', + 'SimpleBeanInfo', + 'SimpleDateFormat', + 'SimpleTimeZone', + 'SinglePixelPackedSampleModel', + 'SingleSelectionModel', + 'SizeLimitExceededException', + 'SizeRequirements', + 'SizeSequence', + 'Skeleton', + 'SkeletonMismatchException', + 'SkeletonNotFoundException', + 'SliderUI', + 'Socket', + 'SocketException', + 'SocketImpl', + 'SocketImplFactory', + 'SocketOptions', + 'SocketPermission', + 'SocketSecurityException', + 'SoftBevelBorder', + 'SoftReference', + 'SortedMap', + 'SortedSet', + 'Soundbank', + 'SoundbankReader', + 'SoundbankResource', + 'SourceDataLine', + 'SplitPaneUI', + 'SQLData', + 'SQLException', + 'SQLInput', + 'SQLOutput', 'SQLPermission', + 'SQLWarning', + 'Stack', + 'StackOverflowError', + 'StateEdit', + 'StateEditable', + 'StateFactory', + 'Statement', + 'Streamable', + 'StreamableValue', + 'StreamCorruptedException', + 'StreamTokenizer', + 'StrictMath', + 'String', + 'StringBuffer', + 'StringBufferInputStream', + 'StringCharacterIterator', + 'StringContent', + 'StringHolder', + 'StringIndexOutOfBoundsException', + 'StringReader', + 'StringRefAddr', + 'StringSelection', + 'StringTokenizer', + 'StringValueHelper', + 'StringWriter', + 'Stroke', + 'Struct', + 'StructMember', + 'StructMemberHelper', + 'Stub', + 'StubDelegate', + 'StubNotFoundException', + 'Style', + 'StyleConstants', + 'StyleConstants.CharacterConstants', + 'StyleConstants.ColorConstants', + 'StyleConstants.FontConstants', + 'StyleConstants.ParagraphConstants', + 'StyleContext', + 'StyledDocument', + 'StyledEditorKit', + 'StyledEditorKit.AlignmentAction', + 'StyledEditorKit.BoldAction', + 'StyledEditorKit.FontFamilyAction', + 'StyledEditorKit.FontSizeAction', + 'StyledEditorKit.ForegroundAction', + 'StyledEditorKit.ItalicAction', + 'StyledEditorKit.StyledTextAction', + 'StyledEditorKit.UnderlineAction', + 'StyleSheet', + 'StyleSheet.BoxPainter', + 'StyleSheet.ListPainter', + 'SwingConstants', + 'SwingPropertyChangeSupport', + 'SwingUtilities', + 'SyncFailedException', + 'Synthesizer', + 'SysexMessage', + 'System', + 'SystemColor', 'SystemException', + 'SystemFlavorMap', + 'TabableView', + 'TabbedPaneUI', + 'TabExpander', + 'TableCellEditor', + 'TableCellRenderer', + 'TableColumn', + 'TableColumnModel', + 'TableColumnModelEvent', + 'TableColumnModelListener', + 'TableHeaderUI', + 'TableModel', + 'TableModelEvent', + 'TableModelListener', + 'TableUI', + 'TableView', + 'TabSet', + 'TabStop', + 'TagElement', + 'TargetDataLine', + 'TCKind', + 'TextAction', + 'TextArea', + 'TextAttribute', + 'TextComponent', + 'TextEvent', + 'TextField', + 'TextHitInfo', + 'TextLayout', + 'TextLayout.CaretPolicy', + 'TextListener', + 'TextMeasurer', + 'TextUI', + 'TexturePaint', + 'Thread', + 'ThreadDeath', + 'ThreadGroup', + 'ThreadLocal', + 'Throwable', + 'Tie', + 'TileObserver', + 'Time', + 'TimeLimitExceededException', + 'Timer', + 'Timer', + 'TimerTask', + 'Timestamp', + 'TimeZone', + 'TitledBorder', + 'ToolBarUI', + 'Toolkit', + 'ToolTipManager', + 'ToolTipUI', + 'TooManyListenersException', + 'Track', + 'TRANSACTION_REQUIRED', + 'TRANSACTION_ROLLEDBACK', + 'TransactionRequiredException', + 'TransactionRolledbackException', + 'Transferable', + 'TransformAttribute', + 'TRANSIENT', + 'Transmitter', + 'Transparency', + 'TreeCellEditor', + 'TreeCellRenderer', + 'TreeExpansionEvent', + 'TreeExpansionListener', + 'TreeMap', + 'TreeModel', + 'TreeModelEvent', + 'TreeModelListener', + 'TreeNode', + 'TreePath', + 'TreeSelectionEvent', + 'TreeSelectionListener', + 'TreeSelectionModel', + 'TreeSet', + 'TreeUI', + 'TreeWillExpandListener', + 'TypeCode', + 'TypeCodeHolder', + 'TypeMismatch', + 'Types', + 'UID', + 'UIDefaults', + 'UIDefaults.ActiveValue', + 'UIDefaults.LazyInputMap', + 'UIDefaults.LazyValue', + 'UIDefaults.ProxyLazyValue', 'UIManager', + 'UIManager.LookAndFeelInfo', + 'UIResource', + 'ULongLongSeqHelper', + 'ULongLongSeqHolder', + 'ULongSeqHelper', + 'ULongSeqHolder', + 'UndeclaredThrowableException', + 'UndoableEdit', + 'UndoableEditEvent', + 'UndoableEditListener', + 'UndoableEditSupport', + 'UndoManager', + 'UnexpectedException', + 'UnicastRemoteObject', + 'UnionMember', + 'UnionMemberHelper', + 'UNKNOWN', + 'UnknownError', + 'UnknownException', + 'UnknownGroupException', + 'UnknownHostException', + 'UnknownHostException', + 'UnknownObjectException', + 'UnknownServiceException', + 'UnknownUserException', + 'UnmarshalException', + 'UnrecoverableKeyException', + 'Unreferenced', + 'UnresolvedPermission', + 'UnsatisfiedLinkError', + 'UnsolicitedNotification', + 'UnsolicitedNotificationEvent', + 'UnsolicitedNotificationListener', + 'UNSUPPORTED_POLICY', + 'UNSUPPORTED_POLICY_VALUE', + 'UnsupportedAudioFileException', + 'UnsupportedClassVersionError', + 'UnsupportedEncodingException', + 'UnsupportedFlavorException', + 'UnsupportedLookAndFeelException', + 'UnsupportedOperationException', + 'URL', + 'URLClassLoader', + 'URLConnection', + 'URLDecoder', + 'URLEncoder', + 'URLStreamHandler', + 'URLStreamHandlerFactory', + 'UserException', + 'UShortSeqHelper', + 'UShortSeqHolder', + 'UTFDataFormatException', + 'Util', + 'UtilDelegate', + 'Utilities', + 'ValueBase', + 'ValueBaseHelper', + 'ValueBaseHolder', + 'ValueFactory', + 'ValueHandler', + 'ValueMember', + 'ValueMemberHelper', + 'VariableHeightLayoutCache', + 'Vector', + 'VerifyError', + 'VersionSpecHelper', + 'VetoableChangeListener', + 'VetoableChangeSupport', + 'View', + 'ViewFactory', + 'ViewportLayout', + 'ViewportUI', + 'VirtualMachineError', + 'Visibility', + 'VisibilityHelper', + 'VM_ABSTRACT', + 'VM_CUSTOM', + 'VM_NONE', + 'VM_TRUNCATABLE', + 'VMID', + 'VoiceStatus', + 'Void', + 'WCharSeqHelper', + 'WCharSeqHolder', + 'WeakHashMap', + 'WeakReference', + 'Window', + 'WindowAdapter', + 'WindowConstants', + 'WindowEvent', 'WindowListener', + 'WrappedPlainView', + 'WritableRaster', + 'WritableRenderedImage', + 'WriteAbortedException', + 'Writer', + 'WrongTransaction', + 'WStringValueHelper', + 'X509Certificate', + 'X509CRL', + 'X509CRLEntry', + 'X509EncodedKeySpec', + 'X509Extension', + 'ZipEntry', + 'ZipException', + 'ZipFile', + 'ZipInputStream', + 'ZipOutputStream', + 'ZoneView', + '_BindingIteratorImplBase', + '_BindingIteratorStub', + '_IDLTypeStub', + '_NamingContextImplBase', + '_NamingContextStub', + '_PolicyStub', + '_Remote_Stub ' + ), + 4 => array( + 'void', 'double', 'int', 'boolean', 'byte', 'short', 'long', 'char', 'float' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '*', '&', '%', '!', ';', '<', '>', '?' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => true, + 4 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #aaaadd; font-weight: bold;', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1=> 'color: #808080; font-style: italic;', + 2=> 'color: #a1a100;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.google.com/search?hl=en&q=allinurl%3A{FNAME}+java.sun.com&bntI=I%27m%20Feeling%20Lucky', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/javascript.php b/plugins/dokuwiki/inc/geshi/javascript.php new file mode 100644 index 0000000..e585c63 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/javascript.php @@ -0,0 +1,146 @@ + 'Javascript', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'as', 'break', 'case', 'catch', 'continue', 'decodeURI', 'delete', 'do', + 'else', 'encodeURI', 'eval', 'finally', 'for', 'if', 'in', 'is', 'item', + 'instanceof', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'void', + 'while', 'write', 'with' + ), + 2 => array( + 'class', 'const', 'default', 'debugger', 'export', 'extends', 'false', + 'function', 'import', 'namespace', 'new', 'null', 'package', 'private', + 'protected', 'public', 'super', 'true', 'use', 'var' + ), + 3 => array( + + // common functions for Window object + 'alert', 'back', 'blur', 'close', 'confirm', 'focus', 'forward', 'home', + 'name', 'navigate', 'onblur', 'onerror', 'onfocus', 'onload', 'onmove', + 'onresize', 'onunload', 'open', 'print', 'prompt', 'scroll', 'status', + 'stop', + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '!', '@', '%', '&', '*', '|', '/', '<', '>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000066; font-weight: bold;', + 2 => 'color: #003366; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #009900; font-style: italic;', + 'MULTI' => 'color: #009900; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #3366CC;' + ), + 'NUMBERS' => array( + 0 => 'color: #CC0000;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0066FF;' + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + 3 => '' + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + 0 => "/.*/([igm]*)?" // matches js reg exps + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + '' + ), + 1 => array( + '' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/lisp.php b/plugins/dokuwiki/inc/geshi/lisp.php new file mode 100644 index 0000000..1ba6405 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/lisp.php @@ -0,0 +1,135 @@ + 'Lisp', + 'COMMENT_SINGLE' => array(1 => ';'), + 'COMMENT_MULTI' => array(';|' => '|;'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'not','defun','princ', + 'eval','apply','funcall','quote','identity','function', + 'complement','backquote','lambda','set','setq','setf', + 'defun','defmacro','gensym','make','symbol','intern', + 'symbol','name','symbol','value','symbol','plist','get', + 'getf','putprop','remprop','hash','make','array','aref', + 'car','cdr','caar','cadr','cdar','cddr','caaar','caadr','cadar', + 'caddr','cdaar','cdadr','cddar','cdddr','caaaar','caaadr', + 'caadar','caaddr','cadaar','cadadr','caddar','cadddr', + 'cdaaar','cdaadr','cdadar','cdaddr','cddaar','cddadr', + 'cdddar','cddddr','cons','list','append','reverse','last','nth', + 'nthcdr','member','assoc','subst','sublis','nsubst', + 'nsublis','remove','length','list','length', + 'mapc','mapcar','mapl','maplist','mapcan','mapcon','rplaca', + 'rplacd','nconc','delete','atom','symbolp','numberp', + 'boundp','null','listp','consp','minusp','zerop','plusp', + 'evenp','oddp','eq','eql','equal','cond','case','and','or', + 'let','l','if','prog','prog1','prog2','progn','go','return', + 'do','dolist','dotimes','catch','throw','error','cerror','break', + 'continue','errset','baktrace','evalhook','truncate','float', + 'rem','min','max','abs','sin','cos','tan','expt','exp','sqrt', + 'random','logand','logior','logxor','lognot','bignums','logeqv', + 'lognand','lognor','logorc2','logtest','logbitp','logcount', + 'integer','length','nil' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '!', '%', '^', '&', '/','+','-','*','=','<','>',';','|' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #555;', + 1 => 'color: #555;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + '::', ':' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/lua.php b/plugins/dokuwiki/inc/geshi/lua.php new file mode 100644 index 0000000..df14d8c --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/lua.php @@ -0,0 +1,137 @@ + 'Lua', + 'COMMENT_SINGLE' => array(1 => "--"), + 'COMMENT_MULTI' => array('--[[' => ']]'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'and','break','do','else','elseif','end','false','for','function','if', + 'in','local','nil','not','or','repeat','return','then','true','until','while', + '_VERSION','assert','collectgarbage','dofile','error','gcinfo','loadfile','loadstring', + 'print','tonumber','tostring','type','unpack', + '_ALERT','_ERRORMESSAGE','_INPUT','_PROMPT','_OUTPUT', + '_STDERR','_STDIN','_STDOUT','call','dostring','foreach','foreachi','getn','globals','newtype', + 'rawget','rawset','require','sort','tinsert','tremove', + 'abs','acos','asin','atan','atan2','ceil','cos','deg','exp', + 'floor','format','frexp','gsub','ldexp','log','log10','max','min','mod','rad','random','randomseed', + 'sin','sqrt','strbyte','strchar','strfind','strlen','strlower','strrep','strsub','strupper','tan', + 'openfile','closefile','readfrom','writeto','appendto', + 'remove','rename','flush','seek','tmpfile','tmpname','read','write', + 'clock','date','difftime','execute','exit','getenv','setlocale','time', + '_G','getfenv','getmetatable','ipairs','loadlib','next','pairs','pcall', + 'rawegal','rawget','rawset','require','setfenv','setmetatable','xpcall', + 'string.byte','string.char','string.dump','string.find','string.len', + 'string.lower','string.rep','string.sub','string.upper','string.format','string.gfind','string.gsub', + 'table.concat','table.foreach','table.foreachi','table.getn','table.sort','table.insert','table.remove','table.setn', + 'math.abs','math.acos','math.asin','math.atan','math.atan2','math.ceil','math.cos','math.deg','math.exp', + 'math.floor','math.frexp','math.ldexp','math.log','math.log10','math.max','math.min','math.mod', + 'math.pi','math.rad','math.random','math.randomseed','math.sin','math.sqrt','math.tan', + 'coroutine.create','coroutine.resume','coroutine.status', + 'coroutine.wrap','coroutine.yield', + 'io.close','io.flush','io.input','io.lines','io.open','io.output','io.read','io.tmpfile','io.type','io.write', + 'io.stdin','io.stdout','io.stderr', + 'os.clock','os.date','os.difftime','os.execute','os.exit','os.getenv','os.remove','os.rename', + 'os.setlocale','os.time','os.tmpname', + 'string','table','math','coroutine','io','os','debug' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '!', '@', '%', '&', '*', '|', '/', '<', '>', '=', ';' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #b1b100;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> + diff --git a/plugins/dokuwiki/inc/geshi/matlab.php b/plugins/dokuwiki/inc/geshi/matlab.php new file mode 100644 index 0000000..6f70a86 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/matlab.php @@ -0,0 +1,869 @@ + 'Matlab M', + 'COMMENT_SINGLE' => array(1 => '%'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array(), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'break', 'case', 'catch', 'continue', 'elseif', 'else', 'end', 'for', + 'function', 'global', 'if', 'otherwise', 'persistent', 'return', + 'switch', 'try', 'while','...' + ), + 2 => array( + 'all', + 'any', + 'exist', + 'find', + 'is', + 'isa', + 'logical', + 'mislocked', + + 'builtin', + 'eval', + 'evalc', + 'evalin', + 'feval', + 'function', + 'global', + 'nargchk', + 'persistent', + 'script', + 'break', + 'case', + 'catch', + 'else', + 'elseif', + 'end', + 'error', + 'for', + 'if', + 'otherwise', + 'return', + 'switch', + 'try', + 'warning', + 'while', + 'input', + 'keyboard', + 'menu', + 'pause', + 'class', + 'double', + 'inferiorto', + 'inline', + 'int8', + 'int16', + 'int32', + 'isa', + 'loadobj', + 'saveobj', + 'single', + 'superiorto', + 'uint8', + 'int16', + 'uint32', + 'dbclear', + 'dbcont', + 'dbdown', + 'dbmex', + 'dbquit', + 'dbstack', + 'dbstatus', + 'dbstep', + 'dbstop', + 'dbtype', + 'dbup', + + 'blkdiag', + 'eye', + 'linspace', + 'logspace', + 'ones', + 'rand', + 'randn', + 'zeros', + 'ans', + 'computer', + 'eps', + 'flops', + 'i', + 'Inf', + 'inputname', + 'j', + 'NaN', + 'nargin', + 'nargout', + 'pi', + 'realmax', + 'realmin', + 'varargin', + 'varargout', + 'calendar', + 'clock', + 'cputime', + 'date', + 'datenum', + 'datestr', + 'datevec', + 'eomday', + 'etime', + 'now', + 'tic', + 'toc', + 'weekday', + 'cat', + 'diag', + 'fliplr', + 'flipud', + 'repmat', + 'reshape', + 'rot90', + 'tril', + 'triu', + 'compan', + 'gallery', + 'hadamard', + 'hankel', + 'hilb', + 'invhilb', + 'magic', + 'pascal', + 'toeplitz', + 'wilkinson', + 'abs', + 'acos', + 'acosh', + 'acot', + 'acoth', + 'acsc', + 'acsch', + 'angle', + 'asec', + 'asech', + 'asin', + 'asinh', + 'atan', + 'atanh', + 'atan2', + 'ceil', + 'complex', + 'conj', + 'cos', + 'cosh', + 'cot', + 'coth', + 'csc', + 'csch', + 'exp', + 'fix', + 'floor', + 'gcd', + 'imag', + 'lcm', + 'log', + 'log2', + 'log10', + 'mod', + 'nchoosek', + 'real', + 'rem', + 'round', + 'sec', + 'sech', + 'sign', + 'sin', + 'sinh', + 'sqrt', + 'tan', + 'tanh', + 'airy', + 'besselh', + 'besseli', + 'besselk', + 'besselj', + 'Bessely', + 'beta', + 'betainc', + 'betaln', + 'ellipj', + 'ellipke', + 'erf', + 'erfc', + 'erfcx', + 'erfiny', + 'expint', + 'factorial', + 'gamma', + 'gammainc', + 'gammaln', + 'legendre', + 'pow2', + 'rat', + 'rats', + 'cart2pol', + 'cart2sph', + 'pol2cart', + 'sph2cart', + 'abs', + 'eval', + 'real', + 'strings', + 'deblank', + 'findstr', + 'lower', + 'strcat', + 'strcmp', + 'strcmpi', + 'strjust', + 'strmatch', + 'strncmp', + 'strrep', + 'strtok', + 'strvcat', + 'symvar', + 'texlabel', + 'upper', + 'char', + 'int2str', + 'mat2str', + 'num2str', + 'sprintf', + 'sscanf', + 'str2double', + 'str2num', + 'bin2dec', + 'dec2bin', + 'dec2hex', + 'hex2dec', + 'hex2num', + 'fclose', + 'fopen', + 'fread', + 'fwrite', + 'fgetl', + 'fgets', + 'fprintf', + 'fscanf', + 'feof', + 'ferror', + 'frewind', + 'fseek', + 'ftell', + 'sprintf', + 'sscanf', + 'dlmread', + 'dlmwrite', + 'hdf', + 'imfinfo', + 'imread', + 'imwrite', + 'textread', + 'wk1read', + 'wk1write', + 'bitand', + 'bitcmp', + 'bitor', + 'bitmax', + 'bitset', + 'bitshift', + 'bitget', + 'bitxor', + 'fieldnames', + 'getfield', + 'rmfield', + 'setfield', + 'struct', + 'struct2cell', + 'class', + 'isa', + 'cell', + 'cellfun', + 'cellstr', + 'cell2struct', + 'celldisp', + 'cellplot', + 'num2cell', + 'cat', + 'flipdim', + 'ind2sub', + 'ipermute', + 'ndgrid', + 'ndims', + 'permute', + 'reshape', + 'shiftdim', + 'squeeze', + 'sub2ind', + 'cond', + 'condeig', + 'det', + 'norm', + 'null', + 'orth', + 'rank', + 'rcond', + 'rref', + 'rrefmovie', + 'subspace', + 'trace', + 'chol', + 'inv', + 'lscov', + 'lu', + 'nnls', + 'pinv', + 'qr', + 'balance', + 'cdf2rdf', + 'eig', + 'gsvd', + 'hess', + 'poly', + 'qz', + 'rsf2csf', + 'schur', + 'svd', + 'expm', + 'funm', + 'logm', + 'sqrtm', + 'qrdelete', + 'qrinsert', + 'bar', + 'barh', + 'hist', + 'hold', + 'loglog', + 'pie', + 'plot', + 'polar', + 'semilogx', + 'semilogy', + 'subplot', + 'bar3', + 'bar3h', + 'comet3', + 'cylinder', + 'fill3', + 'plot3', + 'quiver3', + 'slice', + 'sphere', + 'stem3', + 'waterfall', + 'clabel', + 'datetick', + 'grid', + 'gtext', + 'legend', + 'plotyy', + 'title', + 'xlabel', + 'ylabel', + 'zlabel', + 'contour', + 'contourc', + 'contourf', + 'hidden', + 'meshc', + 'mesh', + 'peaks', + 'surf', + 'surface', + 'surfc', + 'surfl', + 'trimesh', + 'trisurf', + 'coneplot', + 'contourslice', + 'isocaps', + 'isonormals', + 'isosurface', + 'reducepatch', + 'reducevolume', + 'shrinkfaces', + 'smooth3', + 'stream2', + 'stream3', + 'streamline', + 'surf2patch', + 'subvolume', + 'griddata', + 'meshgrid', + 'area', + 'box', + 'comet', + 'compass', + 'errorbar', + 'ezcontour', + 'ezcontourf', + 'ezmesh', + 'ezmeshc', + 'ezplot', + 'ezplot3', + 'ezpolar', + 'ezsurf', + 'ezsurfc', + 'feather', + 'fill', + 'fplot', + 'pareto', + 'pie3', + 'plotmatrix', + 'pcolor', + 'rose', + 'quiver', + 'ribbon', + 'stairs', + 'scatter', + 'scatter3', + 'stem', + 'convhull', + 'delaunay', + 'dsearch', + 'inpolygon', + 'polyarea', + 'tsearch', + 'voronoi', + 'camdolly', + 'camlookat', + 'camorbit', + 'campan', + 'campos', + 'camproj', + 'camroll', + 'camtarget', + 'camup', + 'camva', + 'camzoom', + 'daspect', + 'pbaspect', + 'view', + 'viewmtx', + 'xlim', + 'ylim', + 'zlim', + 'camlight', + 'diffuse', + 'lighting', + 'lightingangle', + 'material', + 'specular', + 'brighten', + 'bwcontr', + 'caxis', + 'colorbar', + 'colorcube', + 'colordef', + 'colormap', + 'graymon', + 'hsv2rgb', + 'rgb2hsv', + 'rgbplot', + 'shading', + 'spinmap', + 'surfnorm', + 'whitebg', + 'autumn', + 'bone', + 'contrast', + 'cool', + 'copper', + 'flag', + 'gray', + 'hot', + 'hsv', + 'jet', + 'lines', + 'prism', + 'spring', + 'summer', + 'winter', + 'orient', + 'print', + 'printopt', + 'saveas', + 'copyobj', + 'findobj', + 'gcbo', + 'gco', + 'get', + 'rotate', + 'ishandle', + 'set', + 'axes', + 'figure', + 'image', + 'light', + 'line', + 'patch', + 'rectangle', + 'surface', + 'text Create', + 'uicontext Create', + 'capture', + 'clc', + 'clf', + 'clg', + 'close', + 'gcf', + 'newplot', + 'refresh', + 'saveas', + 'axis', + 'cla', + 'gca', + 'propedit', + 'reset', + 'rotate3d', + 'selectmoveresize', + 'shg', + 'ginput', + 'zoom', + 'dragrect', + 'drawnow', + 'rbbox', + 'dialog', + 'errordlg', + 'helpdlg', + 'inputdlg', + 'listdlg', + 'msgbox', + 'pagedlg', + 'printdlg', + 'questdlg', + 'uigetfile', + 'uiputfile', + 'uisetcolor', + 'uisetfont', + 'warndlg', + 'menu', + 'menuedit', + 'uicontextmenu', + 'uicontrol', + 'uimenu', + 'dragrect', + 'findfigs', + 'gcbo', + 'rbbox', + 'selectmoveresize', + 'textwrap', + 'uiresume', + 'uiwait Used', + 'waitbar', + 'waitforbuttonpress', + 'convhull', + 'cumprod', + 'cumsum', + 'cumtrapz', + 'delaunay', + 'dsearch', + 'factor', + 'inpolygon', + 'max', + 'mean', + 'median', + 'min', + 'perms', + 'polyarea', + 'primes', + 'prod', + 'sort', + 'sortrows', + 'std', + 'sum', + 'trapz', + 'tsearch', + 'var', + 'voronoi', + 'del2', + 'diff', + 'gradient', + 'corrcoef', + 'cov', + 'conv', + 'conv2', + 'deconv', + 'filter', + 'filter2', + 'abs', + 'angle', + 'cplxpair', + 'fft', + 'fft2', + 'fftshift', + 'ifft', + 'ifft2', + 'ifftn', + 'ifftshift', + 'nextpow2', + 'unwrap', + 'cross', + 'intersect', + 'ismember', + 'setdiff', + 'setxor', + 'union', + 'unique', + 'conv', + 'deconv', + 'poly', + 'polyder', + 'polyeig', + 'polyfit', + 'polyval', + 'polyvalm', + 'residue', + 'roots', + 'griddata', + 'interp1', + 'interp2', + 'interp3', + 'interpft', + 'interpn', + 'meshgrid', + 'ndgrid', + 'spline', + 'dblquad', + 'fmin', + 'fmins', + 'fzero', + 'ode45,', + 'ode113,', + 'ode15s,', + 'ode23s,', + 'ode23t,', + 'ode23tb', + 'odefile', + 'odeget', + 'odeset', + 'quad,', + 'vectorize', + 'spdiags', + 'speye', + 'sprand', + 'sprandn', + 'sprandsym', + 'find', + 'full', + 'sparse', + 'spconvert', + 'nnz', + 'nonzeros', + 'nzmax', + 'spalloc', + 'spfun', + 'spones', + 'colmmd', + 'colperm', + 'dmperm', + 'randperm', + 'symmmd', + 'symrcm', + 'condest', + 'normest', + 'bicg', + 'bicgstab', + 'cgs', + 'cholinc', + 'cholupdate', + 'gmres', + 'luinc', + 'pcg', + 'qmr', + 'qr', + 'qrdelete', + 'qrinsert', + 'qrupdate', + 'eigs', + 'svds', + 'spparms', + 'lin2mu', + 'mu2lin', + 'sound', + 'soundsc', + 'auread', + 'auwrite', + 'wavread', + 'wavwrite', + '[Keywords 6]', + 'addpath', + 'doc', + 'docopt', + 'help', + 'helpdesk', + 'helpwin', + 'lasterr', + 'lastwarn', + 'lookfor', + 'partialpath', + 'path', + 'pathtool', + 'profile', + 'profreport', + 'rmpath', + 'type', + 'ver', + 'version', + 'web', + 'what', + 'whatsnew', + 'which', + 'clear', + 'disp', + 'length', + 'load', + 'mlock', + 'munlock', + 'openvar', + 'pack', + 'save', + 'saveas', + 'size', + 'who', + 'whos', + 'workspace', + 'clc', + 'echo', + 'format', + 'home', + 'more', + 'cd', + 'copyfile', + 'delete', + 'diary', + 'dir', + 'edit', + 'fileparts', + 'fullfile', + 'inmem', + 'ls', + 'matlabroot', + 'mkdir', + 'open', + 'pwd', + 'tempdir', + 'tempname', + 'matlabrc', + 'quit', +) + ), + 'SYMBOLS' => array( + '...' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + //3 => false, + //4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000FF;', + 2 => 'color: #0000FF;' + ), + 'COMMENTS' => array( + 1 => 'color: #228B22;', + ), + 'ESCAPE_CHAR' => array( + 0 => '' + ), + 'BRACKETS' => array( + 0 => 'color: #080;' + ), + 'STRINGS' => array( + //0 => 'color: #A020F0;' + ), + 'NUMBERS' => array( + 0 => 'color: #33f;' + ), + 'METHODS' => array( + 1 => '', + 2 => '' + ), + 'SYMBOLS' => array( + 0 => 'color: #080;' + ), + 'REGEXPS' => array( + 0 => 'color:#A020F0;' + ), + 'SCRIPT' => array( + 0 => '' + ) + ), + 'URLS' => array( + 1 => '', + 2 => 'http://www.mathworks.com/access/helpdesk/help/techdoc/ref/{FNAME}.html', + 3 => '', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.', + 2 => '::' + ), + 'REGEXPS' => array( + 0 => array( + GESHI_SEARCH => "([^\w])'([^\\n\\r']*)'", + GESHI_REPLACE => '\\2', + GESHI_MODIFIERS => '', + GESHI_BEFORE => "\\1'", + GESHI_AFTER => "'" + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/mpasm.php b/plugins/dokuwiki/inc/geshi/mpasm.php new file mode 100644 index 0000000..3acc09d --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/mpasm.php @@ -0,0 +1,160 @@ + 'Microchip Assembler', + 'COMMENT_SINGLE' => array(1 => ';'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + /*Directive Language*/ + 4 => array( + 'CONSTANT', '#DEFINE', 'END', 'EQU', 'ERROR', 'ERROR-LEVEL', '#INCLUDE', 'LIST', + 'MESSG', 'NOLIST', 'ORG', 'PAGE', 'PROCESSOR', 'RADIX', 'SET', 'SPACE', 'SUBTITLE', + 'TITLE', '#UNDEFINE', 'VARIABLE', 'ELSE', 'ENDIF', 'ENDW', 'IF', 'IFDEF', 'IFNDEF', + 'WHILE', '__BADRAM', 'CBLOCK', '__CONFIG', 'DA', 'DATA', 'DB', 'DE', 'DT', 'DW', + 'ENDC', 'FILL', '__IDLOCS', '__MAXRAM', 'RES', 'ENDM', 'EXITM', 'EXPAND', 'LOCAL', + 'MACRO', 'NOEXPAND', 'BANKISEL', 'BANKSEL', 'CODE', 'EXTERN', 'GLOBAL', 'IDATA', + 'PAGESEL', 'UDATA', 'UDATA_ACS', 'UDATA_OVR', 'UDATA_SHR' + ), + /* 12&14-bit Specific Instruction Set*/ + 1 => array( + 'andlw', 'call', 'clrwdt', 'goto', 'iorlw', 'movlw', 'option', 'retlw', 'sleep', + 'tris', 'xorlw', 'addwf', 'andwf', 'clrf', 'clrw', 'comf', 'decf', 'decfsz', 'incf', + 'incfsz', 'iorwf', 'movf', 'movwf', 'nop', 'rlf', 'rrf', 'subwf', 'swapf', 'xorwf', + 'bcf', 'bsf', 'btfsc', 'btfss', + 'addlw', 'iorlw', 'retfie', 'return', 'sublw', 'xorlw', 'addcf', 'adddcf', 'b', 'bc', 'bdc', + 'bnc', 'bndc', 'bnz', 'bz', 'clrc', 'clrdc', 'clrz', 'lcall', 'lgoto', 'movfw', + 'negf', 'setc', 'setdc', 'setz', 'skpc', 'skpdc', 'skpnc', 'skpndc', 'skpnz', 'skpz', + 'subcf', 'subdcf', 'tstf' + ), + /* 16-bit Specific Instructiob Set */ + 2 => array ( + 'movfp', 'movlb', 'movlp', 'movpf', 'movwf', 'tablrd', 'tablwt', 'tlrd', 'tlwt', + 'addwfc', 'daw', 'mullw', 'negw', 'rlcf', 'rlncf', 'rrcf', 'rrncf', 'setf', 'subwfb', + 'btg', 'cpfseq', 'cpfsgt', 'cpfslt', 'dcfsnz', 'infsnz', 'tstfsz', 'lfsr', 'bnn', + 'bnov', 'bra', 'pop', 'push', 'rcall', 'reset' + ), + /* Registers */ + 3 => array( + 'INDF', 'TMR0', 'PCL', 'STATUS', 'FSR', 'PORTA', 'PORTB', 'PORTC', 'PORTD', 'PORTE', + 'PCLATH', 'INTCON', 'PIR1', 'PIR2', 'TMR1L', 'TMR1H', 'T1CON', 'TMR2', 'T2CON', 'TMR2L', + 'TMR2H', 'TMR0H', 'TMR0L', 'SSPBUF', 'SSPCON', 'CCPR1L', 'CCPR1H', 'CCP1CON', 'RCSTA', + 'TXREG', 'RCREG', 'CCPR2L', 'CCPR2H', 'CCP2CON', 'OPTION', 'TRISA', 'TRISB', 'TRISC', + 'TRISD', 'TRISE', 'PIE2', 'PIE1', 'PR2', 'SSPADD', 'SSPSTAT', 'TXSTA', 'SPBRG' + ), + /*Operands*/ + 5 => array( + 'high','low' + ) + ), + 'SYMBOLS' => array( + '[', ']', '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #00007f;', + 2 => 'color: #0000ff;', + 3 => 'color: #007f00;', + 4 => 'color: #46aa03; font-weight:bold;', + 5 => 'color: #7f0000;', + 6 => 'color: #7f0000;' + ), + 'COMMENTS' => array( + 1 => 'color: #adadad; font-style: italic;', + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #7f007f;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff0000;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #ff0000;', + 1 => 'color: #ff0000;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '[0-9a-fA-F][0-9a-fA-F]*[hH]', + 1 => '[01][01]*[bB]' + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/nsis.php b/plugins/dokuwiki/inc/geshi/nsis.php new file mode 100644 index 0000000..3c7086d --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/nsis.php @@ -0,0 +1,354 @@ + 'NSIS', + 'COMMENT_SINGLE' => array(1 => ';', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'",'"','`'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + '!appendfile', '!addIncludeDir', '!addplugindir', '!cd', '!define', '!delfile', '!echo', '!else', + '!endif', '!error', '!execute', '!ifdef', '!ifmacrodef', '!ifmacrondef', '!ifndef', '!include', + '!insertmacro', '!macro', '!macroend', '!packhdr', '!tempfile', '!system', '!undef', '!verbose', + '!warning' + ), + 2 => array( + 'AddBrandingImage', 'AllowRootDirInstall', 'AutoCloseWindow', 'BGFont', + 'BGGradient', 'BrandingText', 'Caption', 'ChangeUI', 'CheckBitmap', 'CompletedText', 'ComponentText', + 'CRCCheck', 'DetailsButtonText', 'DirShow', 'DirText', 'DirVar', 'DirVerify', 'FileErrorText', + 'Function', 'FunctionEnd', 'Icon', 'InstallButtonText', 'InstallColors', 'InstallDir', + 'InstallDirRegKey', 'InstProgressFlags', 'InstType', 'LangString', 'LangStringUP', 'LicenseBkColor', + 'LicenseData', 'LicenseForceSelection', 'LicenseLangString', 'LicenseText', 'LoadLanguageFile', + 'MiscButtonText', 'Name', 'OutFile', 'Page', 'PageEx', 'PageExEnd', 'Section', + 'SectionEnd', 'SectionGroup', 'SectionGroupEnd', 'SetCompressor', 'SetFont', 'ShowInstDetails', + 'ShowUninstDetails', 'SilentInstall', 'SilentUnInstall', 'SpaceTexts', 'SubCaption', 'SubSection', + 'SubSectionEnd', 'UninstallButtonText', 'UninstallCaption', 'UninstallIcon', 'UninstallSubCaption', + 'UninstallText', 'UninstPage', 'Var', 'VIAddVersionKey', 'VIProductVersion', 'WindowIcon', 'XPStyle' + ), + 3 => array( + 'AddSize', 'AllowSkipFiles', 'AutoCloseWindow', 'FileBufSize', 'GetInstDirError', 'PageCallbacks', + 'SectionIn', 'SetCompress', 'SetCompressionLevel', 'SetCompressorDictSize', + 'SetDatablockOptimize', 'SetDateSave', 'SetOverwrite', 'SetPluginUnload' + ), + 4 => array( + 'Abort', 'BringToFront', 'Call', 'CallInstDLL', 'ClearErrors', 'CopyFiles','CreateDirectory', + 'CreateFont', 'CreateShortCut', 'Delete', 'DeleteINISec', 'DeleteINIStr', 'DeleteRegKey', + 'DeleteRegValue', 'DetailPrint', 'EnableWindow', 'EnumRegKey', 'EnumRegValue', 'Exch', 'Exec', + 'ExecShell', 'ExecWait', 'ExpandEnvStrings', 'File', 'FileClose', 'FileOpen', 'FileRead', + 'FileReadByte', 'FileSeek', 'FileWrite', 'FileWriteByte', 'FindClose', 'FindFirst', 'FindNext', + 'FindWindow', 'FlushINI', 'GetCurInstType', 'GetCurrentAddress', 'GetDlgItem', 'GetDLLVersion', + 'GetDLLVersionLocal', 'GetErrorLevel', 'GetFileTime', 'GetFileTimeLocal', 'GetFullPathName', + 'GetFunctionAddress', 'GetLabelAddress', 'GetTempFileName', 'GetWindowText', 'Goto', 'HideWindow', + 'IfAbort', 'IfErrors', 'IfFileExists', 'IfRebootFlag', 'IfSilent', 'InitPluginsDir', 'InstTypeGetText', + 'InstTypeSetText', 'IntCmp', 'IntCmpU', 'IntFmt', 'IntOp', 'IsWindow', 'LockWindow', 'LogSet', 'LogText', + 'MessageBox', 'Nop', 'Pop', 'Push', 'Quit', 'ReadEnvStr', 'ReadIniStr', 'ReadRegDWORD', 'ReadRegStr', + 'Reboot', 'RegDLL', 'Rename', 'ReserveFile', 'Return', 'RMDir', 'SearchPath', 'SectionGetFlags', + 'SectionGetInstTypes', 'SectionGetSize', 'SectionGetText', 'SectionSetFlags', 'SectionSetInstTypes', + 'SectionSetSize', 'SectionSetText', 'SendMessage', 'SetAutoClose', 'SetBrandingImage', 'SetCtlColors', + 'SetCurInstType', 'SetDetailsPrint', 'SetDetailsView', 'SetErrorLevel', 'SetErrors', 'SetFileAttributes', + 'SetOutPath', 'SetRebootFlag', 'SetShellVarContext', 'SetSilent', 'ShowWindow', 'Sleep', 'StrCmp', + 'StrCpy', 'StrLen', 'UnRegDLL', 'WriteINIStr', 'WriteRegBin', 'WriteRegDWORD', 'WriteRegExpandStr', + 'WriteRegStr', 'WriteUninstaller' + ), + 5 => array( + 'all', 'alwaysoff', 'ARCHIVE', 'auto', 'both', 'bzip2', 'checkbox', 'components', 'current', + 'custom', 'directory', 'false', 'FILE_ATTRIBUTE_ARCHIVE', 'FILE_ATTRIBUTE_HIDDEN', 'FILE_ATTRIBUTE_NORMAL', + 'FILE_ATTRIBUTE_OFFLINE', 'FILE_ATTRIBUTE_READONLY', 'FILE_ATTRIBUTE_SYSTEM,TEMPORARY', + 'FILE_ATTRIBUTE_TEMPORARY', 'force', 'HIDDEN', 'hide', 'HKCC', 'HKCR', 'HKCU', 'HKDD', 'HKEY_CLASSES_ROOT', + 'HKEY_CURRENT_CONFIG', 'HKEY_CURRENT_USER', 'HKEY_DYN_DATA', 'HKEY_LOCAL_MACHINE', 'HKEY_PERFORMANCE_DATA', + 'HKEY_USERS', 'HKLM', 'HKPD', 'HKU', 'IDABORT', 'IDCANCEL', 'IDIGNORE', 'IDNO', 'IDOK', 'IDRETRY', 'IDYES', + 'ifdiff', 'ifnewer', 'instfiles', 'lastused', 'leave', 'license', 'listonly', 'lzma', 'manual', + 'MB_ABORTRETRYIGNORE', 'MB_DEFBUTTON1', 'MB_DEFBUTTON2', 'MB_DEFBUTTON3', 'MB_DEFBUTTON4', + 'MB_ICONEXCLAMATION', 'MB_ICONINFORMATION', 'MB_ICONQUESTION', 'MB_ICONSTOP', 'MB_OK', 'MB_OKCANCEL', + 'MB_RETRYCANCEL', 'MB_RIGHT', 'MB_SETFOREGROUND', 'MB_TOPMOST', 'MB_YESNO', 'MB_YESNOCANCEL', 'nevershow', + 'none', 'normal', 'off', 'OFFLINE', 'on', 'radiobuttons', 'READONLY', 'RO', 'SHCTX', 'SHELL_CONTEXT', 'show', + 'silent', 'silentlog', 'SW_HIDE', 'SW_SHOWMAXIMIZED', 'SW_SHOWMINIMIZED', 'SW_SHOWNORMAL', 'SYSTEM', + 'textonly', 'true', 'try', 'uninstConfirm', 'zlib' + ), + 6 => array( + '/a', '/components', '/COMPONENTSONLYONCUSTOM', '/CUSTOMSTRING', '/e', '/FILESONLY', '/FINAL', '/gray', '/GLOBAL', + '/ifempty', '/IMGID', '/ITALIC', '/lang', '/NOCUSTOM', '/nonfatal', '/NOUNLOAD', '/oname', '/r', '/REBOOTOK', + '/RESIZETOFIT', '/SOLID', '/SD', '/SHORT', '/silent', '/SOLID', '/STRIKE', '/TIMEOUT', '/TRIMCENTER', '/TRIMLEFT', + '/TRIMRIGHT', '/UNDERLINE', '/windows', '/x' + ), + 7 => array( + '.onGUIEnd', '.onGUIInit', '.onInit', '.onInstFailed', '.onInstSuccess', '.onMouseOverSection', + '.onRebootFailed', '.onSelChange', '.onUserAbort', '.onVerifyInstDir', 'un.onGUIEnd', 'un.onGUIInit', + 'un.onInit', 'un.onRebootFailed', 'un.onUninstFailed', 'un.onUninstSuccess', 'un.onUserAbort' + ), + 8 => array( + 'MUI.nsh', '"${NSISDIR}\Contrib\Modern UI\System.nsh"', 'MUI_SYSVERSION', 'MUI_ICON', 'MUI_UNICON', + 'MUI_HEADERIMAGE', 'MUI_HEADERIMAGE_BITMAP', 'MUI_HEADERIMAGE_BITMAP_NOSTRETCH', 'MUI_HEADERIMAGE_BITMAP_RTL', + 'MUI_HEADERIMAGE_BITMAP_RTL_NOSTRETCH', 'MUI_HEADERIMAGE_UNBITMAP', 'MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH', + 'MUI_HEADERIMAGE_UNBITMAP_RTL', 'MUI_HEADERIMAGE_UNBITMAP_RTL_NOSTRETCH', 'MUI_HEADERIMAGE_RIGHT', 'MUI_BGCOLOR', + 'MUI_UI', 'MUI_UI_HEADERIMAGE', 'MUI_UI_HEADERIMAGE_RIGHT', 'MUI_UI_COMPONENTSPAGE_SMALLDESC', + 'MUI_UI_COMPONENTSPAGE_NODESC', 'MUI_WELCOMEFINISHPAGE_BITMAP', 'MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH', + 'MUI_WELCOMEFINISHPAGE_INI', 'MUI_UNWELCOMEFINISHPAGE_BITMAP', 'MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH', + 'MUI_UNWELCOMEFINISHPAGE_INI', 'MUI_LICENSEPAGE_BGCOLOR', 'MUI_COMPONENTSPAGE_CHECKBITMAP', + 'MUI_COMPONENTSPAGE_SMALLDESC', 'MUI_COMPONENTSPAGE_NODESC', 'MUI_INSTFILESPAGE_COLORS', + 'MUI_INSTFILESPAGE_PROGRESSBAR', 'MUI_FINISHPAGE_NOAUTOCLOSE', 'MUI_UNFINISHPAGE_NOAUTOCLOSE', + 'MUI_ABORTWARNING', 'MUI_ABORTWARNING_TEXT', 'MUI_UNABORTWARNING', 'MUI_UNABORTWARNING_TEXT', + 'MUI_PAGE_WELCOME', 'MUI_PAGE_LICENSE', 'MUI_PAGE_COMPONENTS', 'MUI_PAGE_DIRECTORY', + 'MUI_PAGE_STARTMENU', 'MUI_PAGE_INSTFILES', 'MUI_PAGE_FINISH', 'MUI_UNPAGE_WELCOME', + 'MUI_UNPAGE_CONFIRM', 'MUI_UNPAGE_LICENSE', 'MUI_UNPAGE_COMPONENTS', 'MUI_UNPAGE_DIRECTORY', + 'MUI_UNPAGE_INSTFILES', 'MUI_UNPAGE_FINISH', 'MUI_PAGE_HEADER_TEXT', 'MUI_PAGE_HEADER_SUBTEXT', + 'MUI_WELCOMEPAGE_TITLE', 'MUI_WELCOMEPAGE_TITLE_3LINES', 'MUI_WELCOMEPAGE_TEXT', + 'MUI_LICENSEPAGE_TEXT_TOP', 'MUI_LICENSEPAGE_TEXT_BOTTOM', 'MUI_LICENSEPAGE_BUTTON', + 'MUI_LICENSEPAGE_CHECKBOX', 'MUI_LICENSEPAGE_CHECKBOX_TEXT', 'MUI_LICENSEPAGE_RADIOBUTTONS', + 'MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT', 'MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE', + 'MUI_COMPONENTSPAGE_TEXT_TOP', 'MUI_COMPONENTSPAGE_TEXT_COMPLIST', 'MUI_COMPONENTSPAGE_TEXT_INSTTYPE', + 'MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE', 'MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO', + 'MUI_DIRECTORYPAGE_TEXT_TOP', 'MUI_DIRECTORYPAGE_TEXT_DESTINATION', 'MUI_DIRECTORYPAGE_VARIABLE', + 'MUI_DIRECTORYPAGE_VERIFYONLEAVE', 'MUI_STARTMENU_WRITE_BEGIN', 'MUI_STARTMENU_WRITE_END', + 'MUI_STARTMENUPAGE_TEXT_TOP', 'MUI_STARTMENUPAGE_TEXT_CHECKBOX', 'MUI_STARTMENUPAGE_DEFAULTFOLDER', + 'MUI_STARTMENUPAGE_NODISABLE', 'MUI_STARTMENUPAGE_REGISTRY_ROOT', 'MUI_STARTMENUPAGE_REGISTRY_KEY', + 'MUI_STARTMENUPAGE_REGISTRY_VALUENAME', 'MUI_INSTFILESPAGE_FINISHHEADER_TEXT', + 'MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT', 'MUI_INSTFILESPAGE_ABORTHEADER_TEXT', + 'MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT', 'MUI_FINISHPAGE_TITLE', 'MUI_FINISHPAGE_TITLE_3LINES', + 'MUI_FINISHPAGE_TEXT', 'MUI_FINISHPAGE_TEXT_LARGE', 'MUI_FINISHPAGE_BUTTON', + 'MUI_FINISHPAGE_TEXT_REBOOT', 'MUI_FINISHPAGE_TEXT_REBOOTNOW', 'MUI_FINISHPAGE_TEXT_REBOOTLATER', + 'MUI_FINISHPAGE_RUN', 'MUI_FINISHPAGE_RUN_TEXT', 'MUI_FINISHPAGE_RUN_PARAMETERS', + 'MUI_FINISHPAGE_RUN_NOTCHECKED', 'MUI_FINISHPAGE_RUN_FUNCTION', 'MUI_FINISHPAGE_SHOWREADME', + 'MUI_FINISHPAGE_SHOWREADME_TEXT', 'MUI_FINISHPAGE_SHOWREADME_NOTCHECKED', + 'MUI_FINISHPAGE_SHOWREADME_FUNCTION', 'MUI_FINISHPAGE_LINK', 'MUI_FINISHPAGE_LINK_LOCATION', + 'MUI_FINISHPAGE_LINK_COLOR', 'MUI_FINISHPAGE_NOREBOOTSUPPORT', 'MUI_UNCONFIRMPAGE_TEXT_TOP', + 'MUI_UNCONFIRMPAGE_TEXT_LOCATION', 'MUI_LANGUAGE', 'MUI_LANGDLL_DISPLAY', + 'MUI_LANGDLL_REGISTRY_ROOT', 'MUI_LANGDLL_REGISTRY_KEY', 'MUI_LANGDLL_REGISTRY_VALUENAME', + 'MUI_LANGDLL_WINDOWTITLE', 'MUI_LANGDLL_INFO', 'MUI_LANGDLL_ALWAYSSHOW', + 'MUI_RESERVEFILE_INSTALLOPTIONS', 'MUI_RESERVEFILE_LANGDLL', 'MUI_FUNCTION_DESCRIPTION_BEGIN', + 'MUI_DESCRIPTION_TEXT', 'MUI_FUNCTION_DESCRIPTION_END', 'MUI_INSTALLOPTIONS_EXTRACT', + 'MUI_INSTALLOPTIONS_EXTRACT_AS', 'MUI_HEADER_TEXT', 'MUI_INSTALLOPTIONS_DISPLAY', + 'MUI_INSTALLOPTIONS_INITDIALOG', 'MUI_INSTALLOPTIONS_SHOW', + 'MUI_INSTALLOPTIONS_DISPLAY_RETURN', 'MUI_INSTALLOPTIONS_SHOW_RETURN', + 'MUI_INSTALLOPTIONS_READ', 'MUI_INSTALLOPTIONS_WRITE', + 'MUI_CUSTOMFUNCTION_GUIINIT', 'MUI_CUSTOMFUNCTION_GUIINIT', + 'MUI_CUSTOMFUNCTION_UNGUIINIT', 'MUI_CUSTOMFUNCTION_ABORT', 'MUI_CUSTOMFUNCTION_UNABORT', + 'MUI_PAGE_CUSTOMFUNCTION_PRE', 'MUI_PAGE_CUSTOMFUNCTION_SHOW', 'MUI_PAGE_CUSTOMFUNCTION_LEAVE', + 'MUI_WELCOMEFINISHPAGE_CUSTOMFUNCTION_INIT' + ), + 9 => array( + 'LogicLib.nsh', '${LOGICLIB}', 'LOGICLIB_STRCMP', 'LOGICLIB_INT64CMP', 'LOGICLIB_SECTIONCMP', '${If}', '${Unless}', + '${ElseIf}', '${ElseUnless}', '${Else}', '${EndIf}', '${EndUnless}', '${AndIf}', '${AndUnless}', + '${OrIf}', '${OrUnless}', '${IfThen}', '${IfCmd}', '${Select}', '${Case2}', '${Case3}', + '${Case4}', '${Case5}', '${CaseElse}', '${Default}', '${EndSelect}', '${Switch}', + '${Case}', '${EndSwitch}', '${Do}', '${DoWhile}', '${UntilWhile}', '${Continue}', '${Break}', + '${Loop}', '${LoopWhile}', '${LoopUntil}', '${While}', '${ExitWhile}', '${EndWhile}', '${For}', + '${ForEach}', '${ExitFor}', '${Next}', '${Abort}', '${Errors}', '${RebootFlag}', '${Silent}', + '${FileExists}', '${Cmd}', '${SectionIsSelected}', '${SectionIsSectionGroup}', + '${SectionIsSectionGroupEnd}', '${SectionIsBold}', '${SectionIsReadOnly}', + '${SectionIsExpanded}', '${SectionIsPartiallySelected}' + ), + 10 => array( + 'StrFunc.nsh', '${STRFUNC}', '${StrCase}', '${StrClb}', '${StrIOToNSIS}', '${StrLoc}', '${StrNSISToIO}', '${StrRep}', + '${StrSort}', '${StrStr}', '${StrStrAdv}', '${StrTok}', '${StrTrimNewLines}' + ), + 11 => array( + 'UpgradeDLL.nsh', 'UPGRADEDLL_INCLUDED', 'UpgradeDLL' + ), + 12 => array( + 'Sections.nsh', 'SECTIONS_INCLUDED', '${SF_SELECTED}', '${SF_SECGRP}', '${SF_SUBSEC}', '${SF_SECGRPEND}', + '${SF_SUBSECEND}', '${SF_BOLD}', '${SF_RO}', '${SF_EXPAND}', '${SF_PSELECTED}', '${SF_TOGGLED}', + '${SF_NAMECHG}', '${SECTION_OFF}', 'SelectSection', 'UnselectSection', 'ReverseSection', + 'StartRadioButtons', 'RadioButton', 'EndRadioButtons', '${INSTTYPE_1}', '${INSTTYPE_1}', '${INSTTYPE_2}', + '${INSTTYPE_3}', '${INSTTYPE_4}', '${INSTTYPE_5}', '${INSTTYPE_6}', '${INSTTYPE_7}', '${INSTTYPE_8}', + '${INSTTYPE_9}', '${INSTTYPE_10}', '${INSTTYPE_11}', '${INSTTYPE_12}', '${INSTTYPE_13}', '${INSTTYPE_14}', + '${INSTTYPE_15}', '${INSTTYPE_16}', '${INSTTYPE_17}', '${INSTTYPE_18}', '${INSTTYPE_19}', '${INSTTYPE_20}', + '${INSTTYPE_21}', '${INSTTYPE_22}', '${INSTTYPE_23}', '${INSTTYPE_24}', '${INSTTYPE_25}', '${INSTTYPE_26}', + '${INSTTYPE_27}', '${INSTTYPE_28}', '${INSTTYPE_29}', '${INSTTYPE_30}', '${INSTTYPE_31}', '${INSTTYPE_32}', + 'SetSectionInInstType', 'ClearSectionInInstType', 'SetSectionFlag', 'ClearSectionFlag', 'SectionFlagIsSet' + ), + 13 => array( + 'Colors.nsh', 'WHITE', 'BLACK', 'YELLOW', 'RED', 'GREEN', 'BLUE', 'MAGENTA', 'CYAN', 'rgb2hex' + ), + 14 => array( + 'FileFunc.nsh', '${Locate}', '${GetSize}', '${DriveSpace}', '${GetDrives}', '${GetTime}', '${GetFileAttributes}', '${GetFileVersion}', '${GetExeName}', '${GetExePath}', '${GetParameters}', '${GetOptions}', '${GetRoot}', '${GetParent}', '${GetFileName}', '${GetBaseName}', '${GetFileExt}', '${BannerTrimPath}', '${DirState}', '${RefreshShellIcons}' + ), + 15 => array( + 'TextFunc.nsh', '${LineFind}', '${LineRead}', '${FileReadFromEnd}', '${LineSum}', '${FileJoin}', '${TextCompare}', '${ConfigRead}', '${ConfigWrite}', '${FileRecode}', '${TrimNewLines}' + ), + 16 => array( + 'WordFunc.nsh', '${WordFind}', '${WordFind2X}', '${WordFind3X}', '${WordReplace}', '${WordAdd}', '${WordInsert}', '${StrFilter}', '${VersionCompare}', '${VersionConvert}' + ) + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + 14 => false, + 15 => false, + 16 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000066; font-weight:bold;', + 2 => 'color: #000066;', + 3 => 'color: #003366;', + 4 => 'color: #000099;', + 5 => 'color: #ff6600;', + 6 => 'color: #ff6600;', + 7 => 'color: #006600;', + 8 => 'color: #006600;', + 9 => 'color: #006600;', + 10 => 'color: #006600;', + 11 => 'color: #006600;', + 12 => 'color: #006600;', + 13 => 'color: #006600;', + 14 => 'color: #006600;', + 15 => 'color: #006600;', + 16 => 'color: #006600;' + ), + 'COMMENTS' => array( + 1 => 'color: #666666; font-style: italic;', + 2 => 'color: #666666; font-style: italic;', + 'MULTI' => 'color: #666666; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #660066; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => '' + ), + 'STRINGS' => array( + 0 => 'color: #660066;' + ), + 'NUMBERS' => array( + 0 => '' + ), + 'METHODS' => array( + 0 => '' + ), + 'SYMBOLS' => array( + 0 => '' + ), + 'REGEXPS' => array( + 0 => 'color: #660000;', + 1 => 'color: #660000;', + 2 => 'color: #660000;', + 3 => 'color: #660000;', + 4 => 'color: #660000;', + 5 => 'color: #660000;', + 6 => 'color: #660000;', + 7 => 'color: #000099;', + 8 => 'color: #003399;' + ), + 'SCRIPT' => array( + 0 => '' + ) + ), + 'URLS' => array( + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + 10 => '', + 11 => '', + 12 => '', + 13 => '', + 14 => '', + 15 => '', + 16 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '\$\$', + 1 => '\$\\r', + 2 => '\$\\n', + 3 => '\$\\t', + 4 => '\$[a-zA-Z0-9_]+', + 5 => '\$\{.{1,256}\}', + 6 => '\$\\\(.{1,256}\\\)', + 7 => array( + GESHI_SEARCH => '([^:/\\\*\?\"\<\>\|\s]*?)(::)([^:/\\\*\?\"\<\>\|\s]*?)', + GESHI_REPLACE => '\\1', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '', + GESHI_AFTER => '\\2\\3' + ), + 8 => array( + GESHI_SEARCH => '([^:/\\\*\?\"\<\>\|\s]*?)(::)([^:/\\\*\?\"\<\>\|]*?\s)', + GESHI_REPLACE => '\\3', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '\\1\\2', + GESHI_AFTER => '' + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/objc.php b/plugins/dokuwiki/inc/geshi/objc.php new file mode 100644 index 0000000..a1abf43 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/objc.php @@ -0,0 +1,241 @@ + 'Objective C', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'if', 'return', 'while', 'case', 'continue', 'default', + 'do', 'else', 'for', 'switch', 'goto' + ), + 2 => array( + 'NULL', 'false', 'break', 'true', 'enum', 'nil', 'Nil', 'errno', 'EDOM', + 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG', + 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG', + 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP', + 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP', + 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN', + 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN', + 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT', + 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR', + 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam', 'NULL', + 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr', + 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC' + ), + 3 => array( + 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert', + 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint', + 'ispunct', 'isspace', 'ispunct', 'isupper', 'isxdigit', 'tolower', 'toupper', + 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp', + 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2', + 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp', 'asin', 'acos', 'atan', 'atan2', + 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen', + 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf', + 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf', + 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc', + 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind', + 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs', + 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc', + 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv', + 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat', + 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn', + 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy', + 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime', + 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime' + ), + 4 => array( // Data types: + 'auto', 'char', 'const', 'double', 'float', 'int', 'long', + 'register', 'short', 'signed', 'sizeof', 'static', 'string', 'struct', + 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf', + 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t', + 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', + // OpenStep/GNUstep/Cocoa: + 'SEL', 'id', 'NSRect', 'NSRange', 'NSPoint', 'NSZone', 'Class', 'IMP', 'BOOL', + // OpenStep/GNUstep/Cocoa @identifiers + '@selector', '@class', '@protocol', '@interface', '@implementation', '@end', + '@private', '@protected', '@public', '@try', '@throw', '@catch', '@finally', + '@encode', '@defs', '@synchronized' + ), + 5 => array( // OpenStep/GNUstep/Cocoa Foundation + 'NSAppleEventDescriptor', 'NSNetService', 'NSAppleEventManager', + 'NSNetServiceBrowser', 'NSAppleScript', 'NSNotification', 'NSArchiver', + 'NSNotificationCenter', 'NSArray', 'NSNotificationQueue', 'NSAssertionHandler', + 'NSNull', 'NSAttributedString', 'NSNumber', 'NSAutoreleasePool', + 'NSNumberFormatter', 'NSBundle', 'NSObject', 'NSCachedURLResponse', + 'NSOutputStream', 'NSCalendarDate', 'NSPipe', 'NSCharacterSet', 'NSPort', + 'NSClassDescription', 'NSPortCoder', 'NSCloneCommand', 'NSPortMessage', + 'NSCloseCommand', 'NSPortNameServer', 'NSCoder', 'NSPositionalSpecifier', + 'NSConditionLock', 'NSProcessInfo', 'NSConnection', 'NSPropertyListSerialization', + 'NSCountCommand', 'NSPropertySpecifier', 'NSCountedSet', 'NSProtocolChecker', + 'NSCreateCommand', 'NSProxy', 'NSData', 'NSQuitCommand', 'NSDate', + 'NSRandomSpecifier', 'NSDateFormatter', 'NSRangeSpecifier', 'NSDecimalNumber', + 'NSRecursiveLock', 'NSDecimalNumberHandler', 'NSRelativeSpecifier', + 'NSDeleteCommand', 'NSRunLoop', 'NSDeserializer', 'NSScanner', 'NSDictionary', + 'NSScriptClassDescription', 'NSDirectoryEnumerator', 'NSScriptCoercionHandler', + 'NSDistantObject', 'NSScriptCommand', 'NSDistantObjectRequest', + 'NSScriptCommandDescription', 'NSDistributedLock', 'NSScriptExecutionContext', + 'NSDistributedNotificationCenter', 'NSScriptObjectSpecifier', 'NSEnumerator', + 'NSScriptSuiteRegistry', 'NSError', 'NSScriptWhoseTest', 'NSException', + 'NSSerializer', 'NSExistsCommand', 'NSSet', 'NSFileHandle', 'NSSetCommand', + 'NSFileManager', 'NSSocketPort', 'NSFormatter', 'NSSocketPortNameServer', + 'NSGetCommand', 'NSSortDescriptor', 'NSHost', 'NSSpecifierTest', 'NSHTTPCookie', + 'NSSpellServer', 'NSHTTPCookieStorage', 'NSStream', 'NSHTTPURLResponse', + 'NSString', 'NSIndexSet', 'NSTask', 'NSIndexSpecifier', 'NSThread', + 'NSInputStream', 'NSTimer', 'NSInvocation', 'NSTimeZone', 'NSKeyedArchiver', + 'NSUnarchiver', 'NSKeyedUnarchiver', 'NSUndoManager', 'NSLock', + 'NSUniqueIDSpecifier', 'NSLogicalTest', 'NSURL', 'NSMachBootstrapServer', + 'NSURLAuthenticationChallenge', 'NSMachPort', 'NSURLCache', 'NSMessagePort', + 'NSURLConnection', 'NSMessagePortNameServer', 'NSURLCredential', + 'NSMethodSignature', 'NSURLCredentialStorage', 'NSMiddleSpecifier', + 'NSURLDownload', 'NSMoveCommand', 'NSURLHandle', 'NSMutableArray', + 'NSURLProtectionSpace', 'NSMutableAttributedString', 'NSURLProtocol', + 'NSMutableCharacterSet', 'NSURLRequest', 'NSMutableData', 'NSURLResponse', + 'NSMutableDictionary', 'NSUserDefaults', 'NSMutableIndexSet', 'NSValue', + 'NSMutableSet', 'NSValueTransformer', 'NSMutableString', 'NSWhoseSpecifier', + 'NSMutableURLRequest', 'NSXMLParser', 'NSNameSpecifier' + ), + 6 => array( // OpenStep/GNUstep/Cocoa AppKit + 'NSActionCell', 'NSOpenGLPixelFormat', 'NSAffineTransform', 'NSOpenGLView', + 'NSAlert', 'NSOpenPanel', 'NSAppleScript Additions', 'NSOutlineView', + 'NSApplication', 'NSPageLayout', 'NSArrayController', 'NSPanel', + 'NSATSTypesetter', 'NSParagraphStyle', 'NSPasteboard', 'NSBezierPath', + 'NSPDFImageRep', 'NSBitmapImageRep', 'NSPICTImageRep', 'NSBox', 'NSPopUpButton', + 'NSBrowser', 'NSPopUpButtonCell', 'NSBrowserCell', 'NSPrinter', 'NSPrintInfo', + 'NSButton', 'NSPrintOperation', 'NSButtonCell', 'NSPrintPanel', 'NSCachedImageRep', + 'NSProgressIndicator', 'NSCell', 'NSQuickDrawView', 'NSClipView', 'NSResponder', + 'NSRulerMarker', 'NSColor', 'NSRulerView', 'NSColorList', 'NSSavePanel', + 'NSColorPanel', 'NSScreen', 'NSColorPicker', 'NSScroller', 'NSColorWell', + 'NSScrollView', 'NSComboBox', 'NSSearchField', 'NSComboBoxCell', + 'NSSearchFieldCell', 'NSControl', 'NSSecureTextField', 'NSController', + 'NSSecureTextFieldCell', 'NSCursor', 'NSSegmentedCell', 'NSCustomImageRep', + 'NSSegmentedControl', 'NSDocument', 'NSShadow', 'NSDocumentController', + 'NSSimpleHorizontalTypesetter', 'NSDrawer', 'NSSlider', 'NSEPSImageRep', + 'NSSliderCell', 'NSEvent', 'NSSound', 'NSFileWrapper', 'NSSpeechRecognizer', + 'NSFont', 'NSSpeechSynthesizer', 'NSFontDescriptor', 'NSSpellChecker', + 'NSFontManager', 'NSSplitView', 'NSFontPanel', 'NSStatusBar', 'NSForm', + 'NSStatusItem', 'NSFormCell', 'NSStepper', 'NSGlyphGenerator', 'NSStepperCell', + 'NSGlyphInfo', 'NSGraphicsContext', 'NSTableColumn', 'NSHelpManager', + 'NSTableHeaderCell', 'NSImage', 'NSTableHeaderView', 'NSImageCell', 'NSTableView', + 'NSImageRep', 'NSTabView', 'NSImageView', 'NSTabViewItem', 'NSInputManager', + 'NSText', 'NSInputServer', 'NSTextAttachment', 'NSLayoutManager', + 'NSTextAttachmentCell', 'NSMatrix', 'NSTextContainer', 'NSMenu', 'NSTextField', + 'NSMenuItem', 'NSTextFieldCell', 'NSMenuItemCell', 'NSTextStorage', 'NSMenuView', + 'NSTextTab', 'NSMovie', 'NSTextView', 'NSMovieView', 'NSToolbar', 'NSToolbarItem', + 'NSMutableParagraphStyle', 'NSTypesetter', 'NSNib', 'NSNibConnector', + 'NSUserDefaultsController', 'NSNibControlConnector', 'NSView', + 'NSNibOutletConnector', 'NSWindow', 'NSObjectController', 'NSWindowController', + 'NSOpenGLContext', 'NSWorkspace', 'NSOpenGLPixelBuffer' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '=', '+', '-', '*', '/', '!', '%', '^', '&', ':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0000ff;', + 2 => 'color: #0000ff;', + 3 => 'color: #0000dd;', + 4 => 'color: #0000ff;', + 5 => 'color: #0000ff;', + 6 => 'color: #0000ff;' + ), + 'COMMENTS' => array( + 1 => 'color: #ff0000;', + 2 => 'color: #339900;', + 'MULTI' => 'color: #ff0000; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #666666; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #002200;' + ), + 'STRINGS' => array( + 0 => 'color: #666666;' + ), + 'NUMBERS' => array( + 0 => 'color: #0000dd;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #002200;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAME}.html', + 4 => '', + 5 => 'http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/{FNAME}.html', + 6 => 'http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/{FNAME}.html' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/ocaml-brief.php b/plugins/dokuwiki/inc/geshi/ocaml-brief.php new file mode 100644 index 0000000..940bd53 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/ocaml-brief.php @@ -0,0 +1,114 @@ + 'OCaml', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array('(*' => '*)'), + 'CASE_KEYWORDS' => 0, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => "", + 'KEYWORDS' => array( + /* main OCaml keywords */ + 1 => array( + 'and', 'As', 'asr', 'begin', 'Class', 'Closed', 'constraint', 'do', 'done', 'downto', 'else', + 'end', 'exception', 'external', 'failwith', 'false', 'flush', 'for', 'fun', 'function', 'functor', + 'if', 'in', 'include', 'inherit', 'incr', 'land', 'let', 'load', 'los', 'lsl', 'lsr', 'lxor', + 'match', 'method', 'mod', 'module', 'mutable', 'new', 'not', 'of', 'open', 'option', 'or', 'parser', + 'private', 'ref', 'rec', 'raise', 'regexp', 'sig', 'struct', 'stdout', 'stdin', 'stderr', 'then', + 'to', 'true', 'try', 'type', 'val', 'virtual', 'when', 'while', 'with' + ) + ), + /* highlighting symbols is really important in OCaml */ + 'SYMBOLS' => array( + ';', '!', ':', '.', '=', '%', '^', '*', '-', '/', '+', + '>', '<', '(', ')', '[', ']', '&', '|', '#', "'" + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #06c; font-weight: bold;' /* nice blue */ + ), + 'COMMENTS' => array( + 'MULTI' => 'color: #5d478b; font-style: italic;' /* light purple */ + ), + 'ESCAPE_CHAR' => array( + ), + 'BRACKETS' => array( + 0 => 'color: #6c6;' + ), + 'STRINGS' => array( + 0 => 'color: #3cb371;' /* nice green */ + ), + 'NUMBERS' => array( + 0 => 'color: #c6c;' /* pink */ + ), + 'METHODS' => array( + 1 => 'color: #060;' /* dark green */ + ), + 'REGEXPS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #a52a2a;' /* maroon */ + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/ocaml.php b/plugins/dokuwiki/inc/geshi/ocaml.php new file mode 100644 index 0000000..013cac3 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/ocaml.php @@ -0,0 +1,163 @@ + 'OCaml', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array('(*' => '*)'), + 'CASE_KEYWORDS' => 0, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => "", + 'KEYWORDS' => array( + /* main OCaml keywords */ + 1 => array( + 'and', 'As', 'asr', 'begin', 'Class', 'Closed', 'constraint', 'do', 'done', 'downto', 'else', + 'end', 'exception', 'external', 'failwith', 'false', 'flush', 'for', 'fun', 'function', 'functor', + 'if', 'in', 'include', 'inherit', 'incr', 'land', 'let', 'load', 'los', 'lsl', 'lsr', 'lxor', + 'match', 'method', 'mod', 'module', 'mutable', 'new', 'not', 'of', 'open', 'option', 'or', 'parser', + 'private', 'ref', 'rec', 'raise', 'regexp', 'sig', 'struct', 'stdout', 'stdin', 'stderr', 'then', + 'to', 'true', 'try', 'type', 'val', 'virtual', 'when', 'while', 'with' + ), + /* define names of main librarys, so we can link to it */ + 2 => array( + 'Arg', 'Arith_status', 'Array', 'ArrayLabels', 'Big_int', 'Bigarray', 'Buffer', 'Callback', + 'CamlinternalOO', 'Char', 'Complex', 'Condition', 'Dbm', 'Digest', 'Dynlink', 'Event', + 'Filename', 'Format', 'Gc', 'Genlex', 'Graphics', 'GraphicsX11', 'Hashtbl', 'Int32', 'Int64', + 'Lazy', 'Lexing', 'List', 'ListLabels', 'Map', 'Marshal', 'MoreLabels', 'Mutex', 'Nativeint', + 'Num', 'Obj', 'Oo', 'Parsing', 'Pervasives', 'Printexc', 'Printf', 'Queue', 'Random', 'Scanf', + 'Set', 'Sort', 'Stack', 'StdLabels', 'Str', 'Stream', 'String', 'StringLabels', 'Sys', 'Thread', + 'ThreadUnix', 'Tk' + ), + /* just link to the Pervasives functions library, cause it's the default opened library when starting OCaml */ + 3 => array( + 'raise', 'invalid_arg', 'failwith', 'compare', 'min', 'max', 'succ', 'pred', 'mod', 'abs', + 'max_int', 'min_int', 'sqrt', 'exp', 'log', 'log10', 'cos', 'sin', 'tan', 'acos', 'asin', + 'atan', 'atan2', 'cosh', 'sinh', 'tanh', 'ceil', 'floor', 'abs_float', 'mod_float', 'frexp', + 'ldexp', 'modf', 'float', 'float_of_int', 'truncate', 'int_of_float', 'infinity', 'nan', + 'max_float', 'min_float', 'epsilon_float', 'classify_float', 'int_of_char', 'char_of_int', + 'ignore', 'string_of_bool', 'bool_of_string', 'string_of_int', 'int_of_string', + 'string_of_float', 'float_of_string', 'fst', 'snd', 'stdin', 'stdout', 'stderr', 'print_char', + 'print_string', 'print_int', 'print_float', 'print_endline', 'print_newline', 'prerr_char', + 'prerr_string', 'prerr_int', 'prerr_float', 'prerr_endline', 'prerr_newline', 'read_line', + 'read_int', 'read_float', 'open_out', 'open_out_bin', 'open_out_gen', 'flush', 'flush_all', + 'output_char', 'output_string', 'output', 'output_byte', 'output_binary_int', 'output_value', + 'seek_out', 'pos_out', 'out_channel_length', 'close_out', 'close_out_noerr', 'set_binary_mode_out', + 'open_in', 'open_in_bin', 'open_in_gen', 'input_char', 'input_line', 'input', 'really_input', + 'input_byte', 'input_binary_int', 'input_value', 'seek_in', 'pos_in', 'in_channel_length', + 'close_in', 'close_in_noerr', 'set_binary_mode_in', 'incr', 'decr', 'string_of_format', + 'format_of_string', 'exit', 'at_exit' + ), + /* here Pervasives Types */ + 4 => array ( + 'fpclass', 'in_channel', 'out_channel', 'open_flag', 'Sys_error', 'ref', 'format' + ), + /* finally Pervasives Exceptions */ + 5 => array ( + 'Exit', 'Invalid_Argument', 'Failure', 'Division_by_zero' + ) + ), + /* highlighting symbols is really important in OCaml */ + 'SYMBOLS' => array( + ';', '!', ':', '.', '=', '%', '^', '*', '-', '/', '+', + '>', '<', '(', ')', '[', ']', '&', '|', '#', "'" + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => true, /* functions name are case seinsitive */ + 3 => true, /* types name too */ + 4 => true /* finally exceptions too */ + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #06c; font-weight: bold;' /* nice blue */ + ), + 'COMMENTS' => array( + 'MULTI' => 'color: #5d478b; font-style: italic;' /* light purple */ + ), + 'ESCAPE_CHAR' => array( + ), + 'BRACKETS' => array( + 0 => 'color: #6c6;' + ), + 'STRINGS' => array( + 0 => 'color: #3cb371;' /* nice green */ + ), + 'NUMBERS' => array( + 0 => 'color: #c6c;' /* pink */ + ), + 'METHODS' => array( + 1 => 'color: #060;' /* dark green */ + ), + 'REGEXPS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #a52a2a;' /* maroon */ + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + /* some of keywords are Pervasives functions (land, lxor, asr, ...) */ + 1 => '', + /* link to the wanted library */ + 2 => 'http://caml.inria.fr/pub/docs/manual-ocaml/libref/{FNAME}.html', + /* link to Pervasives functions */ + 3 => 'http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VAL{FNAME}', + /* link to Pervasives type */ + 4 => 'http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#TYPE{FNAME}', + /* link to Pervasives exceptions */ + 5 => 'http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#EXCEPTION{FNAME}' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/oobas.php b/plugins/dokuwiki/inc/geshi/oobas.php new file mode 100644 index 0000000..2be8fa6 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/oobas.php @@ -0,0 +1,132 @@ + 'OpenOffice.org Basic', + 'COMMENT_SINGLE' => array(1 => "'"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'dim','private','public','global','as','if','redim','true','set', + 'byval', + 'false','bool','double','integer','long','object','single','variant', + 'msgbox','print','inputbox','green','blue','red','qbcolor', + 'rgb','open','close','reset','freefile','get','input','line', + 'put','write','loc','seek','eof','lof','chdir','chdrive', + 'curdir','dir','fileattr','filecopy','filedatetime','fileexists', + 'filelen','getattr','kill','mkdir','name','rmdir','setattr', + 'dateserial','datevalue','day','month','weekday','year','cdatetoiso', + 'cdatefromiso','hour','minute','second','timeserial','timevalue', + 'date','now','time','timer','erl','err','error','on','error','goto','resume', + 'and','eqv','imp','not','or','xor','mod','','atn','cos','sin','tan','log', + 'exp','rnd','randomize','sqr','fix','int','abs','sgn','hex','oct', + 'it','then','else','select','case','iif','do','loop','for','next', + 'while','wend','gosub','return','goto','on','goto','call','choose','declare', + 'end','exit','freelibrary','function','rem','stop','sub','switch','with', + 'cbool','cdate','cdbl','cint','clng','const','csng','cstr','defbool', + 'defdate','defdbl','defint','deflng','asc','chr','str','val','cbyte', + 'space','string','format','lcase','left','lset','ltrim','mid','right', + 'rset','rtrim','trim','ucase','split','join','converttourl','convertfromurl', + 'instr','len','strcomp','beep','shell','wait','getsystemticks','environ', + 'getsolarversion','getguitype','twipsperpixelx','twipsperpixely', + 'createunostruct','createunoservice','getprocessservicemanager', + 'createunodialog','createunolistener','createunovalue','thiscomponent', + 'globalscope' + ) + ), + 'SYMBOLS' => array( + '(', ')', '=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/oracle8.php b/plugins/dokuwiki/inc/geshi/oracle8.php new file mode 100644 index 0000000..6ef798c --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/oracle8.php @@ -0,0 +1,489 @@ + 'Oracle 8 SQL', + 'COMMENT_SINGLE' => array(1 => '--'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_UPPER, + 'QUOTEMARKS' => array("'", '"', '`'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( +//Put your package names here - e.g. select distinct ''''|| lower(name) || ''',' from user_source; + 6 => array( + ), + +//Put your table names here - e.g. select distinct ''''|| lower(table_name) || ''',' from user_tables; + 5 => array( + ), + +//Put your view names here - e.g. select distinct ''''|| lower(view_name) || ''',' from user_views; + 4 => array( + ), + +//Put your table field names here - e.g. select distinct ''''|| lower(column_name) || ''',' from user_tab_columns; + 3 => array( + ), +//Put ORACLE reserved keywords here (8.1.7). I like mine uppercase. + 1 => array( + 'ABS', + 'ACCESS', + 'ACOS', + 'ADD', + 'ADD_MONTHS', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'ANY', + 'ARRAY', + 'AS', + 'ASC', + 'ASCII', + 'ASIN', + 'ASSOCIATE', + 'AT', + 'ATAN', + 'ATAN2', + 'AUDIT', + 'AUTHID', + 'AVG', + 'BEGIN', + 'BETWEEN', + 'BFILENAME', + 'BINARY_INTEGER', + 'BITAND', + 'BODY', + 'BOOLEAN', + 'BULK', + 'BY', + 'CALL', + 'CASCADE', + 'CASE', + 'CEIL', + 'CHAR', + 'CHAR_BASE', + 'CHARTOROWID', + 'CHECK', + 'CHR', + 'CLOSE', + 'CLUSTER', + 'COALESCE', + 'COLLECT', + 'COLUMN', + 'COMMENT', + 'COMMIT', + 'COMPRESS', + 'CONCAT', + 'CONNECT', + 'CONSTANT', + 'CONSTRAINT', + 'CONSTRAINTS', + 'CONTEXT', + 'CONTROLFILE', + 'CONVERT', + 'CORR', + 'COS', + 'COSH', + 'COST', + 'COUNT', + 'COVAR_POP', + 'COVAR_SAMP', + 'CREATE', + 'CUME_DIST', + 'CURRENT', + 'CURRVAL', + 'CURSOR', + 'DATABASE', + 'DATE', + 'DAY', + 'DECIMAL', + 'DECLARE', + 'DECODE', + 'DEFAULT', + 'DELETE', + 'DENSE_RANK', + 'DEREF', + 'DESC', + 'DIMENSION', + 'DIRECTORY', + 'DISASSOCIATE', + 'DISTINCT', + 'DO', + 'DROP', + 'DUMP', + 'ELSE', + 'ELSIF', + 'EMPTY_BLOB', + 'EMPTY_CLOB', + 'END', + 'EXCEPTION', + 'EXCLUSIVE', + 'EXEC', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'EXP', + 'EXPLAIN', + 'EXTENDS', + 'EXTRACT', + 'FALSE', + 'FETCH', + 'FILE', + 'FIRST_VALUE', + 'FLOAT', + 'FLOOR', + 'FOR', + 'FORALL', + 'FROM', + 'FUNCTION', + 'GOTO', + 'GRANT', + 'GREATEST', + 'GROUP', + 'GROUPING', + 'HAVING', + 'HEAP', + 'HEXTORAW', + 'HOUR', + 'IDENTIFIED', + 'IF', + 'IMMEDIATE', + 'IN', + 'INCREMENT', + 'INDEX', + 'INDEXTYPE', + 'INDICATOR', + 'INITCAP', + 'INITIAL', + 'INSERT', + 'INSTR', + 'INSTRB', + 'INTEGER', + 'INTERFACE', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'ISOLATION', + 'JAVA', + 'KEY', + 'LAG', + 'LAST_DAY', + 'LAST_VALUE', + 'LEAD', + 'LEAST', + 'LENGTH', + 'LENGTHB', + 'LEVEL', + 'LIBRARY', + 'LIKE', + 'LIMITED', + 'LINK', + 'LN', + 'LOCK', + 'LOG', + 'LONG', + 'LOOP', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MAKE_REF', + 'MATERIALIZED', + 'MAX', + 'MAXEXTENTS', + 'MIN', + 'MINUS', + 'MINUTE', + 'MLSLABEL', + 'MOD', + 'MODE', + 'MODIFY', + 'MONTH', + 'MONTHS_BETWEEN', + 'NATURAL', + 'NATURALN', + 'NEW', + 'NEW_TIME', + 'NEXT_DAY', + 'NEXTVAL', + 'NLS_CHARSET_DECL_LEN', + 'NLS_CHARSET_ID', + 'NLS_CHARSET_NAME', + 'NLS_INITCAP', + 'NLS_LOWER', + 'NLS_UPPER', + 'NLSSORT', + 'NOAUDIT', + 'NOCOMPRESS', + 'NOCOPY', + 'NOT', + 'NOWAIT', + 'NTILE', + 'NULL', + 'NULLIF', + 'NUMBER', + 'NUMBER_BASE', + 'NUMTODSINTERVAL', + 'NUMTOYMINTERVAL', + 'NVL', + 'NVL2', + 'OCIROWID', + 'OF', + 'OFFLINE', + 'ON', + 'ONLINE', + 'OPAQUE', + 'OPEN', + 'OPERATOR', + 'OPTION', + 'OR', + 'ORDER', + 'ORGANIZATION', + 'OTHERS', + 'OUT', + 'OUTLINE', + 'PACKAGE', + 'PARTITION', + 'PCTFREE', + 'PERCENT_RANK', + 'PLAN', + 'PLS_INTEGER', + 'POSITIVE', + 'POSITIVEN', + 'POWER', + 'PRAGMA', + 'PRIMARY', + 'PRIOR', + 'PRIVATE', + 'PRIVILEGES', + 'PROCEDURE', + 'PROFILE', + 'PUBLIC', + 'RAISE', + 'RANGE', + 'RANK', + 'RATIO_TO_REPORT', + 'RAW', + 'RAWTOHEX', + 'REAL', + 'RECORD', + 'REF', + 'REFTOHEX', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + 'RELEASE', + 'RENAME', + 'REPLACE', + 'RESOURCE', + 'RETURN', + 'RETURNING', + 'REVERSE', + 'REVOKE', + 'ROLE', + 'ROLLBACK', + 'ROUND', + 'ROW', + 'ROW_NUMBER', + 'ROWID', + 'ROWIDTOCHAR', + 'ROWNUM', + 'ROWS', + 'ROWTYPE', + 'RPAD', + 'RTRIM', + 'SAVEPOINT', + 'SCHEMA', + 'SECOND', + 'SEGMENT', + 'SELECT', + 'SEPERATE', + 'SEQUENCE', + 'SESSION', + 'SET', + 'SHARE', + 'SIGN', + 'SIN', + 'SINH', + 'SIZE', + 'SMALLINT', + 'SOUNDEX', + 'SPACE', + 'SQL', + 'SQLCODE', + 'SQLERRM', + 'SQRT', + 'START', + 'STATISTICS', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STOP', + 'SUBSTR', + 'SUBSTRB', + 'SUBTYPE', + 'SUCCESSFUL', + 'SUM', + 'SYNONYM', + 'SYS_CONTEXT', + 'SYS_GUID', + 'SYSDATE', + 'SYSTEM', + 'TABLE', + 'TABLESPACE', + 'TAN', + 'TANH', + 'TEMPORARY', + 'THEN', + 'TIME', + 'TIMESTAMP', + 'TIMEZONE_ABBR', + 'TIMEZONE_HOUR', + 'TIMEZONE_MINUTE', + 'TIMEZONE_REGION', + 'TIMING', + 'TO', + 'TO_CHAR', + 'TO_DATE', + 'TO_LOB', + 'TO_MULTI_BYTE', + 'TO_NUMBER', + 'TO_SINGLE_BYTE', + 'TRANSACTION', + 'TRANSLATE', + 'TRIGGER', + 'TRIM', + 'TRUE', + 'TRUNC', + 'TRUNCATE', + 'TYPE', + 'UI', + 'UID', + 'UNION', + 'UNIQUE', + 'UPDATE', + 'UPPER', + 'USE', + 'USER', + 'USERENV', + 'USING', + 'VALIDATE', + 'VALUE', + 'VALUES', + 'VAR_POP', + 'VAR_SAMP', + 'VARCHAR', + 'VARCHAR2', + 'VARIANCE', + 'VIEW', + 'VSIZE', + 'WHEN', + 'WHENEVER', + 'WHERE', + 'WHILE', + 'WITH', + 'WORK', + 'WRITE', + 'YEAR', + 'ZONE' + ) + ), + 'SYMBOLS' => array( + '(', ')', '=', '<', '>', '|' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #993333; font-weight: bold; text-transform: uppercase;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #ff0000;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + ), + + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/pascal.php b/plugins/dokuwiki/inc/geshi/pascal.php new file mode 100644 index 0000000..40f1c7b --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/pascal.php @@ -0,0 +1,145 @@ + 'Pascal', + 'COMMENT_SINGLE' => array(1 => '//'), + 'COMMENT_MULTI' => array('{' => '}','(*' => '*)'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'if', 'while', 'until', 'repeat', 'default', + 'do', 'else', 'for', 'switch', 'goto','label','asm','begin','end', + 'assembler','case', 'downto', 'to','div','mod','far','forward','in','inherited', + 'inline','interrupt','label','library','not','var','of','then','stdcall', + 'cdecl','end.','raise','try','except','name','finally','resourcestring','override','overload', + 'default','public','protected','private','property','published','stored','catch' + ), + 2 => array( + 'nil', 'false', 'break', 'true', 'function', 'procedure','implementation','interface', + 'unit','program','initialization','finalization','uses' + ), + 3 => array( + 'abs', 'absolute','and','arc','arctan','chr','constructor','destructor', + 'dispose','cos','eof','eoln','exp','get','index','ln','new','xor','write','writeln', + 'shr','sin','sqrt','succ','pred','odd','read','readln','ord','ordinal','blockread','blockwrite' + ), + 4 => array( + 'array', 'char', 'const', 'boolean', 'real', 'integer', 'longint', + 'word', 'shortint', 'record','byte','bytebool','string', + 'type','object','export','exports','external','file','longbool','pointer','set', + 'packed','ansistring','union' + ), + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => '', + 4 => 'color: #993333;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #339933;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #202020;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/perl.php b/plugins/dokuwiki/inc/geshi/perl.php new file mode 100644 index 0000000..6398f2c --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/perl.php @@ -0,0 +1,169 @@ + 'Perl', + 'COMMENT_SINGLE' => array(1 => '#'), + 'COMMENT_MULTI' => array( '=pod' => '=cut'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'HARDQUOTE' => array("'", "'"), // An optional 2-element array defining the beginning and end of a hard-quoted string + 'HARDESCAPE' => array('\\\'', "\\\\"), // Things that must still be escaped inside a hard-quoted string + // If HARDQUOTE is defined, HARDESCAPE must be defined + // This will not work unless the first character of each element is either in the + // QUOTEMARKS array or is the ESCAPE_CHAR + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'case', 'do', 'else', 'elsif', 'for', 'if', 'then', 'until', 'while', 'foreach', 'my', + 'or', 'and', 'unless', 'next', 'last', 'redo', 'not', 'our', + 'reset', 'continue','and', 'cmp', 'ne' + ), + 2 => array( + 'use', 'sub', 'new', '__END__', '__DATA__', '__DIE__', '__WARN__', 'BEGIN', + 'STDIN', 'STDOUT', 'STDERR' + ), + 3 => array( + 'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless', + 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr', + 'chroot', 'close', 'closedir', 'connect', 'continue', 'cos', + 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die', + 'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent', + 'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit', + 'exp', 'fcntl', 'fileno', 'flock', 'fork', 'format', 'formline', + 'getc', 'getgrent', 'getgrgid', 'getgrnam', 'gethostbyaddr', + 'gethostbyname', 'gethostent', 'getlogin', 'getnetbyaddr', 'getnetbyname', + 'getnetent', 'getpeername', 'getpgrp', 'getppid', 'getpriority', + 'getprotobyname', 'getprotobynumber', 'getprotoent', 'getpwent', + 'getpwnam', 'getpwuid', 'getservbyname', 'getservbyport', 'getservent', + 'getsockname', 'getsockopt', 'glob', 'gmtime', 'goto', 'grep', + 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill', + 'last', 'lc', 'lcfirst', 'length', 'link', 'listen', 'local', + 'localtime', 'log', 'lstat', 'm', 'map', 'mkdir', 'msgctl', 'msgget', + 'msgrcv', 'msgsnd', 'my', 'next', 'no', 'oct', 'open', 'opendir', + 'ord', 'our', 'pack', 'package', 'pipe', 'pop', 'pos', 'print', + 'printf', 'prototype', 'push', 'qq', 'qr', 'quotemeta', 'qw', + 'qx', 'q', 'rand', 'read', 'readdir', 'readline', 'readlink', 'readpipe', + 'recv', 'redo', 'ref', 'rename', 'require', 'return', + 'reverse', 'rewinddir', 'rindex', 'rmdir', 's', 'scalar', 'seek', + 'seekdir', 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', + 'sethostent', 'setnetent', 'setpgrp', 'setpriority', 'setprotoent', + 'setpwent', 'setservent', 'setsockopt', 'shift', 'shmctl', 'shmget', + 'shmread', 'shmwrite', 'shutdown', 'sin', 'sleep', 'socket', 'socketpair', + 'sort', 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat', + 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread', + 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied', + 'time', 'times', 'tr', 'truncate', 'uc', 'ucfirst', 'umask', 'undef', + 'unlink', 'unpack', 'unshift', 'untie', 'utime', 'values', + 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write', 'y' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '!', '@', '%', '&', '*', '|', '/', '<', '>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => true, + 2 => true, + 3 => true, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0000ff;', + 4 => 'color: #009999;', + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 3 => 'http://www.perldoc.com/perl5.6/pod/func/{FNAME}.html' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '->', + 2 => '::' + ), + 'REGEXPS' => array( + 0 => '[\\$%@]+[a-zA-Z_][a-zA-Z0-9_]*', + 4 => '<[a-zA-Z_][a-zA-Z0-9_]*>', + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/php-brief.php b/plugins/dokuwiki/inc/geshi/php-brief.php new file mode 100644 index 0000000..6527112 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/php-brief.php @@ -0,0 +1,162 @@ + 'PHP', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'include', 'require', 'include_once', 'require_once', + 'for', 'as', 'foreach', 'if', 'elseif', 'else', 'while', 'do', 'endwhile', 'endif', 'switch', 'case', 'endswitch', + 'return', 'break' + ), + 2 => array( + 'null', '__LINE__', '__FILE__', + 'false', '<?php', '?>', + 'true', 'var', 'default', + 'function', 'class', 'new', '&new', 'public', 'private', 'interface', 'extends', + ), + 3 => array( + 'func_num_args', 'func_get_arg', 'func_get_args', 'strlen', 'strcmp', 'strncmp', 'strcasecmp', 'strncasecmp', 'each', 'error_reporting', 'define', 'defined', + 'trigger_error', 'user_error', 'set_error_handler', 'restore_error_handler', 'get_declared_classes', 'get_loaded_extensions', + 'extension_loaded', 'get_extension_funcs', 'debug_backtrace', + 'constant', 'bin2hex', 'sleep', 'usleep', 'time', 'mktime', 'gmmktime', 'strftime', 'gmstrftime', 'strtotime', 'date', 'gmdate', 'getdate', 'localtime', 'checkdate', 'flush', 'wordwrap', 'htmlspecialchars', 'htmlentities', 'html_entity_decode', 'md5', 'md5_file', 'crc32', 'getimagesize', 'image_type_to_mime_type', 'phpinfo', 'phpversion', 'phpcredits', 'strnatcmp', 'strnatcasecmp', 'substr_count', 'strspn', 'strcspn', 'strtok', 'strtoupper', 'strtolower', 'strpos', 'strrpos', 'strrev', 'hebrev', 'hebrevc', 'nl2br', 'basename', 'dirname', 'pathinfo', 'stripslashes', 'stripcslashes', 'strstr', 'stristr', 'strrchr', 'str_shuffle', 'str_word_count', 'strcoll', 'substr', 'substr_replace', 'quotemeta', 'ucfirst', 'ucwords', 'strtr', 'addslashes', 'addcslashes', 'rtrim', 'str_replace', 'str_repeat', 'count_chars', 'chunk_split', 'trim', 'ltrim', 'strip_tags', 'similar_text', 'explode', 'implode', 'setlocale', 'localeconv', + 'parse_str', 'str_pad', 'chop', 'strchr', 'sprintf', 'printf', 'vprintf', 'vsprintf', 'sscanf', 'fscanf', 'parse_url', 'urlencode', 'urldecode', 'rawurlencode', 'rawurldecode', 'readlink', 'linkinfo', 'link', 'unlink', 'exec', 'system', 'escapeshellcmd', 'escapeshellarg', 'passthru', 'shell_exec', 'proc_open', 'proc_close', 'rand', 'srand', 'getrandmax', 'mt_rand', 'mt_srand', 'mt_getrandmax', 'base64_decode', 'base64_encode', 'abs', 'ceil', 'floor', 'round', 'is_finite', 'is_nan', 'is_infinite', 'bindec', 'hexdec', 'octdec', 'decbin', 'decoct', 'dechex', 'base_convert', 'number_format', 'fmod', 'ip2long', 'long2ip', 'getenv', 'putenv', 'getopt', 'microtime', 'gettimeofday', 'getrusage', 'uniqid', 'quoted_printable_decode', 'set_time_limit', 'get_cfg_var', 'magic_quotes_runtime', 'set_magic_quotes_runtime', 'get_magic_quotes_gpc', 'get_magic_quotes_runtime', + 'import_request_variables', 'error_log', 'serialize', 'unserialize', 'memory_get_usage', 'var_dump', 'var_export', 'debug_zval_dump', 'print_r','highlight_file', 'show_source', 'highlight_string', 'ini_get', 'ini_get_all', 'ini_set', 'ini_alter', 'ini_restore', 'get_include_path', 'set_include_path', 'restore_include_path', 'setcookie', 'header', 'headers_sent', 'connection_aborted', 'connection_status', 'ignore_user_abort', 'parse_ini_file', 'is_uploaded_file', 'move_uploaded_file', 'intval', 'floatval', 'doubleval', 'strval', 'gettype', 'settype', 'is_null', 'is_resource', 'is_bool', 'is_long', 'is_float', 'is_int', 'is_integer', 'is_double', 'is_real', 'is_numeric', 'is_string', 'is_array', 'is_object', 'is_scalar', + 'ereg', 'ereg_replace', 'eregi', 'eregi_replace', 'split', 'spliti', 'join', 'sql_regcase', 'dl', 'pclose', 'popen', 'readfile', 'rewind', 'rmdir', 'umask', 'fclose', 'feof', 'fgetc', 'fgets', 'fgetss', 'fread', 'fopen', 'fpassthru', 'ftruncate', 'fstat', 'fseek', 'ftell', 'fflush', 'fwrite', 'fputs', 'mkdir', 'rename', 'copy', 'tempnam', 'tmpfile', 'file', 'file_get_contents', 'stream_select', 'stream_context_create', 'stream_context_set_params', 'stream_context_set_option', 'stream_context_get_options', 'stream_filter_prepend', 'stream_filter_append', 'fgetcsv', 'flock', 'get_meta_tags', 'stream_set_write_buffer', 'set_file_buffer', 'set_socket_blocking', 'stream_set_blocking', 'socket_set_blocking', 'stream_get_meta_data', 'stream_register_wrapper', 'stream_wrapper_register', 'stream_set_timeout', 'socket_set_timeout', 'socket_get_status', 'realpath', 'fnmatch', 'fsockopen', 'pfsockopen', 'pack', 'unpack', 'get_browser', 'crypt', 'opendir', 'closedir', 'chdir', 'getcwd', 'rewinddir', 'readdir', 'dir', 'glob', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'file_exists', 'is_writable', 'is_writeable', 'is_readable', 'is_executable', 'is_file', 'is_dir', 'is_link', 'stat', 'lstat', 'chown', + 'touch', 'clearstatcache', 'mail', 'ob_start', 'ob_flush', 'ob_clean', 'ob_end_flush', 'ob_end_clean', 'ob_get_flush', 'ob_get_clean', 'ob_get_length', 'ob_get_level', 'ob_get_status', 'ob_get_contents', 'ob_implicit_flush', 'ob_list_handlers', 'ksort', 'krsort', 'natsort', 'natcasesort', 'asort', 'arsort', 'sort', 'rsort', 'usort', 'uasort', 'uksort', 'shuffle', 'array_walk', 'count', 'end', 'prev', 'next', 'reset', 'current', 'key', 'min', 'max', 'in_array', 'array_search', 'extract', 'compact', 'array_fill', 'range', 'array_multisort', 'array_push', 'array_pop', 'array_shift', 'array_unshift', 'array_splice', 'array_slice', 'array_merge', 'array_merge_recursive', 'array_keys', 'array_values', 'array_count_values', 'array_reverse', 'array_reduce', 'array_pad', 'array_flip', 'array_change_key_case', 'array_rand', 'array_unique', 'array_intersect', 'array_intersect_assoc', 'array_diff', 'array_diff_assoc', 'array_sum', 'array_filter', 'array_map', 'array_chunk', 'array_key_exists', 'pos', 'sizeof', 'key_exists', 'assert', 'assert_options', 'version_compare', 'ftok', 'str_rot13', 'aggregate', + 'session_name', 'session_module_name', 'session_save_path', 'session_id', 'session_regenerate_id', 'session_decode', 'session_register', 'session_unregister', 'session_is_registered', 'session_encode', + 'session_start', 'session_destroy', 'session_unset', 'session_set_save_handler', 'session_cache_limiter', 'session_cache_expire', 'session_set_cookie_params', 'session_get_cookie_params', 'session_write_close', 'preg_match', 'preg_match_all', 'preg_replace', 'preg_replace_callback', 'preg_split', 'preg_quote', 'preg_grep', 'overload', 'ctype_alnum', 'ctype_alpha', 'ctype_cntrl', 'ctype_digit', 'ctype_lower', 'ctype_graph', 'ctype_print', 'ctype_punct', 'ctype_space', 'ctype_upper', 'ctype_xdigit', 'virtual', 'apache_request_headers', 'apache_note', 'apache_lookup_uri', 'apache_child_terminate', 'apache_setenv', 'apache_response_headers', 'apache_get_version', 'getallheaders', 'mysql_connect', 'mysql_pconnect', 'mysql_close', 'mysql_select_db', 'mysql_create_db', 'mysql_drop_db', 'mysql_query', 'mysql_unbuffered_query', 'mysql_db_query', 'mysql_list_dbs', 'mysql_list_tables', 'mysql_list_fields', 'mysql_list_processes', 'mysql_error', 'mysql_errno', 'mysql_affected_rows', 'mysql_insert_id', 'mysql_result', 'mysql_num_rows', 'mysql_num_fields', 'mysql_fetch_row', 'mysql_fetch_array', 'mysql_fetch_assoc', 'mysql_fetch_object', 'mysql_data_seek', 'mysql_fetch_lengths', 'mysql_fetch_field', 'mysql_field_seek', 'mysql_free_result', 'mysql_field_name', 'mysql_field_table', 'mysql_field_len', 'mysql_field_type', 'mysql_field_flags', 'mysql_escape_string', 'mysql_real_escape_string', 'mysql_stat', + 'mysql_thread_id', 'mysql_client_encoding', 'mysql_get_client_info', 'mysql_get_host_info', 'mysql_get_proto_info', 'mysql_get_server_info', 'mysql_info', 'mysql', 'mysql_fieldname', 'mysql_fieldtable', 'mysql_fieldlen', 'mysql_fieldtype', 'mysql_fieldflags', 'mysql_selectdb', 'mysql_createdb', 'mysql_dropdb', 'mysql_freeresult', 'mysql_numfields', 'mysql_numrows', 'mysql_listdbs', 'mysql_listtables', 'mysql_listfields', 'mysql_db_name', 'mysql_dbname', 'mysql_tablename', 'mysql_table_name', 'pg_connect', 'pg_pconnect', 'pg_close', 'pg_connection_status', 'pg_connection_busy', 'pg_connection_reset', 'pg_host', 'pg_dbname', 'pg_port', 'pg_tty', 'pg_options', 'pg_ping', 'pg_query', 'pg_send_query', 'pg_cancel_query', 'pg_fetch_result', 'pg_fetch_row', 'pg_fetch_assoc', 'pg_fetch_array', 'pg_fetch_object', 'pg_fetch_all', 'pg_affected_rows', 'pg_get_result', 'pg_result_seek', 'pg_result_status', 'pg_free_result', 'pg_last_oid', 'pg_num_rows', 'pg_num_fields', 'pg_field_name', 'pg_field_num', 'pg_field_size', 'pg_field_type', 'pg_field_prtlen', 'pg_field_is_null', 'pg_get_notify', 'pg_get_pid', 'pg_result_error', 'pg_last_error', 'pg_last_notice', 'pg_put_line', 'pg_end_copy', 'pg_copy_to', 'pg_copy_from', + 'pg_trace', 'pg_untrace', 'pg_lo_create', 'pg_lo_unlink', 'pg_lo_open', 'pg_lo_close', 'pg_lo_read', 'pg_lo_write', 'pg_lo_read_all', 'pg_lo_import', 'pg_lo_export', 'pg_lo_seek', 'pg_lo_tell', 'pg_escape_string', 'pg_escape_bytea', 'pg_unescape_bytea', 'pg_client_encoding', 'pg_set_client_encoding', 'pg_meta_data', 'pg_convert', 'pg_insert', 'pg_update', 'pg_delete', 'pg_select', 'pg_exec', 'pg_getlastoid', 'pg_cmdtuples', 'pg_errormessage', 'pg_numrows', 'pg_numfields', 'pg_fieldname', 'pg_fieldsize', 'pg_fieldtype', 'pg_fieldnum', 'pg_fieldprtlen', 'pg_fieldisnull', 'pg_freeresult', 'pg_result', 'pg_loreadall', 'pg_locreate', 'pg_lounlink', 'pg_loopen', 'pg_loclose', 'pg_loread', 'pg_lowrite', 'pg_loimport', 'pg_loexport', + 'echo', 'print', 'global', 'static', 'exit', 'array', 'empty', 'eval', 'isset', 'unset', 'die' + ) + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0000ff;' + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + 3 => '' + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.php.net/{FNAME}', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '->', + 2 => '::' + ), + 'REGEXPS' => array( + 0 => "[\\$]{1,2}[a-zA-Z_][a-zA-Z0-9_]*" + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, + 'SCRIPT_DELIMITERS' => array( + ' '?>', + ' '?>', + '<%' => '%>', + '' + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true, + 2 => true, + 3 => true + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/php.php b/plugins/dokuwiki/inc/geshi/php.php new file mode 100644 index 0000000..9a3b7c1 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/php.php @@ -0,0 +1,356 @@ + 'PHP', + 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'include', 'require', 'include_once', 'require_once', + 'for', 'foreach', 'as', 'if', 'elseif', 'else', 'while', 'do', 'endwhile', + 'endif', 'switch', 'case', 'endswitch', 'endfor', 'endforeach', + 'return', 'break', 'continue' + ), + 2 => array( + 'null', '__LINE__', '__FILE__', + 'false', '<?php', '?>', '<?', + '<script language', '</script>', + 'true', 'var', 'default', + 'function', 'class', 'new', '&new', 'public', 'private', 'interface', 'extends', + '__FUNCTION__', '__CLASS__', '__METHOD__', 'PHP_VERSION', + 'PHP_OS', 'DEFAULT_INCLUDE_PATH', 'PEAR_INSTALL_DIR', 'PEAR_EXTENSION_DIR', + 'PHP_EXTENSION_DIR', 'PHP_BINDIR', 'PHP_LIBDIR', 'PHP_DATADIR', 'PHP_SYSCONFDIR', + 'PHP_LOCALSTATEDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_OUTPUT_HANDLER_START', 'PHP_OUTPUT_HANDLER_CONT', + 'PHP_OUTPUT_HANDLER_END', 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE', + 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR', + 'E_USER_WARNING', 'E_USER_NOTICE', 'E_ALL' + ), + 3 => array( + 'zlib_get_coding_type','zend_version','zend_logo_guid','yp_order','yp_next', + 'yp_match','yp_master','yp_get_default_domain','yp_first','yp_errno','yp_err_string', + 'yp_cat','yp_all','xml_set_unparsed_entity_decl_handler','xml_set_start_namespace_decl_handler','xml_set_processing_instruction_handler','xml_set_object', + 'xml_set_notation_decl_handler','xml_set_external_entity_ref_handler','xml_set_end_namespace_decl_handler','xml_set_element_handler','xml_set_default_handler','xml_set_character_data_handler', + 'xml_parser_set_option','xml_parser_get_option','xml_parser_free','xml_parser_create_ns','xml_parser_create','xml_parse_into_struct', + 'xml_parse','xml_get_error_code','xml_get_current_line_number','xml_get_current_column_number','xml_get_current_byte_index','xml_error_string', + 'wordwrap','wddx_serialize_vars','wddx_serialize_value','wddx_packet_start','wddx_packet_end','wddx_deserialize', + 'wddx_add_vars','vsprintf','vprintf','virtual','version_compare','var_export', + 'var_dump','utf8_encode','utf8_decode','usort','usleep','user_error', + 'urlencode','urldecode','unserialize','unregister_tick_function','unpack','unlink', + 'unixtojd','uniqid','umask','uksort','ucwords','ucfirst', + 'uasort','trim','trigger_error','touch','token_name','token_get_all', + 'tmpfile','time','textdomain','tempnam','tanh','tan', + 'system','syslog','symlink','substr_replace','substr_count','substr', + 'strval','strtr','strtoupper','strtotime','strtolower','strtok', + 'strstr','strspn','strrpos','strrev','strrchr','strpos', + 'strncmp','strncasecmp','strnatcmp','strnatcasecmp','strlen','stristr', + 'stripslashes','stripcslashes','strip_tags','strftime','stream_wrapper_register','stream_set_write_buffer', + 'stream_set_timeout','stream_set_blocking','stream_select','stream_register_wrapper','stream_get_meta_data','stream_filter_prepend', + 'stream_filter_append','stream_context_set_params','stream_context_set_option','stream_context_get_options','stream_context_create','strcspn', + 'strcoll','strcmp','strchr','strcasecmp','str_word_count','str_shuffle', + 'str_rot13','str_replace','str_repeat','str_pad','stat','sscanf', + 'srand','sqrt','sql_regcase','sprintf','spliti','split', + 'soundex','sort','socket_writev','socket_write','socket_strerror','socket_shutdown', + 'socket_setopt','socket_set_timeout','socket_set_option','socket_set_nonblock','socket_set_blocking','socket_set_block', + 'socket_sendto','socket_sendmsg','socket_send','socket_select','socket_recvmsg','socket_recvfrom', + 'socket_recv','socket_readv','socket_read','socket_listen','socket_last_error','socket_iovec_set', + 'socket_iovec_free','socket_iovec_fetch','socket_iovec_delete','socket_iovec_alloc','socket_iovec_add','socket_getsockname', + 'socket_getpeername','socket_getopt','socket_get_status','socket_get_option','socket_create_pair','socket_create_listen', + 'socket_create','socket_connect','socket_close','socket_clear_error','socket_bind','socket_accept', + 'sleep','sizeof','sinh','sin','similar_text','shuffle', + 'show_source','shmop_write','shmop_size','shmop_read','shmop_open','shmop_delete', + 'shmop_close','shm_remove_var','shm_remove','shm_put_var','shm_get_var','shm_detach', + 'shm_attach','shell_exec','sha1_file','sha1','settype','setlocale', + 'setcookie','set_time_limit','set_socket_blocking','set_magic_quotes_runtime','set_include_path','set_file_buffer', + 'set_error_handler','session_write_close','session_unset','session_unregister','session_start','session_set_save_handler', + 'session_set_cookie_params','session_save_path','session_register','session_regenerate_id','session_name','session_module_name', + 'session_is_registered','session_id','session_get_cookie_params','session_encode','session_destroy','session_decode', + 'session_cache_limiter','session_cache_expire','serialize','sem_remove','sem_release','sem_get', + 'sem_acquire','rtrim','rsort','round','rmdir','rewinddir', + 'rewind','restore_include_path','restore_error_handler','reset','rename','register_tick_function', + 'register_shutdown_function','realpath','readlink','readgzfile','readfile','readdir', + 'read_exif_data','rawurlencode','rawurldecode','range','rand','rad2deg', + 'quotemeta','quoted_printable_decode','putenv','proc_open','proc_close','printf', + 'print_r','prev','preg_split','preg_replace_callback','preg_replace','preg_quote', + 'preg_match_all','preg_match','preg_grep','pow','posix_uname','posix_ttyname', + 'posix_times','posix_strerror','posix_setuid','posix_setsid','posix_setpgid','posix_setgid', + 'posix_seteuid','posix_setegid','posix_mkfifo','posix_kill','posix_isatty','posix_getuid', + 'posix_getsid','posix_getrlimit','posix_getpwuid','posix_getpwnam','posix_getppid','posix_getpid', + 'posix_getpgrp','posix_getpgid','posix_getlogin','posix_getgroups','posix_getgrnam','posix_getgrgid', + 'posix_getgid','posix_geteuid','posix_getegid','posix_getcwd','posix_get_last_error','posix_errno', + 'posix_ctermid','pos','popen','pi','phpversion','phpinfo', + 'phpcredits','php_uname','php_sapi_name','php_logo_guid','php_ini_scanned_files','pg_update', + 'pg_untrace','pg_unescape_bytea','pg_tty','pg_trace','pg_setclientencoding','pg_set_client_encoding', + 'pg_send_query','pg_select','pg_result_status','pg_result_seek','pg_result_error','pg_result', + 'pg_query','pg_put_line','pg_port','pg_ping','pg_pconnect','pg_options', + 'pg_numrows','pg_numfields','pg_num_rows','pg_num_fields','pg_meta_data','pg_lowrite', + 'pg_lounlink','pg_loreadall','pg_loread','pg_loopen','pg_loimport','pg_loexport', + 'pg_locreate','pg_loclose','pg_lo_write','pg_lo_unlink','pg_lo_tell','pg_lo_seek', + 'pg_lo_read_all','pg_lo_read','pg_lo_open','pg_lo_import','pg_lo_export','pg_lo_create', + 'pg_lo_close','pg_last_oid','pg_last_notice','pg_last_error','pg_insert','pg_host', + 'pg_getlastoid','pg_get_result','pg_get_pid','pg_get_notify','pg_freeresult','pg_free_result', + 'pg_fieldtype','pg_fieldsize','pg_fieldprtlen','pg_fieldnum','pg_fieldname','pg_fieldisnull', + 'pg_field_type','pg_field_size','pg_field_prtlen','pg_field_num','pg_field_name','pg_field_is_null', + 'pg_fetch_row','pg_fetch_result','pg_fetch_object','pg_fetch_assoc','pg_fetch_array','pg_fetch_all', + 'pg_exec','pg_escape_string','pg_escape_bytea','pg_errormessage','pg_end_copy','pg_delete', + 'pg_dbname','pg_copy_to','pg_copy_from','pg_convert','pg_connection_status','pg_connection_reset', + 'pg_connection_busy','pg_connect','pg_cmdtuples','pg_close','pg_clientencoding','pg_client_encoding', + 'pg_cancel_query','pg_affected_rows','pfsockopen','pclose','pathinfo','passthru', + 'parse_url','parse_str','parse_ini_file','pack','overload','output_reset_rewrite_vars', + 'output_add_rewrite_var','ord','openssl_x509_read','openssl_x509_parse','openssl_x509_free','openssl_x509_export_to_file', + 'openssl_x509_export','openssl_x509_checkpurpose','openssl_x509_check_private_key','openssl_verify','openssl_sign','openssl_seal', + 'openssl_public_encrypt','openssl_public_decrypt','openssl_private_encrypt','openssl_private_decrypt','openssl_pkey_new','openssl_pkey_get_public', + 'openssl_pkey_get_private','openssl_pkey_free','openssl_pkey_export_to_file','openssl_pkey_export','openssl_pkcs7_verify','openssl_pkcs7_sign', + 'openssl_pkcs7_encrypt','openssl_pkcs7_decrypt','openssl_open','openssl_get_publickey','openssl_get_privatekey','openssl_free_key', + 'openssl_error_string','openssl_csr_sign','openssl_csr_new','openssl_csr_export_to_file','openssl_csr_export','openlog', + 'opendir','octdec','ob_start','ob_list_handlers','ob_implicit_flush','ob_iconv_handler', + 'ob_gzhandler','ob_get_status','ob_get_level','ob_get_length','ob_get_flush','ob_get_contents', + 'ob_get_clean','ob_flush','ob_end_flush','ob_end_clean','ob_clean','number_format', + 'nl_langinfo','nl2br','ngettext','next','natsort','natcasesort', + 'mysql_unbuffered_query','mysql_thread_id','mysql_tablename','mysql_table_name','mysql_stat','mysql_selectdb', + 'mysql_select_db','mysql_result','mysql_real_escape_string','mysql_query','mysql_ping','mysql_pconnect', + 'mysql_numrows','mysql_numfields','mysql_num_rows','mysql_num_fields','mysql_listtables','mysql_listfields', + 'mysql_listdbs','mysql_list_tables','mysql_list_processes','mysql_list_fields','mysql_list_dbs','mysql_insert_id', + 'mysql_info','mysql_get_server_info','mysql_get_proto_info','mysql_get_host_info','mysql_get_client_info','mysql_freeresult', + 'mysql_free_result','mysql_fieldtype','mysql_fieldtable','mysql_fieldname','mysql_fieldlen','mysql_fieldflags', + 'mysql_field_type','mysql_field_table','mysql_field_seek','mysql_field_name','mysql_field_len','mysql_field_flags', + 'mysql_fetch_row','mysql_fetch_object','mysql_fetch_lengths','mysql_fetch_field','mysql_fetch_assoc','mysql_fetch_array', + 'mysql_escape_string','mysql_error','mysql_errno','mysql_dropdb','mysql_drop_db','mysql_dbname', + 'mysql_db_query','mysql_db_name','mysql_data_seek','mysql_createdb','mysql_create_db','mysql_connect', + 'mysql_close','mysql_client_encoding','mysql_affected_rows','mysql','mt_srand','mt_rand', + 'mt_getrandmax','move_uploaded_file','money_format','mktime','mkdir','min', + 'microtime','method_exists','metaphone','memory_get_usage','md5_file','md5', + 'mbsubstr','mbstrrpos','mbstrpos','mbstrlen','mbstrcut','mbsplit', + 'mbregex_encoding','mberegi_replace','mberegi','mbereg_search_setpos','mbereg_search_regs','mbereg_search_pos', + 'mbereg_search_init','mbereg_search_getregs','mbereg_search_getpos','mbereg_search','mbereg_replace','mbereg_match', + 'mbereg','mb_substr_count','mb_substr','mb_substitute_character','mb_strwidth','mb_strtoupper', + 'mb_strtolower','mb_strrpos','mb_strpos','mb_strlen','mb_strimwidth','mb_strcut', + 'mb_split','mb_send_mail','mb_regex_set_options','mb_regex_encoding','mb_preferred_mime_name','mb_parse_str', + 'mb_output_handler','mb_language','mb_internal_encoding','mb_http_output','mb_http_input','mb_get_info', + 'mb_eregi_replace','mb_eregi','mb_ereg_search_setpos','mb_ereg_search_regs','mb_ereg_search_pos','mb_ereg_search_init', + 'mb_ereg_search_getregs','mb_ereg_search_getpos','mb_ereg_search','mb_ereg_replace','mb_ereg_match','mb_ereg', + 'mb_encode_numericentity','mb_encode_mimeheader','mb_detect_order','mb_detect_encoding','mb_decode_numericentity','mb_decode_mimeheader', + 'mb_convert_variables','mb_convert_kana','mb_convert_encoding','mb_convert_case','max','mail', + 'magic_quotes_runtime','ltrim','lstat','long2ip','log1p','log10', + 'log','localtime','localeconv','linkinfo','link','levenshtein', + 'lcg_value','ksort','krsort','key_exists','key','juliantojd', + 'join','jewishtojd','jdtounix','jdtojulian','jdtojewish','jdtogregorian', + 'jdtofrench','jdmonthname','jddayofweek','is_writeable','is_writable','is_uploaded_file', + 'is_subclass_of','is_string','is_scalar','is_resource','is_real','is_readable', + 'is_object','is_numeric','is_null','is_nan','is_long','is_link', + 'is_integer','is_int','is_infinite','is_float','is_finite','is_file', + 'is_executable','is_double','is_dir','is_callable','is_bool','is_array', + 'is_a','iptcparse','iptcembed','ip2long','intval','ini_set', + 'ini_restore','ini_get_all','ini_get','ini_alter','in_array','import_request_variables', + 'implode','image_type_to_mime_type','ignore_user_abort','iconv_set_encoding','iconv_get_encoding','iconv', + 'i18n_mime_header_encode','i18n_mime_header_decode','i18n_ja_jp_hantozen','i18n_internal_encoding','i18n_http_output','i18n_http_input', + 'i18n_discover_encoding','i18n_convert','hypot','htmlspecialchars','htmlentities','html_entity_decode', + 'highlight_string','highlight_file','hexdec','hebrevc','hebrev','headers_sent', + 'header','gzwrite','gzuncompress','gztell','gzseek','gzrewind', + 'gzread','gzputs','gzpassthru','gzopen','gzinflate','gzgetss', + 'gzgets','gzgetc','gzfile','gzeof','gzencode','gzdeflate', + 'gzcompress','gzclose','gregoriantojd','gmstrftime','gmmktime','gmdate', + 'glob','gettype','gettimeofday','gettext','getservbyport','getservbyname', + 'getrusage','getrandmax','getprotobynumber','getprotobyname','getopt','getmyuid', + 'getmypid','getmyinode','getmygid','getmxrr','getlastmod','getimagesize', + 'gethostbynamel','gethostbyname','gethostbyaddr','getenv','getdate','getcwd', + 'getallheaders','get_resource_type','get_required_files','get_parent_class','get_object_vars','get_meta_tags', + 'get_magic_quotes_runtime','get_magic_quotes_gpc','get_loaded_extensions','get_included_files','get_include_path','get_html_translation_table', + 'get_extension_funcs','get_defined_vars','get_defined_functions','get_defined_constants','get_declared_classes','get_current_user', + 'get_class_vars','get_class_methods','get_class','get_cfg_var','get_browser','fwrite', + 'function_exists','func_num_args','func_get_args','func_get_arg','ftruncate','ftp_systype', + 'ftp_ssl_connect','ftp_size','ftp_site','ftp_set_option','ftp_rmdir','ftp_rename', + 'ftp_rawlist','ftp_quit','ftp_pwd','ftp_put','ftp_pasv','ftp_nlist', + 'ftp_nb_put','ftp_nb_get','ftp_nb_fput','ftp_nb_fget','ftp_nb_continue','ftp_mkdir', + 'ftp_mdtm','ftp_login','ftp_get_option','ftp_get','ftp_fput','ftp_fget', + 'ftp_exec','ftp_delete','ftp_connect','ftp_close','ftp_chdir','ftp_cdup', + 'ftok','ftell','fstat','fsockopen','fseek','fscanf', + 'frenchtojd','fread','fputs','fpassthru','fopen','fnmatch', + 'fmod','flush','floor','flock','floatval','filetype', + 'filesize','filepro_rowcount','filepro_retrieve','filepro_fieldwidth','filepro_fieldtype','filepro_fieldname', + 'filepro_fieldcount','filepro','fileperms','fileowner','filemtime','fileinode', + 'filegroup','filectime','fileatime','file_get_contents','file_exists','file', + 'fgetss','fgets','fgetcsv','fgetc','fflush','feof', + 'fclose','ezmlm_hash','extract','extension_loaded','expm1','explode', + 'exp','exif_thumbnail','exif_tagname','exif_read_data','exif_imagetype','exec', + 'escapeshellcmd','escapeshellarg','error_reporting','error_log','eregi_replace','eregi', + 'ereg_replace','ereg','end','easter_days','easter_date','each', + 'doubleval','dngettext','dl','diskfreespace','disk_total_space','disk_free_space', + 'dirname','dir','dgettext','deg2rad','defined','define_syslog_variables', + 'define','decoct','dechex','decbin','debug_zval_dump','debug_backtrace', + 'deaggregate','dcngettext','dcgettext','dba_sync','dba_replace','dba_popen', + 'dba_optimize','dba_open','dba_nextkey','dba_list','dba_insert','dba_handlers', + 'dba_firstkey','dba_fetch','dba_exists','dba_delete','dba_close','date', + 'current','ctype_xdigit','ctype_upper','ctype_space','ctype_punct','ctype_print', + 'ctype_lower','ctype_graph','ctype_digit','ctype_cntrl','ctype_alpha','ctype_alnum', + 'crypt','create_function','crc32','count_chars','count','cosh', + 'cos','copy','convert_cyr_string','constant','connection_status','connection_aborted', + 'compact','closelog','closedir','clearstatcache','class_exists','chunk_split', + 'chr','chown','chop','chmod','chgrp','checkdnsrr', + 'checkdate','chdir','ceil','call_user_method_array','call_user_method','call_user_func_array', + 'call_user_func','cal_to_jd','cal_info','cal_from_jd','cal_days_in_month','bzwrite', + 'bzread','bzopen','bzflush','bzerrstr','bzerror','bzerrno', + 'bzdecompress','bzcompress','bzclose','bindtextdomain','bindec','bind_textdomain_codeset', + 'bin2hex','bcsub','bcsqrt','bcscale','bcpow','bcmul', + 'bcmod','bcdiv','bccomp','bcadd','basename','base_convert', + 'base64_encode','base64_decode','atanh','atan2','atan','assert_options', + 'assert','asort','asinh','asin','arsort','array_walk', + 'array_values','array_unshift','array_unique','array_sum','array_splice','array_slice', + 'array_shift','array_search','array_reverse','array_reduce','array_rand','array_push', + 'array_pop','array_pad','array_multisort','array_merge_recursive','array_merge','array_map', + 'array_keys','array_key_exists','array_intersect_assoc','array_intersect','array_flip','array_filter', + 'array_fill','array_diff_assoc','array_diff','array_count_values','array_chunk','array_change_key_case', + 'apache_setenv','apache_response_headers','apache_request_headers','apache_note','apache_lookup_uri','apache_get_version', + 'apache_child_terminate','aggregation_info','aggregate_properties_by_regexp','aggregate_properties_by_list','aggregate_properties','aggregate_methods_by_regexp', + 'aggregate_methods_by_list','aggregate_methods','aggregate','addslashes','addcslashes','acosh', + 'acos','abs','_','echo', 'print', 'global', 'static', 'exit', 'array', 'empty', + 'eval', 'isset', 'unset', 'die', 'list' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '!', '@', '%', '&', '*', '|', '/', '<', '>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;', + 2 => 'color: #000000; font-weight: bold;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;', + 2 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #0000ff;', + 1 => 'color: #ff0000' + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + 3 => '' + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.php.net/{FNAME}', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '->', + 2 => '::' + ), + 'REGEXPS' => array( + 0 => "[\\$]{1,2}[a-zA-Z_][a-zA-Z0-9_]*", + 1 => array( + GESHI_SEARCH => "([a-zA-Z]+)(\n)(.*)(\n)(\\1;?)", + GESHI_REPLACE => '\3', + GESHI_BEFORE => '\1\2', + GESHI_AFTER => '\4\5', + GESHI_MODIFIERS => 'siU' + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + ' '?>' + ), + 1 => array( + ' '?>' + ), + 2 => array( + '<%' => '%>' + ), + 3 => array( + '' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true, + 2 => true, + 3 => true + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/python.php b/plugins/dokuwiki/inc/geshi/python.php new file mode 100644 index 0000000..595d524 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/python.php @@ -0,0 +1,229 @@ + 'Python', + 'COMMENT_SINGLE' => array(1 => '#'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"', "'", '"""'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + + /* + ** Set 1: reserved words + ** http://python.org/doc/current/ref/keywords.html + */ + 1 => array( + 'and', 'del', 'for', 'is', 'raise', 'assert', 'elif', 'from', 'lambda', 'return', 'break', + 'else', 'global', 'not', 'try', 'class', 'except', 'if', 'or', 'while', 'continue', 'exec', + 'import', 'pass', 'yield', 'def', 'finally', 'in', 'print' + ), + + /* + ** Set 2: builtins + ** http://python.org/doc/current/lib/built-in-funcs.html + */ + 2 => array( + '__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp', + 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', + 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', + 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', + 'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range', + 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', + 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', + 'vars', 'xrange', 'zip', + // Built-in constants: http://python.org/doc/current/lib/node35.html + 'False', 'True', 'None', 'NotImplemented', 'Ellipsis', + // Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html + 'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError', + 'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError', + 'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError', + 'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError', + 'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError', + 'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError', + 'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning', + 'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning', + 'RuntimeWarning', 'FutureWarning', + // self: this is a common python convention (but not a reserved word) + 'self' + ), + + /* + ** Set 3: standard library + ** http://python.org/doc/current/lib/modindex.html + */ + 3 => array( + '__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm', + 'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer', + 'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi', + 'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', + 'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler', + 'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt', + 'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE', + 'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm', + 'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl', + 'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl', + 'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob', + 'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib', + 'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect', + 'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap', + 'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify', + 'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator', + 'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes', + 'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile', + 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random', + 're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter', + 'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve', + 'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd', + 'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string', + 'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev', + 'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', + 'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token', + 'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2', + 'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings', + 'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml', + 'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib' + ), + + /* + ** Set 4: special methods + ** http://python.org/doc/current/ref/specialnames.html + */ + 4 => array( + /* + // Iterator types: http://python.org/doc/current/lib/typeiter.html + '__iter__', 'next', + // String types: http://python.org/doc/current/lib/string-methods.html + 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', + 'find', 'index', 'isalnum', 'isaplpha', 'isdigit', 'islower', 'isspace', 'istitle', + 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', + 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', + 'translate', 'upper', 'zfill', + */ + // Basic customization: http://python.org/doc/current/ref/customization.html + '__new__', '__init__', '__del__', '__repr__', '__str__', + '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__', + '__hash__', '__nonzero__', '__unicode__', '__dict__', + // Attribute access: http://python.org/doc/current/ref/attribute-access.html + '__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__', + '__delete__', '__slots__', + // Class creation, callable objects + '__metaclass__', '__call__', + // Container types: http://python.org/doc/current/ref/sequence-types.html + '__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__', + '__getslice__', '__setslice__', '__delslice__', + // Numeric types: http://python.org/doc/current/ref/numeric-types.html + '__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__', + '__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__', + '__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__', + '__long__','__lshift__', + '__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__', + '__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__', + '__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__', + '__sub__','__xor__' + ) + + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '*', '&', '%', '!', ';', '<', '>', '?', '`' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => true, + 2 => true, + 3 => true, + 4 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #ff7700;font-weight:bold;', // Reserved + 2 => 'color: #008000;', // Built-ins + self + 3 => 'color: #dc143c;', // Standard lib + 4 => 'color: #0000cd;' // Special methods + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: black;' + ), + 'STRINGS' => array( + 0 => 'color: #483d8b;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff4500;' + ), + 'METHODS' => array( + 1 => 'color: black;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/qbasic.php b/plugins/dokuwiki/inc/geshi/qbasic.php new file mode 100644 index 0000000..3ded1c0 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/qbasic.php @@ -0,0 +1,147 @@ + 'QBasic/QuickBASIC', + 'COMMENT_SINGLE' => array(1 => "'", 2 => ' REM', 3 => "\tREM"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_UPPER, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'DO', 'LOOP', 'WHILE', 'WEND', 'THEN', 'ELSE', 'ELSEIF', 'IF', + 'FOR', 'TO', 'NEXT', 'STEP', 'GOTO', 'GOSUB', 'RETURN', 'RESUME', 'SELECT', + 'CASE', 'UNTIL' + ), + 3 => array( + 'ABS', 'ABSOLUTE', 'ACCESS', 'ALIAS', 'AND', 'ANY', 'APPEND', 'AS', 'ASC', 'ATN', + 'BASE', 'BEEP', 'BINARY', 'BLOAD', 'BSAVE', 'BYVAL', 'CALL', 'CALLS', 'CASE', + 'CDBL', 'CDECL', 'CHAIN', 'CHDIR', 'CHDIR', 'CHR$', 'CINT', 'CIRCLE', 'CLEAR', + 'CLNG', 'CLOSE', 'CLS', 'COM', 'COMMAND$', 'COMMON', 'CONST', 'COS', 'CSNG', + 'CSRLIN', 'CVD', 'CVDMBF', 'CVI', 'CVL', 'CVS', 'CVSMDF', 'DATA', 'DATE$', + 'DECLARE', 'DEF', 'FN', 'SEG', 'DEFDBL', 'DEFINT', 'DEFLNG', 'DEFSNG', 'DEFSTR', + 'DIM', 'DOUBLE', 'DRAW', 'END', 'ENVIRON', 'ENVIRON$', 'EOF', 'EQV', 'ERASE', + 'ERDEV', 'ERDEV$', 'ERL', 'ERR', 'ERROR', 'EXIT', 'EXP', 'FIELD', 'FILEATTR', + 'FILES', 'FIX', 'FRE', 'FREEFILE', 'FUNCTION', 'GET', 'HEX$', 'IMP', 'INKEY$', + 'INP', 'INPUT', 'INPUT$', 'INSTR', 'INT', 'INTEGER', 'IOCTL', 'IOCTL$', 'IS', + 'KEY', 'KILL', 'LBOUND', 'LCASE$', 'LEFT$', 'LEN', 'LET', 'LINE', 'LIST', 'LOC', + 'LOCAL', 'LOCATE', 'LOCK', 'LOF', 'LOG', 'UNLOCK', 'LONG', 'LPOS', 'LPRINT', + 'LSET', 'LTRIM$', 'MID$', 'MKD$', 'MKDIR', 'MKDMBF$', 'MKI$', 'MKL$', + 'MKS$', 'MKSMBF$', 'MOD', 'NAME', 'NOT', 'OCT$', 'OFF', 'ON', 'PEN', 'PLAY', + 'STRIG', 'TIMER', 'UEVENT', 'OPEN', 'OPTION', 'BASE', 'OR', 'OUT', 'OUTPUT', + 'PAINT', 'PALETTE', 'PCOPY', 'PEEK', 'PMAP', 'POINT', 'POKE', 'POS', 'PRESET', + 'PRINT', 'USING', 'PSET', 'PUT', 'RANDOM', 'RANDOMIZE', 'READ', 'REDIM', 'RESET', + 'RESTORE', 'RIGHT$', 'RMDIR', 'RND', 'RSET', 'RTRIM$', 'RUN', 'SADD', 'SCREEN', + 'SEEK', 'SETMEM', 'SGN', 'SHARED', 'SHELL', 'SIGNAL', 'SIN', 'SINGLE', 'SLEEP', + 'SOUND', 'SPACE$', 'SPC', 'SQR', 'STATIC', 'STICK', 'STOP', 'STR$', 'STRIG', + 'STRING', 'STRING$', 'SUB', 'SWAP', 'SYSTEM', 'TAB', 'TAN', 'TIME$', 'TIMER', + 'TROFF', 'TRON', 'TYPE', 'UBOUND', 'UCASE$', 'UEVENT', 'UNLOCK', 'USING', 'VAL', + 'VARPTR', 'VARPTR$', 'VARSEG', 'VIEW', 'WAIT', 'WIDTH', 'WINDOW', 'WRITE', 'XOR' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 3 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #a1a100;', + 3 => 'color: #000066;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080;', + 2 => 'color: #808080;', + 3 => 'color: #808080;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 1 => '', + 3 => 'http://www.qbasicnews.com/qboho/qck{FNAME}.shtml' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/ruby.php b/plugins/dokuwiki/inc/geshi/ruby.php new file mode 100644 index 0000000..4c91033 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/ruby.php @@ -0,0 +1,149 @@ + 'Ruby', + 'COMMENT_SINGLE' => array(1 => "#"), + 'COMMENT_MULTI' => array( "=begin" => "=end"), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"', '`'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'alias', 'and', 'begin', 'break', 'case', 'class', + 'def', 'defined', 'do', 'else', 'elsif', 'end', + 'ensure', 'for', 'if', 'in', 'module', 'while', + 'next', 'not', 'or', 'redo', 'rescue', 'yield', + 'retry', 'super', 'then', 'undef', 'unless', + 'until', 'when', 'BEGIN', 'END', 'include' + + ), + 2 => array( + '__FILE__', '__LINE__', 'false', 'nil', 'self', 'true', 'return' + ), + 3 => array( + 'Array', 'Float', 'Integer', 'String', 'at_exit', + 'autoload', 'binding', 'caller', 'catch', 'chop', 'chop!', + 'chomp', 'chomp!', 'eval', 'exec', 'exit', 'exit!', 'fail', + 'fork', 'format', 'gets', 'global_variables', 'gsub', 'gsub!', + 'iterator?', 'lambda', 'load', 'local_variables', 'loop', 'open', + 'p', 'print', 'printf', 'proc', 'putc', 'puts', 'raise', + 'rand', 'readline', 'readlines', 'require', 'select', 'sleep', + 'split', 'sprintf', 'srand', 'sub', 'sub!', 'syscall', + 'system', 'test', 'trace_var', 'trap', 'untrace_var' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '@', '%', '&', '*', '|', '/', '<', '>', + '+', '-', '=>', '=>' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color:#9966CC; font-weight:bold;', + 2 => 'color:#0000FF; font-weight:bold;', + 3 => 'color:#CC0066; font-weight:bold;' + ), + 'COMMENTS' => array( + 1 => 'color:#008000; font-style:italic;', + 'MULTI' => 'color:#000080; font-style:italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color:#000099;' + ), + 'BRACKETS' => array( + 0 => 'color:#006600; font-weight:bold;' + ), + 'STRINGS' => array( + 0 => 'color:#996600;' + ), + 'NUMBERS' => array( + 0 => 'color:#006666;' + ), + 'METHODS' => array( + 1 => 'color:#9900CC;' + ), + 'SYMBOLS' => array( + 0 => 'color:#006600; font-weight:bold;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + 0 => '', + 1 => '', + 2 => '', + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_MAYBE, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + '<%' => '%>' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true, + 1 => true, + 2 => true, + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/scheme.php b/plugins/dokuwiki/inc/geshi/scheme.php new file mode 100644 index 0000000..093e9f0 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/scheme.php @@ -0,0 +1,172 @@ + 'Scheme', + 'COMMENT_SINGLE' => array(1 => ';'), + 'COMMENT_MULTI' => array(';|' => '|;'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'abs', 'acos', 'and', 'angle', 'append', 'appply', 'approximate', + 'asin', 'assoc', 'assq', 'assv', 'atan', + + 'begin', 'boolean?', 'bound-identifier=?', + + 'caar', 'caddr', 'cadr', 'call-with-current-continuation', + 'call-with-input-file', 'call-with-output-file', 'call/cc', 'car', + 'case', 'catch', 'cdddar', 'cddddr', 'cdr', 'ceiling', 'char->integer', + 'char-alphabetic?', 'char-ci<=?', 'char-ci=?', + 'char-ci>?', 'char-ci=?', 'char-downcase', 'char-lower-case?', + 'char-numeric', 'char-ready', 'char-ready?', 'char-upcase', + 'char-upper-case?', 'char-whitespace?', 'char<=?', 'char=?', 'char>?', 'char?', 'close-input-port', 'close-output-port', + 'complex?', 'cond', 'cons', 'construct-identifier', 'cos', + 'current-input-port', 'current-output-port', + + 'd', 'define', 'define-syntax', 'delay', 'denominator', 'display', 'do', + + 'e', 'eof-object?', 'eq?', 'equal?', 'eqv?', 'even?', 'exact->inexact', + 'exact?', 'exp', 'expt', 'else', + + 'f', 'floor', 'for-each', 'force', 'free-identifer=?', + + 'gcd', 'gen-counter', 'gen-loser', 'generate-identifier', + + 'identifier->symbol', 'identifier', 'if', 'imag-part', 'inexact->exact', + 'inexact?', 'input-port?', 'integer->char', 'integer?', 'integrate-system', + + 'l', 'lambda', 'last-pair', 'lcm', 'length', 'let', 'let*', 'letrec', + 'list', 'list->string', 'list->vector', 'list-ref', 'list-tail', 'list?', + 'load', 'log', + + 'magnitude', 'make-polar', 'make-promise', 'make-rectangular', + 'make-string', 'make-vector', 'map', 'map-streams', 'max', 'member', + 'memq', 'memv', 'min', 'modulo', + + 'negative', 'newline', 'nil', 'not', 'null?', 'number->string', 'number?', + 'numerator', + + 'odd?', 'open-input-file', 'open-output-file', 'or', 'output-port', + + 'pair?', 'peek-char', 'positive?', 'procedure?', + + 'quasiquote', 'quote', 'quotient', + + 'rational', 'rationalize', 'read', 'read-char', 'real-part', 'real?', + 'remainder', 'return', 'reverse', + + 's', 'sequence', 'set!', 'set-char!', 'set-cdr!', 'sin', 'sqrt', 'string', + 'string->list', 'string->number', 'string->symbol', 'string-append', + 'string-ci<=?', 'string-ci=?', + 'string-ci>?', 'string-copy', 'string-fill!', 'string-length', + 'string-ref', 'string-set!', 'string<=?', 'string=?', 'string>?', 'string?', 'substring', 'symbol->string', + 'symbol?', 'syntax', 'syntax-rules', + + 't', 'tan', 'template', 'transcript-off', 'transcript-on', 'truncate', + + 'unquote', 'unquote-splicing', 'unwrap-syntax', + + 'vector', 'vector->list', 'vector-fill!', 'vector-length', 'vector-ref', + 'vector-set!', 'vector?', + + 'with-input-from-file', 'with-output-to-file', 'write', 'write-char', + + 'zero?' + + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', '[', ']', '!', '%', '^', '&', '/','+','-','*','=','<','>',';','|' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #202020;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/sdlbasic.php b/plugins/dokuwiki/inc/geshi/sdlbasic.php new file mode 100644 index 0000000..f930a6f --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/sdlbasic.php @@ -0,0 +1,163 @@ + 'sdlBasic', + 'COMMENT_SINGLE' => array(1 => "'", 2 => "rem", 3 => "!", 4 => "#"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'const', 'option', 'explicit', 'option', 'qbasic', 'include', 'argc', + 'argv', 'command', 'command$', 'run', 'shell', 'end', 'os', 'declare', + 'sub', 'function', 'return', 'while', 'wend', 'exit', 'while', 'end', + 'while', 'continue', 'if', 'then', 'else', 'elseif', 'end', 'if', + 'select', 'case', 'case', 'else', 'end', 'case', 'for', 'each', 'step', + 'next', 'to', 'continue', 'dim', 'shared', 'common', 'lbound', 'bound', + 'erase', 'asc', 'chr', 'chr$', 'insert', 'insert$', 'instr', 'lcase', + 'lcase$', 'left', 'left$', 'len', 'length', 'ltrim', 'ltrim$', 'mid', + 'mid$', 'replace', 'replace$', 'replacesubstr', 'replacesubstr$', + 'reverse', 'reverse$', 'right', 'right$', 'rinstr', 'rtrim', 'rtrim$', + 'space', 'space$', 'str', 'str$', 'strf', 'strf$', 'string', 'string$', + 'tally', 'trim', 'trim$', 'typeof', 'typeof$', 'ucase', 'ucase$', 'val', + 'abs', 'acos', 'andbit', 'asin', 'atan', 'bitwiseand', 'bitwiseor', + 'bitwisexor', 'cos', 'exp', 'fix', 'floor', 'frac', 'hex', 'hex$', 'int', + 'log', 'min', 'max', 'orbit', 'randomize', 'rnd', 'round', 'sgn', 'sin', + 'sqr', 'tan', 'xorbit', 'open', 'as', 'file', 'input', 'close', 'output', + 'append', 'eof', 'fileexists', 'filecopy', 'filemove', 'filerename', + 'freefile', 'kill', 'loc', 'lof', 'readbyte', 'rename', 'seek', + 'writebyte', 'chdir', 'dir', 'dir$', 'direxists', 'dirfirst', 'dirnext', + 'mkdir', 'rmdir', 'print', 'date', 'date$', 'time', 'time$', 'ticks', + 'data', 'read', 'reservebank', 'freebank', 'copybank', 'loadbank', + 'savebank', 'setbank', 'sizebank', 'poke', 'doke', 'loke', 'peek', 'deek', + 'leek', 'memcopy', 'setdisplay', 'setcaption', 'caption', 'displaywidth', + 'displayheight', 'displaybpp', 'screen', 'directscreen', 'screenopen', + 'screenclose', 'screenclone', 'screencopy', 'screenfade', 'screenfadein', + 'screencrossfade', 'screenalpha', 'screenlock', 'screenunlock', + 'screenrect', 'xscreenrect', 'yscreenrect', 'wscreenrect', 'hscreenrect', + 'flagscreenrect', 'screenwidth', 'screenheight', 'offset', 'xoffset', + 'yoffset', 'cls', 'screenswap', 'autoback', 'setautoback', + 'dualplayfield', 'waitvbl', 'fps', 'rgb', 'enablepalette', 'color', + 'palette', 'colorcycling', 'ink', 'point', 'dot', 'plot', 'line', 'box', + 'bar', 'circle', 'fillcircle', 'ellipse', 'fillellipse', 'paint', + 'loadimage', 'saveimage', 'loadsound', 'savesound', 'loadmusic', + 'hotspot', 'setcolorkey', 'imageexists', 'imagewidth', 'imageheight', + 'deleteimage', 'copyimage', 'setalpha', 'zoomimage', 'rotateimage', + 'rotozoomimage', 'blt', 'pastebob', 'pasteicon', 'grab', 'spriteclip', + 'sprite', 'deletesprite', 'xsprite', 'ysprite', 'spritewidth', + 'spriteheight', 'frsprite', 'livesprite', 'spritehit', 'autoupdatesprite', + 'updatesprite', 'setbob', 'bob', 'deletebob', 'xbob', 'ybob', 'bobwidth', + 'bobheight', 'frbob', 'livebob', 'bobhit', 'autoupdatebob', 'updatebob', + 'text', 'setfont', 'textrender', 'pen', 'paper', 'prints', 'locate', + 'atx', 'aty', 'curson', 'cursoff', 'inputs', 'zoneinputs', + 'isenabledsound', 'soundexists', 'deletesound', 'copysound', + 'musicexists', 'playsound', 'volumesound', 'stopsound', 'pausesound', + 'resumesound', 'vumetersound', 'positionsound', 'soundchannels', + 'playmusic', 'positionmusic', 'stopmusic', 'fademusic', 'pausemusic', + 'resumemusic', 'rewindmusic', 'volumemusic', 'speedmusic', 'numdrivescd', + 'namecd', 'getfreecd', 'opencd', 'indrivecd', 'trackscd', 'curtrackcd', + 'curframecd', 'playcd', 'playtrackscd', 'playtrackscd', 'playtrackscd', + 'pausecd', 'resumecd', 'stopcd', 'ejectcd', 'closecd', 'tracktypecd', + 'tracklengthcd', 'trackoffsetcd', 'key', 'inkey', 'waitkey', 'xmouse', + 'ymouse', 'xmousescreen', 'ymousescreen', 'bmouse', 'changemouse', + 'locatemouse', 'mouseshow', 'mousehide', 'mousezone', 'numjoysticks', + 'namejoystick', 'numaxesjoystick', 'numballsjoystick', 'numhatsjoystick', + 'numbuttonsjoystick', 'getaxisjoystick', 'gethatjoystick', + 'getbuttonjoystick', 'xgetballjoystick', 'ygetballjoystick', 'joy', + 'bjoy', 'wait', 'timer', 'isenabledsock', 'getfreesock', 'opensock', + 'acceptsock', 'isserverready', 'connectsock', 'connectionreadysock', + 'isclientready', 'losesock', 'peeksock', 'readsock', 'readbytesock', + 'readlinesock', 'writesock', 'writebytesock', 'writelinesock', + 'getremoteip', 'getremoteport', 'getlocalip' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080;', + 2 => 'color: #808080;', + 3 => 'color: #808080;', + 4 => 'color: #808080;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 0 => 'color: #66cc66;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/smarty.php b/plugins/dokuwiki/inc/geshi/smarty.php new file mode 100644 index 0000000..3daa439 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/smarty.php @@ -0,0 +1,168 @@ + 'Smarty', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array('{*' => '*}'), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + '$smarty', 'now', 'const', 'capture', 'config', 'section', 'foreach', 'template', 'version', 'ldelim', 'rdelim', + 'config_load', 'foreachelse', 'include', 'include_php', 'insert', 'if', 'elseif', 'else', 'php', + 'sectionelse', 'clear_all_cache', 'clear_cache', 'is_cached', + ), + 2 => array( + 'capitalize', 'count_characters', 'cat', 'count_paragraphs', 'count_sentences', 'count_words', 'date_format', + 'default', 'escape', 'indent', 'lower', 'nl2br', 'regex_replace', 'replace', 'spacify', 'string_format', + 'strip', 'strip_tags', 'truncate', 'upper', 'wordwrap' + ), + 3 => array( + 'assign', 'counter', 'cycle', 'debug', 'eval', 'fetch', 'html_checkboxes', 'html_image', 'html_options', + 'html_radios', 'html_select_date', 'html_select_time', 'html_table', 'math', 'mailto', 'popup_init', + 'popup', 'textformat' + ), + 4 => array( + '$template_dir', '$compile_dir', '$config_dir', '$plugins_dir', '$debugging', '$debug_tpl', + '$debugging_ctrl', '$autoload_filters', '$compile_check', '$force_compile', '$caching', '$cache_dir', + '$cache_lifetime', '$cache_handler_func', '$cache_modified_check', '$config_overwrite', + '$config_booleanize', '$config_read_hidden', '$config_fix_newlines', '$default_template_handler_func', + '$php_handling', '$security', '$secure_dir', '$security_settings', '$trusted_dir', '$left_delimiter', + '$right_delimiter', '$compiler_class', '$request_vars_order', '$request_use_auto_globals', + '$error_reporting', '$compile_id', '$use_sub_dirs', '$default_modifiers', '$default_resource_type' + ), + 5 => array( + 'append', 'append_by_ref', 'assign', 'assign_by_ref', 'clear_all_assign', 'clear_all_cache', + 'clear_assign', 'clear_cache', 'clear_compiled_tpl', 'clear_config', 'config_load', 'display', + 'fetch', 'get_config_vars', 'get_registered_object', 'get_template_vars', 'is_cached', + 'load_filter', 'register_block', 'register_compiler_function', 'register_function', + 'register_modifier', 'register_object', 'register_outputfilter', 'register_postfilter', + 'register_prefilter', 'register_resource', 'trigger_error', 'template_exists', 'unregister_block', + 'unregister_compiler_function', 'unregister_function', 'unregister_modifier', 'unregister_object', + 'unregister_outputfilter', 'unregister_postfilter', 'unregister_prefilter', 'unregister_resource' + ), + 6 => array( + 'name', 'assign', 'file', 'scope', 'global', 'key', 'once', 'script', + 'loop', 'start', 'step', 'max', 'show', 'values', 'value', 'from', 'item' + ), + 7 => array( + 'eq', 'neq', 'ne', 'lte', 'gte', 'ge', 'le', 'not', 'mod' + ), + ), + 'SYMBOLS' => array( + '/', '=', '==', '!=', '>', '<', '>=', '<=', '!', '%' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0600FF;', //Functions + 2 => 'color: #008000;', //Modifiers + 3 => 'color: #0600FF;', //Custom Functions + 4 => 'color: #804040;', //Variables + 5 => 'color: #008000;', //Methods + 6 => 'color: #6A0A0A;', //Attributes + 7 => 'color: #D36900;' //Text-based symbols + ), + 'COMMENTS' => array( + 'MULTI' => 'color: #008080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #D36900;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: #D36900;' + ), + 'SCRIPT' => array( + 0 => '' + ), + 'REGEXPS' => array( + ) + ), + 'URLS' => array( + 1 => 'http://smarty.php.net/{FNAME}', + 2 => 'http://smarty.php.net/{FNAME}', + 3 => 'http://smarty.php.net/{FNAME}', + 4 => 'http://smarty.php.net/{FNAME}', + 5 => 'http://smarty.php.net/{FNAME}', + 6 => '', + 7 => 'http://smarty.php.net/{FNAME}' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + '{' => '}' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => true + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/sql.php b/plugins/dokuwiki/inc/geshi/sql.php new file mode 100644 index 0000000..adbe795 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/sql.php @@ -0,0 +1,137 @@ + 'SQL', + 'COMMENT_SINGLE' => array(1 =>'--', 2 => '#'), + 'COMMENT_MULTI' => array('/*' => '*/'), + 'CASE_KEYWORDS' => 1, + 'QUOTEMARKS' => array("'", '"', '`'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'ALL', 'ASC', 'AS', 'ALTER', 'AND', 'ADD', 'AUTO_INCREMENT', + 'BETWEEN', 'BINARY', 'BOTH', 'BY', 'BOOLEAN', + 'CHANGE', 'CHECK', 'COLUMNS', 'COLUMN', 'CROSS','CREATE', + 'DATABASES', 'DATABASE', 'DATA', 'DELAYED', 'DESCRIBE', 'DESC', 'DISTINCT', 'DELETE', 'DROP', 'DEFAULT', + 'ENCLOSED', 'ESCAPED', 'EXISTS', 'EXPLAIN', + 'FIELDS', 'FIELD', 'FLUSH', 'FOR', 'FOREIGN', 'FUNCTION', 'FROM', + 'GROUP', 'GRANT', + 'HAVING', + 'IGNORE', 'INDEX', 'INFILE', 'INSERT', 'INNER', 'INTO', 'IDENTIFIED', 'IN', 'IS', 'IF', + 'JOIN', + 'KEYS', 'KILL','KEY', + 'LEADING', 'LIKE', 'LIMIT', 'LINES', 'LOAD', 'LOCAL', 'LOCK', 'LOW_PRIORITY', 'LEFT', 'LANGUAGE', + 'MODIFY', + 'NATURAL', 'NOT', 'NULL', 'NEXTVAL', + 'OPTIMIZE', 'OPTION', 'OPTIONALLY', 'ORDER', 'OUTFILE', 'OR', 'OUTER', 'ON', + 'PROCEEDURE','PROCEDURAL', 'PRIMARY', + 'READ', 'REFERENCES', 'REGEXP', 'RENAME', 'REPLACE', 'RETURN', 'REVOKE', 'RLIKE', 'RIGHT', + 'SHOW', 'SONAME', 'STATUS', 'STRAIGHT_JOIN', 'SELECT', 'SETVAL', 'SET', + 'TABLES', 'TEMINATED', 'TO', 'TRAILING','TRUNCATE', 'TABLE', 'TEMPORARY', 'TRIGGER', 'TRUSTED', + 'UNIQUE', 'UNLOCK', 'USE', 'USING', 'UPDATE', 'UNSIGNED', + 'VALUES', 'VARIABLES', 'VIEW', + 'WITH', 'WRITE', 'WHERE', + 'ZEROFILL', + 'XOR', + ) + ), + 'SYMBOLS' => array( + '(', ')', '=', '<', '>', '|' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #993333; font-weight: bold;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080; font-style: italic;', + 2 => 'color: #808080; font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/vb.php b/plugins/dokuwiki/inc/geshi/vb.php new file mode 100644 index 0000000..0d2db77 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/vb.php @@ -0,0 +1,150 @@ + 'Visual Basic', + 'COMMENT_SINGLE' => array(1 => "'"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + 'as', 'err', 'boolean', 'and', 'or', 'recordset', 'unload', 'to', + 'integer','long','single','new','database','nothing','set','close', + 'open','print','split','line','field','querydef','instrrev', + 'abs','array','asc','ascb','ascw','atn','avg','me', + 'cbool','cbyte','ccur','cdate','cdbl','cdec','choose','chr','chrb','chrw','cint','clng', + 'command','cos','count','createobject','csng','cstr','curdir','cvar','cvdate','cverr', + 'date','dateadd','datediff','datepart','dateserial','datevalue','day','ddb','dir','doevents', + 'environ','eof','error','exp', + 'fileattr','filedatetime','filelen','fix','format','freefile','fv', + 'getallstrings','getattr','getautoserversettings','getobject','getsetting', + 'hex','hour','iif','imestatus','input','inputb','inputbox','instr','instb','int','ipmt', + 'isarray','isdate','isempty','iserror','ismissing','isnull','isnumeric','isobject', + 'lbound','lcase','left','leftb','len','lenb','loadpicture','loc','lof','log','ltrim', + 'max','mid','midb','min','minute','mirr','month','msgbox', + 'now','nper','npv','oct','partition','pmt','ppmt','pv','qbcolor', + 'rate','rgb','right','rightb','rnd','rtrim', + 'second','seek','sgn','shell','sin','sln','space','spc','sqr','stdev','stdevp','str', + 'strcomp','strconv','string','switch','sum','syd', + 'tab','tan','time','timer','timeserial','timevalue','trim','typename', + 'ubound','ucase','val','var','varp','vartype','weekday','year', + 'appactivate','base','beep','call','case','chdir','chdrive','const', + 'declare','defbool','defbyte','defcur','defdate','defdbl','defdec','defint', + 'deflng','defobj','defsng','defstr','deftype','defvar','deletesetting','dim','do', + 'else','elseif','end','enum','erase','event','exit','explicit', + 'false','filecopy','for','foreach','friend','function','get','gosub','goto', + 'if','implements','kill','let','lineinput','lock','loop','lset','mkdir','name','next','not', + 'onerror','on','option','private','property','public','put','raiseevent','randomize', + 'redim','rem','reset','resume','return','rmdir','rset', + 'savepicture','savesetting','sendkeys','setattr','static','sub', + 'then','true','type','unlock','wend','while','width','with','write', + 'vbabort','vbabortretryignore','vbapplicationmodal','vbarray', + 'vbbinarycompare','vbblack','vbblue','vbboolean','vbbyte','vbcancel', + 'vbcr','vbcritical','vbcrlf','vbcurrency','vbcyan','vbdataobject', + 'vbdate','vbdecimal','vbdefaultbutton1','vbdefaultbutton2', + 'vbdefaultbutton3','vbdefaultbutton4','vbdouble','vbempty', + 'vberror','vbexclamation','vbfirstfourdays','vbfirstfullweek', + 'vbfirstjan1','vbformfeed','vbfriday','vbgeneraldate','vbgreen', + 'vbignore','vbinformation','vbinteger','vblf','vblong','vblongdate', + 'vblongtime','vbmagenta','vbmonday','vbnewline','vbno','vbnull', + 'vbnullchar','vbnullstring','vbobject','vbobjecterror','vbok','vbokcancel', + 'vbokonly','vbquestion','vbred','vbretry','vbretrycancel','vbsaturday', + 'vbshortdate','vbshorttime','vbsingle','vbstring','vbsunday', + 'vbsystemmodal','vbtab','vbtextcompare','vbthursday','vbtuesday', + 'vbusesystem','vbusesystemdayofweek','vbvariant','vbverticaltab', + 'vbwednesday','vbwhite','vbyellow','vbyes','vbyesno','vbyesnocancel', + 'vbnormal','vbdirectory' + ) + ), + 'SYMBOLS' => array( + '(', ')' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #b1b100;' + ), + 'COMMENTS' => array( + 1 => 'color: #808080;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #66cc66;' + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + ) + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/vbnet.php b/plugins/dokuwiki/inc/geshi/vbnet.php new file mode 100644 index 0000000..984bcf8 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/vbnet.php @@ -0,0 +1,199 @@ + 'vb.net', + 'COMMENT_SINGLE' => array(1 => "'"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + 1 => array( + '3DDKSHADOW', '3DHIGHLIGHT', '3DLIGHT', 'ABORT', 'ABORTRETRYIGNORE', 'ACTIVEBORDER', + 'ACTIVETITLEBAR', 'ALIAS', 'APPLICATIONMODAL', 'APPLICATIONWORKSPACE', 'ARCHIVE', + 'BACK', 'BINARYCOMPARE', 'BLACK', 'BLUE', 'BUTTONFACE', 'BUTTONSHADOW', 'BUTTONTEXT', + 'CANCEL', 'CDROM', 'CR', 'CRITICAL', 'CRLF', 'CYAN', 'DEFAULT', 'DEFAULTBUTTON1', + 'DEFAULTBUTTON2', 'DEFAULTBUTTON3', 'DESKTOP', 'DIRECTORY', 'EXCLAMATION', 'FALSE', + 'FIXED', 'FORAPPENDING', 'FORMFEED', 'FORREADING', 'FORWRITING', 'FROMUNICODE', + 'GRAYTEXT', 'GREEN', 'HIDDEN', 'HIDE', 'HIGHLIGHT', 'HIGHLIGHTTEXT', 'HIRAGANA', + 'IGNORE', 'INACTIVEBORDER', 'INACTIVECAPTIONTEXT', 'INACTIVETITLEBAR', 'INFOBACKGROUND', + 'INFORMATION', 'INFOTEXT', 'KATAKANALF', 'LOWERCASE', 'MAGENTA', 'MAXIMIZEDFOCUS', + 'MENUBAR', 'MENUTEXT', 'METHOD', 'MINIMIZEDFOCUS', 'MINIMIZEDNOFOCUS', 'MSGBOXRIGHT', + 'MSGBOXRTLREADING', 'MSGBOXSETFOREGROUND', 'NARROW', 'NEWLINE', 'NO', 'NORMAL', + 'NORMALFOCUS', 'NORMALNOFOCUS', 'NULLSTRING', 'OBJECTERROR', 'OK', 'OKCANCEL', 'OKONLY', + 'PROPERCASE', 'QUESTION', 'RAMDISK', 'READONLY', 'RED', 'REMOTE', 'REMOVABLE', 'RETRY', + 'RETRYCANCEL', 'SCROLLBARS', 'SYSTEMFOLDER', 'SYSTEMMODAL', 'TAB', 'TEMPORARYFOLDER', + 'TEXTCOMPARE', 'TITLEBARTEXT', 'TRUE', 'UNICODE', 'UNKNOWN', 'UPPERCASE', 'VERTICALTAB', + 'VOLUME', 'WHITE', 'WIDE', 'WIN16', 'WIN32', 'WINDOWBACKGROUND', 'WINDOWFRAME', + 'WINDOWSFOLDER', 'WINDOWTEXT', 'YELLOW', 'YES', 'YESNO', 'YESNOCANCEL' + ), + 2 => array( + 'As', 'ADDHANDLER', 'ASSEMBLY', 'AUTO', 'Binary', 'ByRef', 'ByVal', 'BEGINEPILOGUE', + 'Else', 'Empty', 'Error', 'ENDPROLOGUE', 'EXTERNALSOURCE', 'ENVIRON', 'For', + 'Friend', 'GET', 'HANDLES', 'Input', 'Is', 'Len', 'Lock', 'Me', 'Mid', 'MUSTINHERIT', + 'MYBASE', 'MYCLASS', 'New', 'Next', 'Nothing', 'Null', 'NOTINHERITABLE', + 'NOTOVERRIDABLE', 'OFF', 'On', 'Option', 'Optional', 'OVERRIDABLE', 'ParamArray', + 'Print', 'Private', 'Property', 'Public', 'Resume', 'Seek', 'Static', 'Step', + 'String', 'SHELL', 'SENDKEYS', 'SET', 'Then', 'Time', 'To', 'THROW', 'WithEvents' + ), + 3 => array( + 'COLLECTION', 'DEBUG', 'DICTIONARY', 'DRIVE', 'DRIVES', 'ERR', 'FILE', 'FILES', + 'FILESYSTEMOBJECT', 'FOLDER', 'FOLDERS', 'TEXTSTREAM' + ), + 4 => array( + 'BOOLEAN', 'BYTE', 'DATE', 'DECIMIAL', 'DOUBLE', 'INTEGER', 'LONG', 'OBJECT', + 'SINGLE STRING' + ), + 5 => array( + 'ADDRESSOF', 'AND', 'BITAND', 'BITNOT', 'BITOR', 'BITXOR', + 'GETTYPE', 'LIKE', 'MOD', 'NOT', 'ORXOR' + ), + 6 => array( + 'APPACTIVATE', 'BEEP', 'CALL', 'CHDIR', 'CHDRIVE', 'CLASS', 'CASE', 'CATCH', + 'DECLARE', 'DELEGATE', 'DELETESETTING', 'DIM', 'DO', 'DOEVENTS', 'END', 'ENUM', + 'EVENT', 'EXIT', 'EACH', 'FUNCTION', 'FINALLY', 'IF', 'IMPORTS', 'INHERITS', + 'INTERFACE', 'IMPLEMENTS', 'KILL', 'LOOP', 'MIDB', 'NAMESPACE', 'OPEN', 'PUT', + 'RAISEEVENT', 'RANDOMIZE', 'REDIM', 'REM', 'RESET', 'SAVESETTING', 'SELECT', + 'SETATTR', 'STOP', 'SUB', 'SYNCLOCK', 'STRUCTURE', 'SHADOWS', 'SWITCH', + 'TIMEOFDAY', 'TODAY', 'TRY', 'WIDTH', 'WITH', 'WRITE', 'WHILE' + ), + 7 => array( + 'ABS', 'ARRAY', 'ASC', 'ASCB', 'ASCW', 'CALLBYNAME', 'CBOOL', 'CBYTE', 'CCHAR', + 'CCHR', 'CDATE', 'CDBL', 'CDEC', 'CHOOSE', 'CHR', 'CHR$', 'CHRB', 'CHRB$', 'CHRW', + 'CINT', 'CLNG', 'CLNG8', 'CLOSE', 'COBJ', 'COMMAND', 'COMMAND$', 'CONVERSION', + 'COS', 'CREATEOBJECT', 'CSHORT', 'CSTR', 'CURDIR', 'CTYPE', 'CVDATE', 'DATEADD', + 'DATEDIFF', 'DATEPART', 'DATESERIAL', 'DATEVALUE', 'DAY', 'DDB', 'DIR', 'DIR$', + 'EOF', 'ERROR$', 'EXP', 'FILEATTR', 'FILECOPY', 'FILEDATATIME', 'FILELEN', 'FILTER', + 'FIX', 'FORMAT', 'FORMAT$', 'FORMATCURRENCY', 'FORMATDATETIME', 'FORMATNUMBER', + 'FORMATPERCENT', 'FREEFILE', 'FV', 'GETALLSETTINGS', 'GETATTRGETOBJECT', 'GETSETTING', + 'HEX', 'HEX$', 'HOUR', 'IIF', 'IMESTATUS', 'INPUT$', 'INPUTB', 'INPUTB$', 'INPUTBOX', + 'INSTR', 'INSTRB', 'INSTRREV', 'INT', 'IPMT', 'IRR', 'ISARRAY', 'ISDATE', 'ISEMPTY', + 'ISERROR', 'ISNULL', 'ISNUMERIC', 'ISOBJECT', 'JOIN', 'LBOUND', 'LCASE', 'LCASE$', + 'LEFT', 'LEFT$', 'LEFTB', 'LEFTB$', 'LENB', 'LINEINPUT', 'LOC', 'LOF', 'LOG', 'LTRIM', + 'LTRIM$', 'MID$', 'MIDB', 'MIDB$', 'MINUTE', 'MIRR', 'MKDIR', 'MONTH', 'MONTHNAME', + 'MSGBOX', 'NOW', 'NPER', 'NPV', 'OCT', 'OCT$', 'PARTITION', 'PMT', 'PPMT', 'PV', + 'RATE', 'REPLACE', 'RIGHT', 'RIGHT$', 'RIGHTB', 'RIGHTB$', 'RMDIR', 'RND', 'RTRIM', + 'RTRIM$', 'SECOND', 'SIN', 'SLN', 'SPACE', 'SPACE$', 'SPC', 'SPLIT', 'STR', 'STR$', + 'STRCOMP', 'STRCONV', 'STRING$', 'STRREVERSE', 'SYD', 'TAB', 'TAN', 'TIMEOFDAY', + 'TIMER', 'TIMESERIAL', 'TIMEVALUE', 'TODAY', 'TRIM', 'TRIM$', 'TYPENAME', 'UBOUND', + 'UCASE', 'UCASE$', 'VAL', 'WEEKDAY', 'WEEKDAYNAME', 'YEAR' + ), + 8 => array( + 'ANY', 'ATN', 'CALENDAR', 'CIRCLE', 'CURRENCY', 'DEFBOOL', 'DEFBYTE', 'DEFCUR', + 'DEFDATE', 'DEFDBL', 'DEFDEC', 'DEFINT', 'DEFLNG', 'DEFOBJ', 'DEFSNG', 'DEFSTR', + 'DEFVAR', 'EQV', 'GOSUB', 'IMP', 'INITIALIZE', 'ISMISSING', 'LET', 'LINE', 'LSET', + 'RSET', 'SGN', 'SQR', 'TERMINATE', 'VARIANT', 'VARTYPE', 'WEND' + ), + ), + 'SYMBOLS' => array( + '&', '&=', '*', '*=', '+', '+=', '-', '-=', '//', '/', '/=', '=', '\\', '\\=', + '^', '^=' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #0600FF;', //Constants + 2 => 'color: #FF8000;', //Keywords + 3 => 'color: #008000;', //Data Types + 4 => 'color: #FF0000;', //Objects + 5 => 'color: #804040;', //Operators + 6 => 'color: #0600FF;', //Statements + 7 => 'color: #0600FF;', //Functions + 8 => 'color: #0600FF;' //Deprecated + ), + 'COMMENTS' => array( + 1 => 'color: #008080; font-style: italic;', + 'MULTI' => 'color: #008080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #008080; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' + ), + 'STRINGS' => array( + 0 => 'color: #808080;' + ), + 'NUMBERS' => array( + 0 => 'color: #FF0000;' + ), + 'METHODS' => array( + 1 => 'color: #0000FF;' + ), + 'SYMBOLS' => array( + 0 => 'color: #008000;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => 'http://www.google.com/search?q={FNAME}+msdn.microsoft.com', + 4 => '' + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 =>'.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/vhdl.php b/plugins/dokuwiki/inc/geshi/vhdl.php new file mode 100644 index 0000000..9ad7bab --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/vhdl.php @@ -0,0 +1,140 @@ + 'VHDL', + 'COMMENT_SINGLE' => array(1 => '--'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + /*keywords*/ + 1 => array( + 'access','after','alias','all','assert','architecture','begin', + 'block','body','buffer','bus','case','component','configuration','constant', + 'disconnect','downto','else','elsif','end','entity','exit','file','for', + 'function','generate','generic','group','guarded','if','impure','in', + 'inertial','inout','is','label','library','linkage','literal','loop', + 'map','new','next','null','of','on','open','others','out','package', + 'port','postponed','procedure','process','pure','range','record','register', + 'reject','report','return','select','severity','signal','shared','subtype', + 'then','to','transport','type','unaffected','units','until','use','variable', + 'wait','when','while','with','note','warning','error','failure','and', + 'or','xor','not','nor' + ), + /*types*/ + 2 => array( + 'bit','bit_vector','character','boolean','integer','real','time','string', + 'severity_level','positive','natural','signed','unsigned','line','text', + 'std_logic','std_logic_vector','std_ulogic','std_ulogic_vector','qsim_state', + 'qsim_state_vector','qsim_12state','qsim_12state_vector','qsim_strength', + 'mux_bit','mux_vector','reg_bit','reg_vector','wor_bit','wor_vector' + ), + /*operators*/ + 3 => array( + '=','<=',':=','=>','==' + ) + ), + 'SYMBOLS' => array( + '[', ']', '(', ')',';','<','>',':' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000000; font-weight: bold;', + 2 => 'color: #aa0000;' + ), + 'COMMENTS' => array( + 1 => 'color: #adadad; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #7f007f;' + ), + 'NUMBERS' => array( + 0 => 'color: #ff0000;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'REGEXPS' => array( + 0 => 'color: #ff0000;', + 1 => 'color: #ff0000;', + 2 => 'color: #ff0000;', + 3 => 'color: #ff0000;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '(\b(0x)[0-9a-fA-F]{2,}[hH]?|\b(0x)?[0-9a-fA-F]{2,}[hH])|'. + '(\b[0-9]{1,}((\.){1}[0-9]{1,}){0,1}(E)[\-]{0,1}[0-9]{1,})|'. + '(\b(ns))|'. + "('[0-9a-zA-Z]+)", + 1 => "\b(''[0-9]'')" + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> diff --git a/plugins/dokuwiki/inc/geshi/visualfoxpro.php b/plugins/dokuwiki/inc/geshi/visualfoxpro.php new file mode 100644 index 0000000..60190e4 --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/visualfoxpro.php @@ -0,0 +1,444 @@ + 'Visual Fox Pro', + 'COMMENT_SINGLE' => array(1 => "//", 2 => "\n*"), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"'), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array('Case', 'Else', '#Else', 'Then', + 'Endcase', 'Enddefine', 'Enddo', 'Endfor', 'Endfunc', 'Endif', 'Endprintjob', + 'Endproc', 'Endscan', 'Endtext', 'Endwith', '#Endif', + '#Elif','#Else','#Endif','#Define','#If','#Include', + '#Itsexpression','#Readclauses','#Region','#Section','#Undef','#Wname', + 'Case','Define','Do','Else','Endcase','Enddefine', + 'Enddo','Endfor','Endfunc','Endif','Endprintjob','Endproc', + 'Endscan','Endtext','Endwith','For','Function','Hidden', + 'If','Local','Lparameter','Lparameters','Next','Otherwise', + 'Parameters','Printjob','Procedure','Protected','Public','Scan', + 'Text','Then','While','With','?','??', + '???','Abs','Accept','Access','Aclass','Acopy', + 'Acos','Adatabases','Adbobjects','Addbs','Addrelationtoenv','Addtabletoenv', + 'Adel','Adir','Aelement','Aerror','Afields','Afont', + 'Agetclass','Agetfileversion','Ains','Ainstance','Alen','Align', + 'Alines','Alltrim','Alter','Amembers','Amouseobj','Anetresources', + 'Ansitooem','Append','Aprinters','Ascan','Aselobj','Asin', + 'Asort','Assert','Asserts','Assist','Asubscript','Asynchronous', + 'At_c','Atan','Atc','Atcc','Atcline','Atline', + 'Atn2','Aused','Autoform','Autoreport','Avcxclasses','Average', + 'BarCount','BarPrompt','BatchMode','BatchUpdateCount','Begin','BellSound', + 'BinToC','Bintoc','Bitand','Bitclear','Bitlshift','Bitnot', + 'Bitor','Bitrshift','Bitset','Bittest','Bitxor','Bof', + 'Browse','BrowseRefresh','Buffering','BuilderLock','COMArray','COMReturnError', + 'CToBin','Calculate','Call','Capslock','Cd','Cdow', + 'Ceiling','Central','Change','Char','Chdir','Chr', + 'Chrsaw','Chrtran','Chrtranc','Close','Cmonth','Cntbar', + 'Cntpad','Col','Comclassinfo','CommandTargetQuery','Compile','Completed', + 'Compobj','Compute','Concat','ConnectBusy','ConnectHandle','ConnectName', + 'ConnectString','ConnectTimeOut','ContainerReleaseType','Continue','Copy','Cos', + 'Cot','Count','Coverage','Cpconvert','Cpcurrent','Cpdbf', + 'Cpnotrans','Create','CreateBinary','Createobject','Createobjectex','Createoffline', + 'CrsBuffering','CrsFetchMemo','CrsFetchSize','CrsMaxRows','CrsMethodUsed','CrsNumBatch', + 'CrsShareConnection','CrsUseMemoSize','CrsWhereClause','Ctobin','Ctod','Ctot', + 'Curdate','Curdir','CurrLeft','CurrSymbol','CursorGetProp','CursorSetProp', + 'Curtime','Curval','DBGetProp','DBSetProp','DB_BufLockRow','DB_BufLockTable', + 'DB_BufOff','DB_BufOptRow','DB_BufOptTable','DB_Complette','DB_DeleteInsert','DB_KeyAndModified', + 'DB_KeyAndTimestamp','DB_KeyAndUpdatable','DB_LocalSQL','DB_NoPrompt','DB_Prompt','DB_RemoteSQL', + 'DB_TransAuto','DB_TransManual','DB_TransNone','DB_Update','Datetime','Day', + 'Dayname','Dayofmonth','Dayofweek','Dayofyear','Dbalias','Dbused', + 'Ddeaborttrans','Ddeadvise','Ddeenabled','Ddeexecute','Ddeinitiate','Ddelasterror', + 'Ddepoke','Dderequest','Ddesetoption','Ddesetservice','Ddesettopic','Ddeterminate', + 'Debugout','Declare','DefOLELCid','DefaultValue','Defaultext','Degrees', + 'DeleteTrigger','Desc','Description','Difference','Dimension','Dir', + 'Directory','Diskspace','DispLogin','DispWarnings','Display','Dll', + 'Dmy','DoDefault','DoEvents','Doc','Doevents','Dow', + 'Drivetype','Drop','Dropoffline','Dtoc','Dtor','Dtos', + 'Dtot','DynamicInputMask','Each','Edit','Eject','Elif', + 'End','Eof','Erase','Evaluate','Event','Eventtracking', + 'Exclude','Exclusive','Exit','Exp','Export','External', + 'FDate','FTime','Fchsize','Fclose','Fcount','Fcreate', + 'Feof','Ferror','FetchMemo','FetchSize','Fflush','Fgets', + 'Filer','Filetostr','Find','Fklabel','Fkmax','Fldlist', + 'Flock','Floor','Flush','Fontmetric','Fopen','Forceext', + 'Forcepath','FormSetClass','FormSetLib','FormsClass','FormsLib','Found', + 'FoxPro','Foxcode','Foxdoc','Foxgen','Foxgraph','Foxview', + 'Fputs','Fread','French','Fseek','Fsize','Fv', + 'Fwrite','Gather','German','GetPem','Getbar','Getcolor', + 'Getcp','Getdir','Getenv','Getexpr','Getfile','Getfldstate', + 'Getfont','Gethost','Getnextmodified','Getobject','Getpad','Getpict', + 'Getprinter','Go','Gomonth','Goto','Graph','GridHorz', + 'GridShow','GridShowPos','GridSnap','GridVert','Help','HelpOn', + 'HelpTo','HighLightRow','Home','Hour','IMEStatus','IdleTimeOut', + 'Idxcollate','Ifdef','Ifndef','Iif','Import','Include', + 'Indbc','Index','Indexseek','Inkey','Inlist','Input', + 'Insert','InsertTrigger','Insmode','IsBlank','IsFLocked','IsLeadByte', + 'IsMouse','IsNull','IsRLocked','Isalpha','Iscolor','Isdigit', + 'Isexclusive','Isflocked','Ishosted','Islower','Isreadonly','Isrlocked', + 'Isupper','Italian','Japan','Join','Justdrive','Justext', + 'Justfname','Justpath','Juststem','KeyField','KeyFieldList','Keyboard' + ), + 2 => array('Keymatch','LastProject','Lastkey','Lcase','Leftc','Len', + 'Lenc','Length','Likec','Lineno','LoadPicture','Loadpicture', + 'Locate','Locfile','Log','Log10','Logout','Lookup', + 'Loop','Lower','Ltrim','Lupdate','Mail','MaxRecords', + 'Mcol','Md','Mdown','Mdx','Mdy','Memlines', + 'Menu','Messagebox','Minute','Mkdir','Mline','Modify', + 'Month','Monthname','Mouse','Mrkbar','Mrkpad','Mrow', + 'Mtdll','Mton','Mwindow','Native','Ndx','Network', + 'NoFilter','Nodefault','Normalize','Note','Now','Ntom', + 'NullString','Numlock','Nvl','ODBChdbc','ODBChstmt','OLEDropTextInsertion', + 'OLELCid','Objnum','Objref','Objtoclient','Objvar','Occurs', + 'Oemtoansi','Oldval','OlePublic','Olereturnerror','On','Open', + 'Oracle','Order','Os','Outer','PCount','Pack', + 'PacketSize','Padc','Padl','Padr','Payment','Pcol', + 'PemStatus','Pi','Pivot','Play','Pop','Popup', + 'Power','PrimaryKey','Printstatus','Private','Prmbar','Prmpad', + 'ProjectClick','Proper','Prow','Prtinfo','Push','Putfile', + 'Pv','Qpr','Quater','QueryTimeOut','Quit','Radians', + 'Rand','Rat','Ratc','Ratline','Rd','Rdlevel', + 'Read','Readkey','Recall','Reccount','RecentlyUsedFiles','Recno', + 'Recsize','Regional','Reindex','RelatedChild','RelatedTable','RelatedTag', + 'Remove','Rename','Repeat','Replace','Replicate','Report', + 'ResHeight','ResWidth','ResourceOn','ResourceTo','Resources','Restore', + 'Resume','Retry','Return','Revertoffline','Rgbscheme','Rightc', + 'Rlock','Rmdir','Rollback','Round','Rtod','Rtrim', + 'RuleExpression','RuleText','Run','Runscript','Rview','SQLAsynchronous', + 'SQLBatchMode','SQLCancel','SQLColumns','SQLConnect','SQLConnectTimeOut','SQLDisconnect', + 'SQLDispLogin','SQLDispWarnings','SQLExec','SQLGetProp','SQLIdleTimeOut','SQLMoreResults', + 'SQLPrepare','SQLQueryTimeOut','SQLSetProp','SQLTables','SQLTransactions','SQLWaitTime', + 'Save','SavePicture','Savepicture','ScaleUnits','Scatter','Scols', + 'Scroll','Sec','Second','Seek','Select','SendUpdates', + 'Set','SetDefault','Setfldstate','Setup','ShareConnection','ShowOLEControls', + 'ShowOLEInsertable','ShowVCXs','Sign','Sin','Size','SizeBox', + 'Skpbar','Skppad','Sort','Soundex','SourceName','Sqlcommit', + 'Sqll','Sqlrollback','Sqlstringconnect','Sqrt','Srows','StatusBar', + 'Store','Str','Strconv','Strtofile','Strtran','Stuff', + 'Stuffc','Substr','Substrc','Substring','Sum','Suspend', + 'Sys','Sysmetric','TabOrdering','Table','TableRefresh','Tablerevert', + 'Tableupdate','TagCount','TagNo','Tan','Target','This', + 'Thisform','Thisformset','Timestamp','Timestampdiff','Total','Transactions', + 'Transform','Trim','Truncate','Ttoc','Ttod','Txnlevel', + 'Txtwidth','Type','Ucase','Undefine','Unlock','Unpack', + 'Updatable','UpdatableFieldList','Update','UpdateName','UpdateNameList','UpdateTrigger', + 'UpdateType','Updated','Upper','Upsizing','Usa','Use', + 'UseMemoSize','Used','Val','Validate','Varread','Vartype', + 'Version','VersionLanguage','Wait','WaitTime','Wborder','Wchild', + 'Wcols','Week','Wexist','Wfont','WhereType','Windcmd', + 'Windhelp','Windmemo','Windmenu','Windmodify','Windquery','Windscreen', + 'Windsnip','Windstproc','WizardPrompt','Wlast','Wlcol','Wlrow', + 'Wmaximum','Wminimum','Wontop','Woutput','Wparent','Wread', + 'Wrows','Wtitle','Wvisible','Year','Zap','_Alignment', + '_Asciicols','_Asciirows','_Assist','_Beautify','_Box','_Browser', + '_Builder','_Calcmem','_Calcvalue','_Cliptext','_Converter','_Coverage', + '_Curobj','_Dblclick','_Diarydate','_Dos','_Foxdoc','_Foxgraph', + '_Gallery','_Gengraph','_Genhtml','_Genmenu','_Genpd','_Genscrn', + '_Genxtab','_Getexpr','_Include','_Indent','_Lmargin','_Mac', + '_Mbr_appnd','_Mbr_cpart','_Mbr_delet','_Mbr_font','_Mbr_goto','_Mbr_grid', + '_Mbr_link','_Mbr_mode','_Mbr_mvfld','_Mbr_mvprt','_Mbr_seek','_Mbr_sp100', + '_Mbr_sp200','_Mbr_szfld','_Mbrowse','_Mda_appnd','_Mda_avg','_Mda_brow', + '_Mda_calc','_Mda_copy','_Mda_count','_Mda_label','_Mda_pack','_Mda_reprt', + '_Mda_rindx','_Mda_setup','_Mda_sort','_Mda_sp100','_Mda_sp200','_Mda_sp300', + '_Mda_sum','_Mda_total','_Mdata','_Mdiary','_Med_clear','_Med_copy', + '_Med_cut','_Med_cvtst','_Med_find','_Med_finda','_Med_goto','_Med_insob', + '_Med_link','_Med_obj','_Med_paste','_Med_pref','_Med_pstlk','_Med_redo', + '_Med_repl','_Med_repla','_Med_slcta','_Med_sp100','_Med_sp200','_Med_sp300', + '_Med_sp400','_Med_sp500','_Med_undo','_Medit','_Mfi_clall','_Mfi_close', + '_Mfi_export','_Mfi_import','_Mfi_new','_Mfi_open','_Mfi_pgset','_Mfi_prevu', + '_Mfi_print','_Mfi_quit','_Mfi_revrt','_Mfi_savas','_Mfi_save','_Mfi_send', + '_Mfi_setup','_Mfi_sp100','_Mfi_sp200','_Mfi_sp300','_Mfi_sp400','_Mfile', + '_Mfiler','_Mfirst','_Mlabel','_Mlast','_Mline','_Mmacro', + '_Mmbldr','_Mpr_beaut','_Mpr_cancl','_Mpr_compl','_Mpr_do','_Mpr_docum', + '_Mpr_formwz','_Mpr_gener','_Mpr_graph','_Mpr_resum','_Mpr_sp100','_Mpr_sp200', + '_Mpr_sp300','_Mpr_suspend','_Mprog','_Mproj','_Mrc_appnd','_Mrc_chnge', + '_Mrc_cont','_Mrc_delet','_Mrc_goto','_Mrc_locat','_Mrc_recal','_Mrc_repl', + '_Mrc_seek','_Mrc_sp100','_Mrc_sp200','_Mrecord','_Mreport','_Mrqbe', + '_Mscreen','_Msm_data','_Msm_edit','_Msm_file','_Msm_format','_Msm_prog', + '_Msm_recrd','_Msm_systm','_Msm_text','_Msm_tools','_Msm_view','_Msm_windo', + '_Mst_about','_Mst_ascii','_Mst_calcu','_Mst_captr','_Mst_dbase','_Mst_diary', + '_Mst_filer','_Mst_help','_Mst_hphow','_Mst_hpsch','_Mst_macro','_Mst_office', + '_Mst_puzzl','_Mst_sp100','_Mst_sp200','_Mst_sp300','_Mst_specl','_Msysmenu', + '_Msystem','_Mtable','_Mtb_appnd','_Mtb_cpart','_Mtb_delet','_Mtb_delrc', + '_Mtb_goto','_Mtb_link','_Mtb_mvfld','_Mtb_mvprt','_Mtb_props','_Mtb_recal', + '_Mtb_sp100','_Mtb_sp200','_Mtb_sp300','_Mtb_sp400','_Mtb_szfld','_Mwi_arran', + '_Mwi_clear','_Mwi_cmd','_Mwi_color','_Mwi_debug','_Mwi_hide','_Mwi_hidea', + '_Mwi_min','_Mwi_move','_Mwi_rotat','_Mwi_showa','_Mwi_size','_Mwi_sp100', + '_Mwi_sp200','_Mwi_toolb','_Mwi_trace','_Mwi_view','_Mwi_zoom','_Mwindow', + '_Mwizards','_Mwz_all','_Mwz_form','_Mwz_foxdoc','_Mwz_import','_Mwz_label', + '_Mwz_mail','_Mwz_pivot','_Mwz_query','_Mwz_reprt','_Mwz_setup','_Mwz_table', + '_Mwz_upsizing','_Netware','_Oracle','_Padvance','_Pageno','_Pbpage', + '_Pcolno','_Pcopies','_Pdparms','_Pdriver','_Pdsetup','_Pecode', + '_Peject','_Pepage','_Pform','_Plength','_Plineno','_Ploffset', + '_Ppitch','_Pquality','_Pretext','_Pscode','_Pspacing','_Pwait', + '_Rmargin','_Runactivedoc','_Samples','_Screen','_Shell','_Spellchk', + '_Sqlserver','_Startup','_Tabs','_Tally','_Text','_Throttle', + '_Transport','_Triggerlevel','_Unix','_WebDevOnly','_WebMenu','_WebMsftHomePage', + '_WebVFPHomePage','_WebVfpOnlineSupport','_Windows','_Wizard','_Wrap','_scctext', + '_vfp','Additive','After','Again','Aindent','Alignright', + 'All','Alt','Alternate','And','Ansi','Any', + 'Aplabout','App','Array','As','Asc','Ascending', + 'Ascii','At','Attributes','Automatic','Autosave','Avg', + 'Bar','Before','Bell','Between','Bitmap','Blank', + 'Blink','Blocksize','Border','Bottom','Brstatus','Bucket', + 'Buffers','By','Candidate','Carry','Cascade','Catalog', + 'Cdx','Center','Century','Cga','Character','Check', + 'Classlib','Clock','Cnt','Codepage','Collate','Color', + 'Com1','Com2','Command','Compact','Compatible','Compress', + 'Confirm','Connection','Connections','Connstring','Console','Copies', + 'Cpcompile','Cpdialog','Csv','Currency','Cycle','Databases', + 'Datasource','Date','Db4','Dbc','Dbf','Dbmemo3', + 'Debug','Decimals','Defaultsource','Deletetables','Delimited','Delimiters', + 'Descending','Design','Development','Device','Dif','Disabled', + 'Distinct','Dlls','Dohistory','Dos','Dosmem','Double', + 'Driver','Duplex','Echo','Editwork','Ega25','Ega43', + 'Ems','Ems64','Encrypt','Encryption','Environment','Escape', + 'Events','Exact','Except','Exe','Exists','Expression', + 'Extended','F','Fdow','Fetch','Field','Fields', + 'File','Files','Fill','Fixed','Float','Foldconst', + 'Font','Footer','Force','Foreign','Fox2x','Foxplus', + 'Free','Freeze','From','Fullpath','Fw2','Fweek', + 'Get','Gets','Global','Group','Grow','Halfheight', + 'Having','Heading','Headings','Helpfilter','History','Hmemory', + 'Hours','Id','In','Indexes','Information','Instruct', + 'Int','Integer','Intensity','Intersect','Into','Is', + 'Isometric','Key','Keycolumns','Keycomp','Keyset','Last', + 'Ledit','Level','Library','Like','Linked','Lock', + 'Logerrors','Long','Lpartition','Mac','Macdesktop','Machelp', + 'Mackey','Macros','Mark','Master','Max','Maxmem', + 'Mdi','Memlimit','Memory','Memos','Memowidth','Memvar', + 'Menus','Messages','Middle','Min','Minimize','Minus', + 'Mod','Modal','Module','Mono43','Movers','Multilocks', + 'Mvarsiz','Mvcount','N','Near','Negotiate','Noalias', + 'Noappend','Noclear','Noclose','Noconsole','Nocptrans','Nodata', + 'Nodebug','Nodelete','Nodup','Noedit','Noeject','Noenvironment', + 'Nofloat','Nofollow','Nogrow','Noinit','Nolgrid','Nolink', + 'Nolock','Nomargin','Nomdi','Nomenu','Nominimize','Nomodify' + ), + 3 => array('Nomouse','None','Nooptimize','Nooverwrite','Noprojecthook','Noprompt', + 'Noread','Norefresh','Norequery','Norgrid','Norm','Normal', + 'Nosave','Noshadow','Noshow','Nospace','Not','Notab', + 'Notify','Noupdate','Novalidate','Noverify','Nowait','Nowindow', + 'Nowrap','Nozoom','Npv','Null','Number','Objects', + 'Odometer','Of','Off','Oleobjects','Only','Optimize', + 'Or','Orientation','Output','Outshow','Overlay','Overwrite', + 'Pad','Palette','Paperlength','Papersize','Paperwidth','Password', + 'Path','Pattern','Pause','Pdox','Pdsetup','Pen', + 'Pfs','Pixels','Plain','Popups','Precision','Preference', + 'Preview','Primary','Printer','Printquality','Procedures','Production', + 'Program','Progwork','Project','Prompt','Query','Random', + 'Range','Readborder','Readerror','Record','Recover','Redit', + 'Reference','References','Relative','Remote','Reprocess','Resource', + 'Rest','Restrict','Rgb','Right','Row','Rowset', + 'Rpd','Runtime','Safety','Same','Sample','Say', + 'Scale','Scheme','Scoreboard','Screen','Sdf','Seconds', + 'Selection','Shadows','Shared','Sheet','Shell','Shift', + 'Shutdown','Single','Some','Sortwork','Space','Sql', + 'Standalone','Status','Std','Step','Sticky','String', + 'Structure','Subclass','Summary','Sylk','Sysformats','Sysmenus', + 'System','T','Tab','Tables','Talk','Tedit', + 'Textmerge','Time','Timeout','Titles','Tmpfiles','To', + 'Topic','Transaction','Trap','Trbetween','Trigger','Ttoption', + 'Typeahead','Udfparms','Union','Unique','Userid','Users', + 'Values','Var','Verb','Vga25','Vga50','Views', + 'Volume','Where','Windows','Wk1','Wk3','Wks', + 'Workarea','Wp','Wr1','Wrap','Wrk','Xcmdfile', + 'Xl5','Xl8','Xls','Y','Yresolution','Zoom', + 'Activate','ActivateCell','Add','AddColumn','AddItem','AddListItem', + 'AddObject','AddProperty','AddToSCC','AfterBuild','AfterCloseTables','AfterDock', + 'AfterRowColChange','BeforeBuild','BeforeDock','BeforeOpenTables','BeforeRowColChange','Box', + 'Build','CheckIn','CheckOut','Circle','Clear','ClearData', + 'Cleanup','Click','CloneObject','CloseEditor','CloseTables','Cls', + 'CommandTargetExec','CommandTargetQueryStas','ContainerRelease','DataToClip','DblClick','Deactivate', + 'Delete','DeleteColumn','Deleted','Destroy','DoCmd','Dock', + 'DoScroll','DoVerb','DownClick','Drag','DragDrop','DragOver', + 'DropDown','Draw','EnterFocus','Error','ErrorMessage','Eval', + 'ExitFocus','FormatChange','GetData','GetFormat','GetLatestVersion','GoBack', + 'GotFocus','GoForward','GridHitTest','Hide','HideDoc','IndexToItemId', + 'Init','InteractiveChange','Item','ItemIdToIndex','KeyPress','Line', + 'Load','LostFocus','Message','MiddleClick','MouseDown','MouseMove', + 'MouseUp','MouseWheel','Move','Moved','NavigateTo','Newobject', + 'OLECompleteDrag','OLEDrag','OLEDragDrop','OLEDragOver','OLEGiveFeedback','OLESetData', + 'OLEStartDrag','OpenEditor','OpenTables','Paint','Point','Print', + 'ProgrammaticChange','PSet','QueryAddFile','QueryModifyFile','QueryRemoveFile','QueryRunFile', + 'QueryUnload','RangeHigh','RangeLow','ReadActivate','ReadExpression','ReadDeactivate', + 'ReadMethod','ReadShow','ReadValid','ReadWhen','Refresh','Release', + 'RemoveFromSCC','RemoveItem','RemoveListItem','RemoveObject','Requery','RequestData', + 'Reset','ResetToDefault','Resize','RightClick','SaveAs','SaveAsClass', + 'Scrolled','SetAll','SetData','SetFocus','SetFormat','SetMain', + 'SetVar','SetViewPort','ShowDoc','ShowWhatsThis','TextHeight','TextWidth', + 'Timer','UIEnable','UnDock','UndoCheckOut','Unload','UpClick', + 'Valid','WhatsThisMode','When','WriteExpression','WriteMethod','ZOrder', + 'ATGetColors','ATListColors','Accelerate','ActiveColumn','ActiveControl','ActiveForm', + 'ActiveObjectId','ActivePage','ActiveProject','ActiveRow','AddLineFeeds','Alias', + 'Alignment','AllowAddNew','AllowHeaderSizing','AllowResize','AllowRowSizing','AllowTabs', + 'AlwaysOnTop','Application','AutoActivate','AutoCenter','AutoCloseTables','AutoIncrement', + 'AutoOpenTables','AutoRelease','AutoSize','AutoVerbMenu','AutoYield','AvailNum', + 'BackColor','BackStyle','BaseClass','BorderColor','BorderStyle','BorderWidth', + 'Bound','BoundColumn','BoundTo','BrowseAlignment','BrowseCellMarg','BrowseDestWidth', + 'BufferMode','BufferModeOverride','BuildDateTime','ButtonCount','ButtonIndex','Buttons', + 'CLSID','CanAccelerate','CanGetFocus','CanLoseFocus','Cancel','Caption', + 'ChildAlias','ChildOrder','Class','ClassLibrary','ClipControls','ClipRect', + 'Closable','ColorScheme','ColorSource','ColumnCount','ColumnHeaders','ColumnLines', + 'ColumnOrder','ColumnWidths','Columns','Comment','ContinuousScroll','ControlBox', + 'ControlCount','ControlIndex','ControlSource','Controls','CurrentControl','CurrentX', + 'CurrentY','CursorSource','Curvature','DataSession','DataSessionId','DataSourceObj', + 'DataType','Database','DateFormat','DateMark','DefButton','DefButtonOrig', + 'DefHeight','DefLeft','DefTop','DefWidth','Default','DefaultFilePath', + 'DefineWindows','DeleteMark','Desktop','Dirty','DisabledBackColor','DisabledByEOF', + 'DisabledForeColor','DisabledItemBackColor','DisabledItemForeColor','DisabledPicture','DispPageHeight','DispPageWidth', + 'DisplayCount','DisplayValue','DoCreate','DockPosition','Docked','DocumentFile', + 'DownPicture','DragIcon','DragMode','DragState','DrawMode','DrawStyle', + 'DrawWidth','DynamicAlignment','DynamicBackColor','DynamicCurrentControl','DynamicFontBold','DynamicFontItalic', + 'DynamicFontName','DynamicFontOutline','DynamicFontShadow','DynamicFontSize','DynamicFontStrikethru','DynamicFontUnderline', + 'DynamicForeColor','EditFlags','Enabled','EnabledByReadLock','Encrypted','EnvLevel', + 'ErasePage','FileClass','FileClassLibrary','FillColor','FillStyle','Filter', + 'FirstElement','FontBold','FontItalic','FontName','FontOutline','FontShadow', + 'FontSize','FontStrikethru','FontUnderline','ForceFocus','ForeColor','FormCount', + 'FormIndex','FormPageCount','FormPageIndex','Format','Forms','FoxFont', + 'FullName','GoFirst','GoLast','GridLineColor','GridLineWidth','GridLines' + ), + 4 => array('HPROJ','HWnd','HalfHeightCaption','HasClip','HeaderGap','HeaderHeight', + 'Height','HelpContextID','HideSelection','Highlight','HomeDir','HostName', + 'HotKey','HscrollSmallChange','IMEMode','Icon','IgnoreInsert','InResize', + 'Increment','IncrementalSearch','InitialSelectedAlias','InputMask','Instancing','IntegralHeight', + 'Interval','ItemBackColor','ItemData','ItemForeColor','ItemIDData','ItemTips', + 'JustReadLocked','KeyPreview','KeyboardHighValue','KeyboardLowValue','LastModified','Left', + 'LeftColumn','LineSlant','LinkMaster','List','ListCount','ListIndex', + 'ListItem','ListItemId','LockDataSource','LockScreen','MDIForm','MainClass', + 'MainFile','Margin','MaxButton','MaxHeight','MaxLeft','MaxLength', + 'MaxTop','MaxWidth','MemoWindow','MinButton','MinHeight','MinWidth', + 'MouseIcon','MousePointer','Movable','MoverBars','MultiSelect','Name', + 'NapTime','NewIndex','NewItemId','NoDataOnLoad','NoDefine','NotifyContainer', + 'NullDisplay','NumberOfElements','OLEDragMode','OLEDragPicture','OLEDropEffects','OLEDropHasData', + 'OLEDropMode','OLERequestPendingTimeOut','OLEServerBusyRaiseError','OLEServerBusyTimeOut','OLETypeAllowed','OleClass', + 'OleClassId','OleControlContainer','OleIDispInValue','OleIDispOutValue','OleIDispatchIncoming','OleIDispatchOutgoing', + 'OnResize','OneToMany','OpenViews','OpenWindow','PageCount','PageHeight', + 'PageOrder','PageWidth','Pages','Panel','PanelLink','Parent', + 'ParentAlias','ParentClass','Partition','PasswordChar','Picture','ProcessID', + 'ProgID','ProjectHookClass','ProjectHookLibrary','Projects','ReadColors','ReadCycle', + 'ReadFiller','ReadLock','ReadMouse','ReadOnly','ReadSave','ReadSize', + 'ReadTimeout','RecordMark','RecordSource','RecordSourceType','Rect','RelationalExpr', + 'RelativeColumn','RelativeRow','ReleaseErase','ReleaseType','ReleaseWindows','Resizable', + 'RightToLeft','RowHeight','RowSource','RowSourceType','SCCProvider','SCCStatus', + 'SDIForm','ScaleMode','ScrollBars','SelLength','SelStart','SelText', + 'SelectOnEntry','Selected','SelectedBackColor','SelectedForeColor','SelectedID','SelectedItemBackColor', + 'SelectedItemForeColor','SelfEdit','ServerClass','ServerClassLibrary','ServerHelpFile','ServerName', + 'ServerProject','ShowTips','ShowWindow','Sizable','Size','Size', + 'Size','Skip','SkipForm','Sorted','SourceType','Sparse', + 'SpecialEffect','SpinnerHighValue','SpinnerLowValue','SplitBar','StartMode','StatusBarText', + 'Stretch','StrictDateEntry','Style','SystemRefCount','TabIndex','TabStop', + 'TabStretch','TabStyle','Tabhit','Tabs','Tag','TerminateRead', + 'ThreadID','TitleBar','ToolTipText','Top','TopIndex','TopItemId', + 'TypeLibCLSID','TypeLibDesc','TypeLibName','UnlockDataSource','Value','ValueDirty', + 'VersionComments','VersionCompany','VersionCopyright','VersionDescription','VersionNumber','VersionProduct', + 'VersionTrademarks','View','ViewPortHeight','ViewPortLeft','ViewPortTop','ViewPortWidth', + 'Visible','VscrollSmallChange','WasActive','WasOpen','WhatsThisButton','WhatsThisHelp', + 'WhatsThisHelpID','Width','WindowList','WindowNTIList','WindowState','WindowType', + 'WordWrap','ZOrderSet','ActiveDoc','Checkbox','Column','ComboBox', + 'CommandButton','CommandGroup','Container','Control','Cursor','Custom', + 'DataEnvironment','EditBox','Empty','FontClass','Form','Formset', + 'General','Grid','Header','HyperLink','Image','Label', + 'ListBox','Memo','OleBaseControl','OleBoundControl','OleClassIDispOut','OleControl', + 'OptionButton','OptionGroup','Page','PageFrame','ProjectHook','RectClass', + 'Relation','Session','Shape','Spinner','TextBox' ,'Toolbar' + ), + ), + 'SYMBOLS' => array("!", "@", "$", "%", "(", ")", "-", "+", "=", "/", "{", "}", "[", "]", ":", ";", ",", " ", ".", "*", "&"), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: blue;', + 2 => 'color: blue;', + 3 => 'color: blue;', + 4 => 'color: blue;' + ), + 'COMMENTS' => array( + 1 => 'color: green; font-style: italic;', + 2 => 'color: green font-style: italic;', + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: blue;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + 1 => 'color: #006600;' + ), + 'SYMBOLS' => array( + 0 => 'color: blue;' + ), + 'REGEXPS' => array( + ), + 'SCRIPT' => array( + ) + ), + 'OOLANG' => true, + 'OBJECT_SPLITTERS' => array( + 1 => '.' + ), + 'REGEXPS' => array( + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/plugins/dokuwiki/inc/geshi/xml.php b/plugins/dokuwiki/inc/geshi/xml.php new file mode 100644 index 0000000..eb42d6a --- /dev/null +++ b/plugins/dokuwiki/inc/geshi/xml.php @@ -0,0 +1,147 @@ + 'XML', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(''), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '', + 'KEYWORDS' => array( + ), + 'SYMBOLS' => array( + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + ), + 'COMMENTS' => array( + 'MULTI' => 'color: #808080; font-style: italic;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #66cc66;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + 0 => 'color: #00bbdd;', + 1 => 'color: #ddbb00;', + 2 => 'color: #339933;', + 3 => 'color: #009900;' + ), + 'REGEXPS' => array( + 0 => 'color: #000066;', + 1 => 'font-weight: bold; color: black;', + 2 => 'font-weight: bold; color: black;', + ) + ), + 'URLS' => array( + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => array( + GESHI_SEARCH => '([a-z\-:]+)(=)', + GESHI_REPLACE => '\\1', + GESHI_MODIFIERS => 'i', + GESHI_BEFORE => '', + GESHI_AFTER => '\\2' + ), + 1 => array( + GESHI_SEARCH => '(<[/?|(\?xml)]?[a-z0-9_\-:]*(\??>)?)', + GESHI_REPLACE => '\\1', + GESHI_MODIFIERS => 'i', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + 2 => array( + GESHI_SEARCH => '(([/|\?])?>)', + GESHI_REPLACE => '\\1', + GESHI_MODIFIERS => 'i', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ) + ), + 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, + 'SCRIPT_DELIMITERS' => array( + 0 => array( + ' '>' + ), + 1 => array( + '&' => ';' + ), + 2 => array( + ' ']]>' + ), + 3 => array( + '<' => '>' + ) + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + 0 => false, + 1 => false, + 2 => false, + 3 => true + ) +); + +?> diff --git a/plugins/dokuwiki/inc/html.php b/plugins/dokuwiki/inc/html.php new file mode 100644 index 0000000..795e357 --- /dev/null +++ b/plugins/dokuwiki/inc/html.php @@ -0,0 +1,1290 @@ + + */ + + if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + + require_once(DOKU_INC.'inc/parserutils.php'); + +/** + * Convenience function to quickly build a wikilink + * + * @author Andreas Gohr + */ +function html_wikilink($id,$name=NULL,$search=''){ + static $xhtml_renderer = NULL; + if(is_null($xhtml_renderer)){ + require_once(DOKU_INC.'inc/parser/xhtml.php'); + $xhtml_renderer = new Doku_Renderer_xhtml(); + } + + return $xhtml_renderer->internallink($id,$name,$search,true); +} + +/** + * Helps building long attribute lists + * + * @author Andreas Gohr + */ +function html_attbuild($attributes){ + $ret = ''; + foreach ( $attributes as $key => $value ) { + $ret .= $key.'="'.formtext($value).'" '; + } + return trim($ret); +} + +/** + * The loginform + * + * @author Andreas Gohr + */ +function html_login(){ + global $lang; + global $conf; + global $ID; + global $auth; + + print p_locale_xhtml('login'); + ?> +
        +
        +
        + + + +
        +
        + + +
        +
        + canDo('addUser') && actionOK('register')){ + print '

        '; + print $lang['reghere']; + print ': '.$lang['register'].''; + print '

        '; + } + + if ($auth->canDo('modPass') && actionOK('resendpwd')) { + print '

        '; + print $lang['pwdforget']; + print ': '.$lang['btn_resendpwd'].''; + print '

        '; + } + ?> +
        + + */ +function html_secedit_button($matches){ + global $ID; + global $INFO; + + $section = $matches[2]; + $name = $matches[1]; + + $secedit = ''; + $secedit .= '
        '; + $secedit .= html_btn('secedit',$ID,'', + array('do' => 'edit', + 'lines' => "$section", + 'rev' => $INFO['lastmod']), + 'post', $name); + $secedit .= '
        '; + return $secedit; +} + +/** + * inserts section edit buttons if wanted or removes the markers + * + * @author Andreas Gohr + */ +function html_secedit($text,$show=true){ + global $INFO; + + if($INFO['writable'] && $show && !$INFO['rev']){ + $text = preg_replace_callback('##', + 'html_secedit_button', $text); + }else{ + $text = preg_replace('##','',$text); + } + + return $text; +} + +/** + * Just the back to top button (in its own form) + * + * @author Andreas Gohr + */ +function html_topbtn(){ + global $lang; + + $ret = ''; + $ret = ''; + + return $ret; +} + +/** + * Just the back to media window button in its own form + * + * @author Matthias Grimm + */ +function html_backtomedia_button($params,$akey=''){ + global $conf; + global $lang; + + $ret = '
        '; + + reset($params); + while (list($key, $val) = each($params)) { + $ret .= ''; + } + + $ret .= ' + */ +function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ + global $conf; + global $lang; + + $label = $lang['btn_'.$name]; + + $ret = ''; + $tip = ''; + + //filter id (without urlencoding) + $id = idfilter($id,false); + + //make nice URLs even for buttons + if($conf['userewrite'] == 2){ + $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id; + }elseif($conf['userewrite']){ + $script = DOKU_BASE.$id; + }else{ + $script = DOKU_BASE.DOKU_SCRIPT; + $params['id'] = $id; + } + + $ret .= '
        '; + + if(is_array($params)){ + reset($params); + while (list($key, $val) = each($params)) { + $ret .= ''; + } + } + + if ($tooltip!='') { + $tip = htmlspecialchars($tooltip); + }else{ + $tip = htmlspecialchars($label); + } + + $ret .= ' + */ +function html_show($txt=''){ + global $ID; + global $REV; + global $HIGH; + //disable section editing for old revisions or in preview + if($txt || $REV){ + $secedit = false; + }else{ + $secedit = true; + } + + if ($txt){ + //PreviewHeader + print '
        '; + print p_locale_xhtml('preview'); + print '
        '; + print html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); + print '
        '; + print '
        '; + + }else{ + if ($REV) print p_locale_xhtml('showrev'); + $html = p_wiki_xhtml($ID,$REV,true); + $html = html_secedit($html,$secedit); + print html_hilight($html,$HIGH); + } +} + +/** + * ask the user about how to handle an exisiting draft + * + * @author Andreas Gohr + */ +function html_draft(){ + global $INFO; + global $ID; + global $lang; + global $conf; + $draft = unserialize(io_readFile($INFO['draft'],false)); + $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); + + echo p_locale_xhtml('draft'); + ?> +
        + +
        + + +
        + + + + + + + */ +function html_search(){ + require_once(DOKU_INC.'inc/search.php'); + require_once(DOKU_INC.'inc/fulltext.php'); + global $conf; + global $QUERY; + global $ID; + global $lang; + + print p_locale_xhtml('searchpage'); + flush(); + + //check if search is restricted to namespace + if(preg_match('/([^@]*)@([^@]*)/',$QUERY,$match)) { + $id = cleanID($match[1]); + if(empty($id)) { + print '
        '.$lang['nothingfound'].'
        '; + flush(); + return; + } + } else { + $id = cleanID($QUERY); + } + + //show progressbar + print '
        '; + print ''; + print "
        \n"; + flush(); + + //do quick pagesearch + $data = array(); + + $data = ft_pageLookup($id); + if(count($data)){ + sort($data); + print '
        '; + print '

        '.$lang['quickhits'].':

        '; + print '
          '; + foreach($data as $id){ + print '
        • '; + print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); + print '
        • '; + } + print '
        '; + //clear float (see http://www.complexspiral.com/publications/containing-floats/) + print '
         
        '; + print '
        '; + } + flush(); + + //do fulltext search + $data = ft_pageSearch($QUERY,$poswords); + if(count($data)){ + $num = 1; + foreach($data as $id => $cnt){ + print '
        '; + print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); + print ': '.$cnt.' '.$lang['hits'].'
        '; + if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? + print '
        '.ft_snippet($id,$poswords).'
        '; + } + print '
        '; + flush(); + $num++; + } + }else{ + print '
        '.$lang['nothingfound'].'
        '; + } + + //hide progressbar + print ''; + flush(); +} + +/** + * Display error on locked pages + * + * @author Andreas Gohr + */ +function html_locked(){ + global $ID; + global $conf; + global $lang; + global $INFO; + + $locktime = filemtime(wikiLockFN($ID)); + $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); + $min = round(($conf['locktime'] - (time() - $locktime) )/60); + + print p_locale_xhtml('locked'); + print '
          '; + print '
        • '.$lang['lockedby'].': '.$INFO['locked'].'
        • '; + print '
        • '.$lang['lockexpire'].': '.$expire.' ('.$min.' min)
        • '; + print '
        '; +} + +/** + * list old revisions + * + * @author Andreas Gohr + * @author Ben Coburn + */ +function html_revisions($first=0){ + global $ID; + global $INFO; + global $conf; + global $lang; + /* we need to get one additionally log entry to be able to + * decide if this is the last page or is there another one. + * see html_recent() + */ + $revisions = getRevisions($ID, $first, $conf['recent']+1); + if(count($revisions)==0 && $first!=0){ + $first=0; + $revisions = getRevisions($ID, $first, $conf['recent']+1);; + } + $hasNext = false; + if (count($revisions)>$conf['recent']) { + $hasNext = true; + array_pop($revisions); // remove extra log entry + } + + $date = @date($conf['dformat'],$INFO['lastmod']); + + print p_locale_xhtml('revisions'); + print ''; + + print ''; + +} + +/** + * display recent changes + * + * @author Andreas Gohr + * @author Matthias Grimm + * @author Ben Coburn + */ +function html_recent($first=0){ + global $conf; + global $lang; + global $ID; + /* we need to get one additionally log entry to be able to + * decide if this is the last page or is there another one. + * This is the cheapest solution to get this information. + */ + $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); + if(count($recents) == 0 && $first != 0){ + $first=0; + $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); + } + $hasNext = false; + if (count($recents)>$conf['recent']) { + $hasNext = true; + array_pop($recents); // remove extra log entry + } + + print p_locale_xhtml('recent'); + print ''; + + print ''; +} + +/** + * Display page index + * + * @author Andreas Gohr + */ +function html_index($ns){ + require_once(DOKU_INC.'inc/search.php'); + global $conf; + global $ID; + $dir = $conf['datadir']; + $ns = cleanID($ns); + #fixme use appropriate function + if(empty($ns)){ + $ns = dirname(str_replace(':','/',$ID)); + if($ns == '.') $ns =''; + } + $ns = utf8_encodeFN(str_replace(':','/',$ns)); + + print p_locale_xhtml('index'); + + $data = array(); + search($data,$conf['datadir'],'search_index',array('ns' => $ns)); + print html_buildlist($data,'idx','html_list_index','html_li_index'); +} + +/** + * Index item formatter + * + * User function for html_buildlist() + * + * @author Andreas Gohr + */ +function html_list_index($item){ + global $ID; + $ret = ''; + $base = ':'.$item['id']; + $base = substr($base,strrpos($base,':')+1); + if($item['type']=='d'){ + $ret .= ''; + $ret .= $base; + $ret .= ''; + }else{ + $ret .= html_wikilink(':'.$item['id']); + } + return $ret; +} + +/** + * Index List item + * + * This user function is used in html_build_lidt to build the + *
      1. tags for namespaces when displaying the page index + * it gives different classes to opened or closed "folders" + * + * @author Andreas Gohr + */ +function html_li_index($item){ + if($item['type'] == "f"){ + return '
      2. '; + }elseif($item['open']){ + return '
      3. '; + }else{ + return '
      4. '; + } +} + +/** + * Default List item + * + * @author Andreas Gohr + */ +function html_li_default($item){ + return '
      5. '; +} + +/** + * Build an unordered list + * + * Build an unordered list from the given $data array + * Each item in the array has to have a 'level' property + * the item itself gets printed by the given $func user + * function. The second and optional function is used to + * print the
      6. tag. Both user function need to accept + * a single item. + * + * Both user functions can be given as array to point to + * a member of an object. + * + * @author Andreas Gohr + */ +function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ + $level = 0; + $opens = 0; + $ret = ''; + + foreach ($data as $item){ + + if( $item['level'] > $level ){ + //open new list + for($i=0; $i<($item['level'] - $level); $i++){ + if ($i) $ret .= "
      7. \n"; + $ret .= "\n
          \n"; + } + }elseif( $item['level'] < $level ){ + //close last item + $ret .= "\n"; + for ($i=0; $i<($level - $item['level']); $i++){ + //close higher lists + $ret .= "
        \n
      8. \n"; + } + }else{ + //close last item + $ret .= "\n"; + } + + //remember current level + $level = $item['level']; + + //print item + if(is_array($lifunc)){ + $ret .= $lifunc[0]->$lifunc[1]($item); //user object method + }else{ + $ret .= $lifunc($item); //user function + } + $ret .= '
        '; + if(is_array($func)){ + $ret .= $func[0]->$func[1]($item); //user object method + }else{ + $ret .= $func($item); //user function + } + $ret .= '
        '; + } + + //close remaining items and lists + for ($i=0; $i < $level; $i++){ + $ret .= "\n"; + } + + return $ret; +} + +/** + * display backlinks + * + * @author Andreas Gohr + */ +function html_backlinks(){ + require_once(DOKU_INC.'inc/fulltext.php'); + global $ID; + global $conf; + + print p_locale_xhtml('backlinks'); + + $data = ft_backlinks($ID); + + print '
          '; + foreach($data as $blink){ + print '
        • '; + print html_wikilink(':'.$blink,$conf['useheading']?NULL:$blink); + print '
        • '; + } + print '
        '; +} + +/** + * show diff + * + * @author Andreas Gohr + */ +function html_diff($text='',$intro=true){ + require_once(DOKU_INC.'inc/DifferenceEngine.php'); + global $ID; + global $REV; + global $lang; + global $conf; + + if($text){ + $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,''))), + explode("\n",htmlspecialchars(cleanText($text)))); + $left = ''. + $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).''. + $lang['current']; + $right = $lang['yours']; + }else{ + if($REV){ + $r = $REV; + }else{ + //use last revision if none given + $revs = getRevisions($ID, 0, 1); + $r = $revs[0]; + } + + if($r){ + $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,$r))), + explode("\n",htmlspecialchars(rawWiki($ID,'')))); + $left = ''. + $ID.' '.date($conf['dformat'],$r).''; + }else{ + $df = new Diff(array(''), + explode("\n",htmlspecialchars(rawWiki($ID,'')))); + $left = ''. + $ID.''; + } + $right = ''. + $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).' '. + $lang['current']; + } + $tdf = new TableDiffFormatter(); + if($intro) print p_locale_xhtml('diff'); + ?> + + + + + + format($df)?> +
        + + + +
        + + */ +function html_conflict($text,$summary){ + global $ID; + global $lang; + + print p_locale_xhtml('conflict'); + ?> +
        +
        + + + + + + +
        +
        +



        + + */ +function html_msgarea(){ + global $MSG; + + if(!isset($MSG)) return; + + foreach($MSG as $msg){ + print '
        '; + print $msg['msg']; + print '
        '; + } +} + +/** + * Prints the registration form + * + * @author Andreas Gohr + */ +function html_register(){ + global $lang; + global $conf; + global $ID; + + print p_locale_xhtml('register'); +?> +
        +
        +
        + + + + +
        + + +
        +
        + + +
        +
        + +
        +
        +
        + + * @author Andreas Gohr + */ +function html_updateprofile(){ + global $lang; + global $conf; + global $ID; + global $INFO; + global $auth; + + print p_locale_xhtml('updateprofile'); + + if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; + if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; +?> +
        +
        +
        + + + + +
        +
        +

        + + canDo('modPass')) { ?> +
        +
        + + + +
        +
        + + + + +
        +
        +
        + + */ +function html_edit($text=null,$include='edit'){ //FIXME: include needed? + global $ID; + global $REV; + global $DATE; + global $RANGE; + global $PRE; + global $SUF; + global $INFO; + global $SUM; + global $lang; + global $conf; + + //set summary default + if(!$SUM){ + if($REV){ + $SUM = $lang['restored']; + }elseif(!$INFO['exists']){ + $SUM = $lang['created']; + } + } + + //no text? Load it! + if(!isset($text)){ + $pr = false; //no preview mode + if($INFO['exists']){ + if($RANGE){ + list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV); + }else{ + $text = rawWiki($ID,$REV); + } + }else{ + //try to load a pagetemplate + $data = array($ID); + $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); + } + }else{ + $pr = true; //preview mode + } + + $wr = $INFO['writable']; + if($wr){ + if ($REV) print p_locale_xhtml('editrev'); + print p_locale_xhtml($include); + $ro=false; + }else{ + // check pseudo action 'source' + if(!actionOK('source')){ + msg('Command disabled: source',-1); + return; + } + print p_locale_xhtml('read'); + $ro='readonly="readonly"'; + } + if(!$DATE) $DATE = $INFO['lastmod']; + + +?> +
        + +
        +
        +
        + + + + +
        + +
        +
        + + +
        + + + + + +
        + + + +
        +
        + +
        + + + +
        + + +
        + + + +
        + +
        +
        +
        + + */ +function html_minoredit(){ + global $conf; + global $lang; + // minor edits are for logged in users only + if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ + return; + } + + $p = array(); + $p['name'] = 'minor'; + $p['type'] = 'checkbox'; + $p['id'] = 'minoredit'; + $p['tabindex'] = 3; + $p['value'] = '1'; + if(!empty($_REQUEST['minor'])) $p['checked']='checked'; + $att = buildAttributes($p); + + print ''; + print ""; + print ''; + print ''; +} + +/** + * prints some debug info + * + * @author Andreas Gohr + */ +function html_debug(){ + global $conf; + global $lang; + global $auth; + global $INFO; + + //remove sensitive data + $cnf = $conf; + $cnf['auth']='***'; + $cnf['notify']='***'; + $cnf['ftp']='***'; + $nfo = $INFO; + $nfo['userinfo'] = '***'; + $ses = $_SESSION; + $ses[$conf['title']]['auth'] = '***'; + + print ''; + + print '

        When reporting bugs please send all the following '; + print 'output as a mail to andi@splitbrain.org '; + print 'The best way to do this is to save this page in your browser

        '; + + print '$INFO:
        ';
        +  print_r($nfo);
        +  print '
        '; + + print '$_SERVER:
        ';
        +  print_r($_SERVER);
        +  print '
        '; + + print '$conf:
        ';
        +  print_r($cnf);
        +  print '
        '; + + print 'DOKU_BASE:
        ';
        +  print DOKU_BASE;
        +  print '
        '; + + print 'abs DOKU_BASE:
        ';
        +  print DOKU_URL;
        +  print '
        '; + + print 'rel DOKU_BASE:
        ';
        +  print dirname($_SERVER['PHP_SELF']).'/';
        +  print '
        '; + + print 'PHP Version:
        ';
        +  print phpversion();
        +  print '
        '; + + print 'locale:
        ';
        +  print setlocale(LC_ALL,0);
        +  print '
        '; + + print 'encoding:
        ';
        +  print $lang['encoding'];
        +  print '
        '; + + if($auth){ + print 'Auth backend capabilities:
        ';
        +    print_r($auth->cando);
        +    print '
        '; + } + + print '$_SESSION:
        ';
        +  print_r($ses);
        +  print '
        '; + + print 'Environment:
        ';
        +  print_r($_ENV);
        +  print '
        '; + + print 'PHP settings:
        ';
        +  $inis = ini_get_all();
        +  print_r($inis);
        +  print '
        '; + + print ''; +} + +function html_admin(){ + global $ID; + global $lang; + global $conf; + + print p_locale_xhtml('admin'); + + // build menu of admin functions from the plugins that handle them + $pluginlist = plugin_list('admin'); + $menu = array(); + foreach ($pluginlist as $p) { + if($obj =& plugin_load('admin',$p) === NULL) continue; + $menu[] = array('plugin' => $p, + 'prompt' => $obj->getMenuText($conf['lang']), + 'sort' => $obj->getMenuSort() + ); + } + + usort($menu, 'p_sort_modes'); + + // output the menu + ptln('
          '); + + foreach ($menu as $item) { + if (!$item['prompt']) continue; + ptln('
        • '); + } + + ptln('
        '); +} + +/** + * Form to request a new password for an existing account + * + * @author Benoit Chesneau + */ +function html_resendpwd() { + global $lang; + global $conf; + global $ID; + + print p_locale_xhtml('resendpwd'); +?> +
        +
        +
        +
        + + + +
        + +
        +
        +
        + + */ +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); +if(!defined('DOKU_MESSAGEURL')) define('DOKU_MESSAGEURL','http://update.dokuwiki.org/check/'); +require_once(DOKU_INC.'inc/HTTPClient.php'); + +/** + * Check for new messages from upstream + * + * @author Andreas Gohr + */ +function checkUpdateMessages(){ + global $conf; + global $INFO; + if(!$conf['updatecheck']) return; + if($conf['useacl'] && $INFO['perm'] < AUTH_ADMIN) return; + + $cf = $conf['cachedir'].'/messages.txt'; + $lm = @filemtime($cf); + + // check if new messages needs to be fetched + if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_CONF.'msg')){ + $num = @file(DOKU_CONF.'msg'); + $num = is_array($num) ? (int) $num[0] : 0; + $http = new DokuHTTPClient(); + $http->timeout = 8; + $data = $http->get(DOKU_MESSAGEURL.$num); + io_saveFile($cf,$data); + }else{ + $data = io_readFile($cf); + } + + // show messages through the usual message mechanism + $msgs = explode("\n%\n",$data); + foreach($msgs as $msg){ + if($msg) msg($msg,2); + } +} + + +/** + * Return DokuWikis version + * + * @author Andreas Gohr + */ +function getVersion(){ + //import version string + if(@file_exists('VERSION')){ + //official release + return 'Release '.trim(io_readfile(DOKU_INC.'/VERSION')); + }elseif(is_dir('_darcs')){ + //darcs checkout - read last 2000 bytes of inventory + $sz = filesize('_darcs/inventory'); + $seek = max(0,$sz-2000); + $fh = fopen('_darcs/inventory','rb'); + fseek($fh,$seek); + $chunk = fread($fh,2000); + fclose($fh); + $inv = preg_grep('#\*\*\d{14}[\]$]#',explode("\n",$chunk)); + $cur = array_pop($inv); + preg_match('#\*\*(\d{4})(\d{2})(\d{2})#',$cur,$matches); + return 'Darcs '.$matches[1].'-'.$matches[2].'-'.$matches[3]; + }else{ + return 'snapshot?'; + } +} + +/** + * Run a few sanity checks + * + * @author Andreas Gohr + */ +function check(){ + global $conf; + global $INFO; + + msg('DokuWiki version: '.getVersion(),1); + + if(version_compare(phpversion(),'4.3.3','<')){ + msg('Your PHP version is too old ('.phpversion().' vs. 4.3.3+ recommended)',-1); + }elseif(version_compare(phpversion(),'4.3.10','<')){ + msg('Consider upgrading PHP to 4.3.10 or higher for security reasons (your version: '.phpversion().')',0); + }else{ + msg('PHP version '.phpversion(),1); + } + + if(is_writable($conf['changelog'])){ + msg('Changelog is writable',1); + }else{ + if (@file_exists($conf['changelog'])) { + msg('Changelog is not writable',-1); + } + } + + if (isset($conf['changelog_old']) && @file_exists($conf['changelog_old'])) { + msg('Old changelog exists', 0); + } + + if (@file_exists($conf['changelog'].'_failed')) { + msg('Importing old changelog failed', -1); + } else if (@file_exists($conf['changelog'].'_importing')) { + msg('Importing old changelog now.', 0); + } else if (@file_exists($conf['changelog'].'_import_ok')) { + msg('Old changelog imported', 1); + if (!plugin_isdisabled('importoldchangelog')) { + msg('Importoldchangelog plugin not disabled after import', -1); + } + } + + if(is_writable($conf['datadir'])){ + msg('Datadir is writable',1); + }else{ + msg('Datadir is not writable',-1); + } + + if(is_writable($conf['olddir'])){ + msg('Attic is writable',1); + }else{ + msg('Attic is not writable',-1); + } + + if(is_writable($conf['mediadir'])){ + msg('Mediadir is writable',1); + }else{ + msg('Mediadir is not writable',-1); + } + + if(is_writable($conf['cachedir'])){ + msg('Cachedir is writable',1); + }else{ + msg('Cachedir is not writable',-1); + } + + if(is_writable($conf['lockdir'])){ + msg('Lockdir is writable',1); + }else{ + msg('Lockdir is not writable',-1); + } + + if(is_writable(DOKU_CONF.'users.auth.php')){ + msg('conf/users.auth.php is writable',1); + }else{ + msg('conf/users.auth.php is not writable',0); + } + + if(function_exists('mb_strpos')){ + if(defined('UTF8_NOMBSTRING')){ + msg('mb_string extension is available but will not be used',0); + }else{ + msg('mb_string extension is available and will be used',1); + } + }else{ + msg('mb_string extension not available - PHP only replacements will be used',0); + } + + if($conf['allowdebug']){ + msg('Debugging support is enabled. If you don\'t need it you should set $conf[\'allowdebug\'] = 0',-1); + }else{ + msg('Debugging support is disabled',1); + } + + msg('Your current permission for this page is '.$INFO['perm'],0); + + if(is_writable($INFO['filepath'])){ + msg('The current page is writable by the webserver',0); + }else{ + msg('The current page is not writable by the webserver',0); + } + + if($INFO['writable']){ + msg('The current page is writable by you',0); + }else{ + msg('The current page is not writable by you',0); + } +} + +/** + * print a message + * + * If HTTP headers were not sent yet the message is added + * to the global message array else it's printed directly + * using html_msgarea() + * + * + * Levels can be: + * + * -1 error + * 0 info + * 1 success + * + * @author Andreas Gohr + * @see html_msgarea + */ +function msg($message,$lvl=0,$line='',$file=''){ + global $MSG; + $errors[-1] = 'error'; + $errors[0] = 'info'; + $errors[1] = 'success'; + $errors[2] = 'notify'; + + if($line || $file) $message.=' ['.basename($file).':'.$line.']'; + + if(!headers_sent()){ + if(!isset($MSG)) $MSG = array(); + $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + }else{ + $MSG = array(); + $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + if(function_exists('html_msgarea')){ + html_msgarea(); + }else{ + print "ERROR($lvl) $message"; + } + } +} + +/** + * print debug messages + * + * little function to print the content of a var + * + * @author Andreas Gohr + */ +function dbg($msg,$hidden=false){ + (!$hidden) ? print '
        ' : print "";
        +}
        +
        +/**
        + * Print info to a log file
        + *
        + * @author Andreas Gohr 
        + */
        +function dbglog($msg){
        +  global $conf;
        +  $file = $conf['cachedir'].'/debug.log';
        +  $fh = fopen($file,'a');
        +  if($fh){
        +    fwrite($fh,date('H:i:s ').$_SERVER['REMOTE_ADDR'].': '.$msg."\n");
        +    fclose($fh);
        +  }
        +}
        +
        diff --git a/plugins/dokuwiki/inc/init.php b/plugins/dokuwiki/inc/init.php
        new file mode 100644
        index 0000000..272f759
        --- /dev/null
        +++ b/plugins/dokuwiki/inc/init.php
        @@ -0,0 +1,367 @@
        + 'pages',
        +                 'olddir'    => 'attic',
        +                 'mediadir'  => 'media',
        +                 'metadir'   => 'meta',
        +                 'cachedir'  => 'cache',
        +                 'lockdir'   => 'locks');
        +
        +  foreach($paths as $c => $p){
        +    if(empty($conf[$c]))  $conf[$c] = $conf['savedir'].'/'.$p;
        +    $conf[$c]             = init_path($conf[$c]);
        +    if(empty($conf[$c]))  nice_die("The $c does not exist, isn't accessable or writable.
        +                               You should check your config and permission settings.
        +                               Or maybe you want to run the
        +                               installer?");
        +  }
        +
        +  // path to old changelog only needed for upgrading
        +  $conf['changelog_old'] = init_path((isset($conf['changelog']))?($conf['changelog']):($conf['savedir'].'/changes.log'));
        +  if ($conf['changelog_old']=='') { unset($conf['changelog_old']); }
        +  // hardcoded changelog because it is now a cache that lives in meta
        +  $conf['changelog'] = $conf['metadir'].'/_dokuwiki.changes';
        +}
        +
        +/**
        + * Checks the existance of certain files and creates them if missing.
        + */
        +function init_files(){
        +  global $conf;
        +
        +  $files = array( $conf['cachedir'].'/word.idx',
        +                  $conf['cachedir'].'/page.idx',
        +                  $conf['cachedir'].'/index.idx');
        +
        +  foreach($files as $file){
        +    if(!@file_exists($file)){
        +      $fh = @fopen($file,'a');
        +      if($fh){
        +        fclose($fh);
        +        if($conf['fperm']) chmod($file, $conf['fperm']);
        +      }else{
        +        nice_die("$file is not writable. Check your permissions settings!");
        +      }
        +    }
        +  }
        +}
        +
        +/**
        + * Returns absolute path
        + *
        + * This tries the given path first, then checks in DOKU_INC.
        + * Check for accessability on directories as well.
        + *
        + * @author Andreas Gohr 
        + */
        +function init_path($path){
        +  // check existance
        +  $p = realpath($path);
        +  if(!@file_exists($p)){
        +    $p = realpath(DOKU_INC.$path);
        +    if(!@file_exists($p)){
        +      return '';
        +    }
        +  }
        +
        +  // check writability
        +  if(!@is_writable($p)){
        +    return '';
        +  }
        +
        +  // check accessability (execute bit) for directories
        +  if(@is_dir($p) && !@file_exists("$p/.")){
        +    return '';
        +  }
        +
        +  return $p;
        +}
        +
        +/**
        + * Sets the internal config values fperm and dperm which, when set,
        + * will be used to change the permission of a newly created dir or
        + * file with chmod. Considers the influence of the system's umask
        + * setting the values only if needed.
        + */
        +function init_creationmodes(){
        +  global $conf;
        +
        +  // Legacy support for old umask/dmask scheme
        +  unset($conf['dmask']);
        +  unset($conf['fmask']);
        +  unset($conf['umask']);
        +  unset($conf['fperm']);
        +  unset($conf['dperm']);
        +
        +  // get system umask, fallback to 0 if none available
        +  $umask = @umask();
        +  if(!$umask) $umask = 0000;
        +
        +  // check what is set automatically by the system on file creation
        +  // and set the fperm param if it's not what we want
        +  $auto_fmode = 0666 & ~$umask;
        +  if($auto_fmode != $conf['fmode']) $conf['fperm'] = $conf['fmode'];
        +
        +  // check what is set automatically by the system on file creation
        +  // and set the dperm param if it's not what we want
        +  $auto_dmode = $conf['dmode'] & ~$umask;
        +  if($auto_dmode != $conf['dmode']) $conf['dperm'] = $conf['dmode'];
        +}
        +
        +/**
        + * remove magic quotes recursivly
        + *
        + * @author Andreas Gohr 
        + */
        +function remove_magic_quotes(&$array) {
        +  foreach (array_keys($array) as $key) {
        +    if (is_array($array[$key])) {
        +      remove_magic_quotes($array[$key]);
        +    }else {
        +      $array[$key] = stripslashes($array[$key]);
        +    }
        +  }
        +}
        +
        +/**
        + * Returns the full absolute URL to the directory where
        + * DokuWiki is installed in (includes a trailing slash)
        + *
        + * @author Andreas Gohr 
        + */
        +function getBaseURL($abs=false){
        +  global $conf;
        +  //if canonical url enabled always return absolute
        +  if($conf['canonical']) $abs = true;
        +
        +  if($conf['basedir']){
        +    $dir = $conf['basedir'].'/';
        +  }elseif(substr($_SERVER['SCRIPT_NAME'],-4) == '.php'){
        +    $dir = dirname($_SERVER['SCRIPT_NAME']).'/';
        +  }elseif(substr($_SERVER['PHP_SELF'],-4) == '.php'){
        +    $dir = dirname($_SERVER['PHP_SELF']).'/';
        +  }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){
        +    $dir = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
        +                         $_SERVER['SCRIPT_FILENAME']);
        +    $dir = dirname('/'.$dir).'/';
        +  }else{
        +    $dir = './'; //probably wrong
        +  }
        +
        +  $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour
        +  $dir = preg_replace('#//+#','/',$dir);
        +
        +  //handle script in lib/exe dir
        +  $dir = preg_replace('!lib/exe/$!','',$dir);
        +
        +  //handle script in lib/plugins dir
        +  $dir = preg_replace('!lib/plugins/.*$!','',$dir);
        +
        +  //finish here for relative URLs
        +  if(!$abs) return $dir;
        +
        +  //use config option if available
        +  if($conf['baseurl']) return $conf['baseurl'].$dir;
        +
        +  //split hostheader into host and port
        +  list($host,$port) = explode(':',$_SERVER['HTTP_HOST']);
        +  if(!$port)  $port = $_SERVER['SERVER_PORT'];
        +  if(!$port)  $port = 80;
        +
        +  // see if HTTPS is enabled - apache leaves this empty when not available,
        +  // IIS sets it to 'off', 'false' and 'disabled' are just guessing
        +  if (preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){
        +    $proto = 'http://';
        +    if ($port == '80') {
        +      $port='';
        +    }
        +  }else{
        +    $proto = 'https://';
        +    if ($port == '443') {
        +      $port='';
        +    }
        +  }
        +
        +  if($port) $port = ':'.$port;
        +
        +  return $proto.$host.$port.$dir;
        +}
        +
        +/**
        + * Append a PHP extension to a given file and adds an exit call
        + *
        + * This is used to migrate some old configfiles. An added PHP extension
        + * ensures the contents are not shown to webusers even if .htaccess files
        + * do not work
        + *
        + * @author Jan Decaluwe 
        + */
        +function scriptify($file) {
        +  // checks
        +  if (!is_readable($file)) {
        +    return;
        +  }
        +  $fn = $file.'.php';
        +  if (@file_exists($fn)) {
        +    return;
        +  }
        +  $fh = fopen($fn, 'w');
        +  if (!$fh) {
        +    nice_die($fn.' is not writable. Check your permission settings!');
        +  }
        +  // write php exit hack first
        +  fwrite($fh, "# $fn\n");
        +  fwrite($fh, '# '."\n");
        +  fwrite($fh, "# Don't modify the lines above\n");
        +  fwrite($fh, "#\n");
        +  // copy existing lines
        +  $lines = file($file);
        +  foreach ($lines as $line){
        +    fwrite($fh, $line);
        +  }
        +  fclose($fh);
        +  //try to rename the old file
        +  io_rename($file,"$file.old");
        +}
        +
        +/**
        + * print a nice message even if no styles are loaded yet.
        + */
        +function nice_die($msg){
        +  echo<<
        +  
        +    DokuWiki Setup Error
        +    
        +      
        +

        DokuWiki Setup Error

        +

        $msg

        +
        + + +EOT; + exit; +} + + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/io.php b/plugins/dokuwiki/inc/io.php new file mode 100644 index 0000000..d941ef0 --- /dev/null +++ b/plugins/dokuwiki/inc/io.php @@ -0,0 +1,567 @@ + + */ + + if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + require_once(DOKU_INC.'inc/common.php'); + require_once(DOKU_INC.'inc/HTTPClient.php'); + require_once(DOKU_INC.'inc/events.php'); + require_once(DOKU_INC.'inc/utf8.php'); + +/** + * Removes empty directories + * + * Sends IO_NAMESPACE_DELETED events for 'pages' and 'media' namespaces. + * Event data: + * $data[0] ns: The colon separated namespace path minus the trailing page name. + * $data[1] ns_type: 'pages' or 'media' namespace tree. + * + * @todo use safemode hack + * @author Andreas Gohr + * @author Ben Coburn + */ +function io_sweepNS($id,$basedir='datadir'){ + global $conf; + $types = array ('datadir'=>'pages', 'mediadir'=>'media'); + $ns_type = (isset($types[$basedir])?$types[$basedir]:false); + + //scan all namespaces + while(($id = getNS($id)) !== false){ + $dir = $conf[$basedir].'/'.utf8_encodeFN(str_replace(':','/',$id)); + + //try to delete dir else return + if(@rmdir($dir)) { + if ($ns_type!==false) { + $data = array($id, $ns_type); + trigger_event('IO_NAMESPACE_DELETED', $data); + } + } else { return; } + } +} + +/** + * Used to read in a DokuWiki page from file, and send IO_WIKIPAGE_READ events. + * + * Generates the action event which delegates to io_readFile(). + * Action plugins are allowed to modify the page content in transit. + * The file path should not be changed. + * + * Event data: + * $data[0] The raw arguments for io_readFile as an array. + * $data[1] ns: The colon separated namespace path minus the trailing page name. (false if root ns) + * $data[2] page_name: The wiki page name. + * $data[3] rev: The page revision, false for current wiki pages. + * + * @author Ben Coburn + */ +function io_readWikiPage($file, $id, $rev=false) { + if (empty($rev)) { $rev = false; } + $data = array(array($file, false), getNS($id), noNS($id), $rev); + return trigger_event('IO_WIKIPAGE_READ', $data, '_io_readWikiPage_action', false); +} + +/** + * Callback adapter for io_readFile(). + * @author Ben Coburn + */ +function _io_readWikiPage_action($data) { + if (is_array($data) && is_array($data[0]) && count($data[0])===2) { + return call_user_func_array('io_readFile', $data[0]); + } else { + return ''; //callback error + } +} + +/** + * Returns content of $file as cleaned string. + * + * Uses gzip if extension is .gz + * + * If you want to use the returned value in unserialize + * be sure to set $clean to false! + * + * @author Andreas Gohr + */ +function io_readFile($file,$clean=true){ + $ret = ''; + if(@file_exists($file)){ + if(substr($file,-3) == '.gz'){ + $ret = join('',gzfile($file)); + }else if(substr($file,-4) == '.bz2'){ + $ret = bzfile($file); + }else{ + $ret = join('',file($file)); + } + } + if($clean){ + return cleanText($ret); + }else{ + return $ret; + } +} +/** +* Returns the content of a .bz2 compressed file as string +* @author marcel senf +*/ + +function bzfile($file){ + $bz = bzopen($file,"r"); + while (!feof($bz)){ + //8192 seems to be the maximum buffersize? + $str = $str . bzread($bz,8192); + } + bzclose($bz); + return $str; +} + + +/** + * Used to write out a DokuWiki page to file, and send IO_WIKIPAGE_WRITE events. + * + * This generates an action event and delegates to io_saveFile(). + * Action plugins are allowed to modify the page content in transit. + * The file path should not be changed. + * (The append parameter is set to false.) + * + * Event data: + * $data[0] The raw arguments for io_saveFile as an array. + * $data[1] ns: The colon separated namespace path minus the trailing page name. (false if root ns) + * $data[2] page_name: The wiki page name. + * $data[3] rev: The page revision, false for current wiki pages. + * + * @author Ben Coburn + */ +function io_writeWikiPage($file, $content, $id, $rev=false) { + if (empty($rev)) { $rev = false; } + if ($rev===false) { io_createNamespace($id); } // create namespaces as needed + $data = array(array($file, $content, false), getNS($id), noNS($id), $rev); + return trigger_event('IO_WIKIPAGE_WRITE', $data, '_io_writeWikiPage_action', false); +} + +/** + * Callback adapter for io_saveFile(). + * @author Ben Coburn + */ +function _io_writeWikiPage_action($data) { + if (is_array($data) && is_array($data[0]) && count($data[0])===3) { + return call_user_func_array('io_saveFile', $data[0]); + } else { + return false; //callback error + } +} + +/** + * Saves $content to $file. + * + * If the third parameter is set to true the given content + * will be appended. + * + * Uses gzip if extension is .gz + * and bz2 if extension is .bz2 + * + * @author Andreas Gohr + * @return bool true on success + */ +function io_saveFile($file,$content,$append=false){ + global $conf; + $mode = ($append) ? 'ab' : 'wb'; + + $fileexists = @file_exists($file); + io_makeFileDir($file); + io_lock($file); + if(substr($file,-3) == '.gz'){ + $fh = @gzopen($file,$mode.'9'); + if(!$fh){ + msg("Writing $file failed",-1); + io_unlock($file); + return false; + } + gzwrite($fh, $content); + gzclose($fh); + }else if(substr($file,-4) == '.bz2'){ + $fh = @bzopen($file,$mode); + if(!$fh){ + msg("Writing $file failed", -1); + io_unlock($file); + return false; + } + bzwrite($fh, $content); + bzclose($fh); + }else{ + $fh = @fopen($file,$mode); + if(!$fh){ + msg("Writing $file failed",-1); + io_unlock($file); + return false; + } + fwrite($fh, $content); + fclose($fh); + } + + if(!$fileexists and !empty($conf['fperm'])) chmod($file, $conf['fperm']); + io_unlock($file); + return true; +} + +/** + * Delete exact linematch for $badline from $file. + * + * Be sure to include the trailing newline in $badline + * + * Uses gzip if extension is .gz + * + * 2005-10-14 : added regex option -- Christopher Smith + * + * @author Steven Danz + * @return bool true on success + */ +function io_deleteFromFile($file,$badline,$regex=false){ + if (!@file_exists($file)) return true; + + io_lock($file); + + // load into array + if(substr($file,-3) == '.gz'){ + $lines = gzfile($file); + }else{ + $lines = file($file); + } + + // remove all matching lines + if ($regex) { + $lines = preg_grep($badline,$lines,PREG_GREP_INVERT); + } else { + $pos = array_search($badline,$lines); //return null or false if not found + while(is_int($pos)){ + unset($lines[$pos]); + $pos = array_search($badline,$lines); + } + } + + if(count($lines)){ + $content = join('',$lines); + if(substr($file,-3) == '.gz'){ + $fh = @gzopen($file,'wb9'); + if(!$fh){ + msg("Removing content from $file failed",-1); + io_unlock($file); + return false; + } + gzwrite($fh, $content); + gzclose($fh); + }else{ + $fh = @fopen($file,'wb'); + if(!$fh){ + msg("Removing content from $file failed",-1); + io_unlock($file); + return false; + } + fwrite($fh, $content); + fclose($fh); + } + }else{ + @unlink($file); + } + + io_unlock($file); + return true; +} + +/** + * Tries to lock a file + * + * Locking is only done for io_savefile and uses directories + * inside $conf['lockdir'] + * + * It waits maximal 3 seconds for the lock, after this time + * the lock is assumed to be stale and the function goes on + * + * @author Andreas Gohr + */ +function io_lock($file){ + global $conf; + // no locking if safemode hack + if($conf['safemodehack']) return; + + $lockDir = $conf['lockdir'].'/'.md5($file); + @ignore_user_abort(1); + + $timeStart = time(); + do { + //waited longer than 3 seconds? -> stale lock + if ((time() - $timeStart) > 3) break; + $locked = @mkdir($lockDir, $conf['dmode']); + if($locked){ + if(!empty($conf['dperm'])) chmod($lockDir, $conf['dperm']); + break; + } + usleep(50); + } while ($locked === false); +} + +/** + * Unlocks a file + * + * @author Andreas Gohr + */ +function io_unlock($file){ + global $conf; + // no locking if safemode hack + if($conf['safemodehack']) return; + + $lockDir = $conf['lockdir'].'/'.md5($file); + @rmdir($lockDir); + @ignore_user_abort(0); +} + +/** + * Create missing namespace directories and send the IO_NAMESPACE_CREATED events + * in the order of directory creation. (Parent directories first.) + * + * Event data: + * $data[0] ns: The colon separated namespace path minus the trailing page name. + * $data[1] ns_type: 'pages' or 'media' namespace tree. + * + * @author Ben Coburn + */ +function io_createNamespace($id, $ns_type='pages') { + // verify ns_type + $types = array('pages'=>'wikiFN', 'media'=>'mediaFN'); + if (!isset($types[$ns_type])) { + trigger_error('Bad $ns_type parameter for io_createNamespace().'); + return; + } + // make event list + $missing = array(); + $ns_stack = explode(':', $id); + $ns = $id; + $tmp = dirname( $file = call_user_func($types[$ns_type], $ns) ); + while (!@is_dir($tmp) && !(@file_exists($tmp) && !is_dir($tmp))) { + array_pop($ns_stack); + $ns = implode(':', $ns_stack); + if (strlen($ns)==0) { break; } + $missing[] = $ns; + $tmp = dirname(call_user_func($types[$ns_type], $ns)); + } + // make directories + io_makeFileDir($file); + // send the events + $missing = array_reverse($missing); // inside out + foreach ($missing as $ns) { + $data = array($ns, $ns_type); + trigger_event('IO_NAMESPACE_CREATED', $data); + } +} + +/** + * Create the directory needed for the given file + * + * @author Andreas Gohr + */ +function io_makeFileDir($file){ + global $conf; + + $dir = dirname($file); + if(!@is_dir($dir)){ + io_mkdir_p($dir) || msg("Creating directory $dir failed",-1); + } +} + +/** + * Creates a directory hierachy. + * + * @link http://www.php.net/manual/en/function.mkdir.php + * @author + * @author Andreas Gohr + */ +function io_mkdir_p($target){ + global $conf; + if (@is_dir($target)||empty($target)) return 1; // best case check first + if (@file_exists($target) && !is_dir($target)) return 0; + //recursion + if (io_mkdir_p(substr($target,0,strrpos($target,'/')))){ + if($conf['safemodehack']){ + $dir = preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','', $target); + return io_mkdir_ftp($dir); + }else{ + $ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree + if($ret && $conf['dperm']) chmod($target, $conf['dperm']); + return $ret; + } + } + return 0; +} + +/** + * Creates a directory using FTP + * + * This is used when the safemode workaround is enabled + * + * @author + */ +function io_mkdir_ftp($dir){ + global $conf; + + if(!function_exists('ftp_connect')){ + msg("FTP support not found - safemode workaround not usable",-1); + return false; + } + + $conn = @ftp_connect($conf['ftp']['host'],$conf['ftp']['port'],10); + if(!$conn){ + msg("FTP connection failed",-1); + return false; + } + + if(!@ftp_login($conn, $conf['ftp']['user'], $conf['ftp']['pass'])){ + msg("FTP login failed",-1); + return false; + } + + //create directory + $ok = @ftp_mkdir($conn, $dir); + //set permissions + @ftp_site($conn,sprintf("CHMOD %04o %s",$conf['dmode'],$dir)); + + @ftp_close($conn); + return $ok; +} + +/** + * downloads a file from the net and saves it + * + * if $useAttachment is false, + * - $file is the full filename to save the file, incl. path + * - if successful will return true, false otherwise + + * if $useAttachment is true, + * - $file is the directory where the file should be saved + * - if successful will return the name used for the saved file, false otherwise + * + * @author Andreas Gohr + * @author Chris Smith + */ +function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){ + global $conf; + $http = new DokuHTTPClient(); + $http->max_bodysize = $maxSize; + $http->timeout = 25; //max. 25 sec + + $data = $http->get($url); + if(!$data) return false; + + if ($useAttachment) { + $name = ''; + if (isset($http->resp_headers['content-disposition'])) { + $content_disposition = $http->resp_headers['content-disposition']; + $match=array(); + if (is_string($content_disposition) && + preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match)) { + + $name = basename($match[1]); + } + + } + + if (!$name) { + if (!$defaultName) return false; + $name = $defaultName; + } + + $file = $file.$name; + } + + $fileexists = @file_exists($file); + $fp = @fopen($file,"w"); + if(!$fp) return false; + fwrite($fp,$data); + fclose($fp); + if(!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']); + if ($useAttachment) return $name; + return true; +} + +/** + * Windows compatible rename + * + * rename() can not overwrite existing files on Windows + * this function will use copy/unlink instead + */ +function io_rename($from,$to){ + global $conf; + if(!@rename($from,$to)){ + if(@copy($from,$to)){ + if($conf['fperm']) chmod($to, $conf['fperm']); + @unlink($from); + return true; + } + return false; + } + return true; +} + + +/** + * Runs an external command and returns it's output as string + * + * @author Harry Brueckner + * @author Andreas Gohr + * @deprecated + */ +function io_runcmd($cmd){ + $fh = popen($cmd, "r"); + if(!$fh) return false; + $ret = ''; + while (!feof($fh)) { + $ret .= fread($fh, 8192); + } + pclose($fh); + return $ret; +} + +/** + * Search a file for matching lines + * + * This is probably not faster than file()+preg_grep() but less + * memory intensive because not the whole file needs to be loaded + * at once. + * + * @author Andreas Gohr + * @param string $file The file to search + * @param string $pattern PCRE pattern + * @param int $max How many lines to return (0 for all) + * @param bool $baxkref When true returns array with backreferences instead of lines + * @return matching lines or backref, false on error + */ +function io_grep($file,$pattern,$max=0,$backref=false){ + $fh = @fopen($file,'r'); + if(!$fh) return false; + $matches = array(); + + $cnt = 0; + $line = ''; + while (!feof($fh)) { + $line .= fgets($fh, 4096); // read full line + if(substr($line,-1) != "\n") continue; + + // check if line matches + if(preg_match($pattern,$line,$match)){ + if($backref){ + $matches[] = $match; + }else{ + $matches[] = $line; + } + $cnt++; + } + if($max && $max == $cnt) break; + $line = ''; + } + fclose($fh); + return $matches; +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/pageutils.php b/plugins/dokuwiki/inc/pageutils.php new file mode 100644 index 0000000..f58e751 --- /dev/null +++ b/plugins/dokuwiki/inc/pageutils.php @@ -0,0 +1,478 @@ + + * @todo Combine similar functions like {wiki,media,meta}FN() + */ + +/** + * Fetch the an ID from request + * + * Uses either standard $_REQUEST variable or extracts it from + * the full request URI when userewrite is set to 2 + * + * For $param='id' $conf['start'] is returned if no id was found. + * If the second parameter is true (default) the ID is cleaned. + * + * @author Andreas Gohr + */ +function getID($param='id',$clean=true){ + global $conf; + + $id = isset($_REQUEST[$param]) ? $_REQUEST[$param] : null; + + //construct page id from request URI + if(empty($id) && $conf['userewrite'] == 2){ + //get the script URL + if($conf['basedir']){ + $relpath = ''; + if($param != 'id') { + $relpath = 'lib/exe/'; + } + $script = $conf['basedir'].$relpath.basename($_SERVER['SCRIPT_FILENAME']); + }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){ + $script = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','', + $_SERVER['SCRIPT_FILENAME']); + $script = '/'.$script; + }else{ + $script = $_SERVER['SCRIPT_NAME']; + } + + //clean script and request (fixes a windows problem) + $script = preg_replace('/\/\/+/','/',$script); + $request = preg_replace('/\/\/+/','/',$_SERVER['REQUEST_URI']); + + //remove script URL and Querystring to gain the id + if(preg_match('/^'.preg_quote($script,'/').'(.*)/',$request, $match)){ + $id = preg_replace ('/\?.*/','',$match[1]); + } + $id = urldecode($id); + //strip leading slashes + $id = preg_replace('!^/+!','',$id); + } + if($clean) $id = cleanID($id); + if(empty($id) && $param=='id') $id = $conf['start']; + + return $id; +} + +/** + * Remove unwanted chars from ID + * + * Cleans a given ID to only use allowed characters. Accented characters are + * converted to unaccented ones + * + * @author Andreas Gohr + * @param string $raw_id The pageid to clean + * @param boolean $ascii Force ASCII + */ +function cleanID($raw_id,$ascii=false){ + global $conf; + global $lang; + static $sepcharpat = null; + + global $cache_cleanid; + $cache = & $cache_cleanid; + + // check if it's already in the memory cache + if (isset($cache[$raw_id])) { + return $cache[$raw_id]; + } + + $sepchar = $conf['sepchar']; + if($sepcharpat == null) // build string only once to save clock cycles + $sepcharpat = '#\\'.$sepchar.'+#'; + + $id = trim($raw_id); + $id = utf8_strtolower($id); + + //alternative namespace seperator + $id = strtr($id,';',':'); + if($conf['useslash']){ + $id = strtr($id,'/',':'); + }else{ + $id = strtr($id,'/',$sepchar); + } + + if($conf['deaccent'] == 2 || $ascii) $id = utf8_romanize($id); + if($conf['deaccent'] || $ascii) $id = utf8_deaccent($id,-1); + + //remove specials + $id = utf8_stripspecials($id,$sepchar,'\*'); + + if($ascii) $id = utf8_strip($id); + + //clean up + $id = preg_replace($sepcharpat,$sepchar,$id); + $id = preg_replace('#:+#',':',$id); + $id = trim($id,':._-'); + $id = preg_replace('#:[:\._\-]+#',':',$id); + + $cache[$raw_id] = $id; + return($id); +} + +/** + * Return namespacepart of a wiki ID + * + * @author Andreas Gohr + */ +function getNS($id){ + $pos = strrpos($id,':'); + if($pos!==false){ + return substr($id,0,$pos); + } + return false; +} + +/** + * Returns the ID without the namespace + * + * @author Andreas Gohr + */ +function noNS($id) { + $pos = strrpos($id, ':'); + if ($pos!==false) { + return substr($id, $pos+1); + } else { + return $id; + } +} + +/** + * returns the full path to the datafile specified by ID and + * optional revision + * + * The filename is URL encoded to protect Unicode chars + * + * @author Andreas Gohr + */ +function wikiFN($raw_id,$rev='',$clean=true){ + global $conf; + + global $cache_wikifn; + $cache = & $cache_wikifn; + + if (isset($cache[$raw_id]) && isset($cache[$raw_id][$rev])) { + return $cache[$raw_id][$rev]; + } + + $id = $raw_id; + + if ($clean) $id = cleanID($id); + $id = str_replace(':','/',$id); + if(empty($rev)){ + $fn = $conf['datadir'].'/'.utf8_encodeFN($id).'.txt'; + }else{ + $fn = $conf['olddir'].'/'.utf8_encodeFN($id).'.'.$rev.'.txt'; + if($conf['compression']){ + //test for extensions here, we want to read both compressions + if (@file_exists($fn . '.gz')){ + $fn .= '.gz'; + }else if(@file_exists($fn . '.bz2')){ + $fn .= '.bz2'; + }else{ + //file doesnt exist yet, so we take the configured extension + $fn .= '.' . $conf['compression']; + } + } + } + + if (!isset($cache[$raw_id])) { $cache[$raw_id] = array(); } + $cache[$raw_id][$rev] = $fn; + return $fn; +} + +/** + * Returns the full path to the file for locking the page while editing. + * + * @author Ben Coburn + */ +function wikiLockFN($id) { + global $conf; + return $conf['lockdir'].'/'.md5(cleanID($id)).'.lock'; +} + + +/** + * returns the full path to the meta file specified by ID and extension + * + * The filename is URL encoded to protect Unicode chars + * + * @author Steven Danz + */ +function metaFN($id,$ext){ + global $conf; + $id = cleanID($id); + $id = str_replace(':','/',$id); + $fn = $conf['metadir'].'/'.utf8_encodeFN($id).$ext; + return $fn; +} + +/** + * returns an array of full paths to all metafiles of a given ID + * + * @author Esther Brunner + */ +function metaFiles($id){ + $name = noNS($id); + $dir = metaFN(getNS($id),''); + $files = array(); + + $dh = @opendir($dir); + if(!$dh) return $files; + while(($file = readdir($dh)) !== false){ + if(strpos($file,$name.'.') === 0 && !is_dir($dir.$file)) + $files[] = $dir.$file; + } + closedir($dh); + + return $files; +} + +/** + * returns the full path to the mediafile specified by ID + * + * The filename is URL encoded to protect Unicode chars + * + * @author Andreas Gohr + */ +function mediaFN($id){ + global $conf; + $id = cleanID($id); + $id = str_replace(':','/',$id); + $fn = $conf['mediadir'].'/'.utf8_encodeFN($id); + return $fn; +} + +/** + * Returns the full filepath to a localized textfile if local + * version isn't found the english one is returned + * + * @author Andreas Gohr + */ +function localeFN($id){ + global $conf; + $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + } + return $file; +} + +/** + * Resolve relative paths in IDs + * + * Do not call directly use resolve_mediaid or resolve_pageid + * instead + * + * Partyly based on a cleanPath function found at + * http://www.php.net/manual/en/function.realpath.php#57016 + * + * @author + */ +function resolve_id($ns,$id,$clean=true){ + // if the id starts with a dot we need to handle the + // relative stuff + if($id{0} == '.'){ + // normalize initial dots without a colon + $id = preg_replace('/^(\.+)(?=[^:\.])/','\1:',$id); + // prepend the current namespace + $id = $ns.':'.$id; + + // cleanup relatives + $result = array(); + $pathA = explode(':', $id); + if (!$pathA[0]) $result[] = ''; + foreach ($pathA AS $key => $dir) { + if ($dir == '..') { + if (end($result) == '..') { + $result[] = '..'; + } elseif (!array_pop($result)) { + $result[] = '..'; + } + } elseif ($dir && $dir != '.') { + $result[] = $dir; + } + } + if (!end($pathA)) $result[] = ''; + $id = implode(':', $result); + }elseif($ns !== false && strpos($id,':') === false){ + //if link contains no namespace. add current namespace (if any) + $id = $ns.':'.$id; + } + + if($clean) $id = cleanID($id); + return $id; +} + +/** + * Returns a full media id + * + * @author Andreas Gohr + */ +function resolve_mediaid($ns,&$page,&$exists){ + $page = resolve_id($ns,$page); + $file = mediaFN($page); + $exists = @file_exists($file); +} + +/** + * Returns a full page id + * + * @author Andreas Gohr + */ +function resolve_pageid($ns,&$page,&$exists){ + global $conf; + $exists = false; + + //keep hashlink if exists then clean both parts + if (strpos($page,'#')) { + list($page,$hash) = explode('#',$page,2); + } else { + $hash = ''; + } + $hash = cleanID($hash); + $page = resolve_id($ns,$page,false); // resolve but don't clean, yet + + // get filename (calls clean itself) + $file = wikiFN($page); + + // if ends with colon we have a namespace link + if(substr($page,-1) == ':'){ + if(@file_exists(wikiFN($page.$conf['start']))){ + // start page inside namespace + $page = $page.$conf['start']; + $exists = true; + }elseif(@file_exists(wikiFN($page.noNS(cleanID($page))))){ + // page named like the NS inside the NS + $page = $page.noNS(cleanID($page)); + $exists = true; + }elseif(@file_exists(wikiFN($page))){ + // page like namespace exists + $page = $page; + $exists = true; + }else{ + // fall back to default + $page = $page.$conf['start']; + } + }else{ + //check alternative plural/nonplural form + if(!@file_exists($file)){ + if( $conf['autoplural'] ){ + if(substr($page,-1) == 's'){ + $try = substr($page,0,-1); + }else{ + $try = $page.'s'; + } + if(@file_exists(wikiFN($try))){ + $page = $try; + $exists = true; + } + } + }else{ + $exists = true; + } + } + + // now make sure we have a clean page + $page = cleanID($page); + + //add hash if any + if(!empty($hash)) $page .= '#'.$hash; +} + +/** + * Returns the name of a cachefile from given data + * + * The needed directory is created by this function! + * + * @author Andreas Gohr + * + * @param string $data This data is used to create a unique md5 name + * @param string $ext This is appended to the filename if given + * @return string The filename of the cachefile + */ +function getCacheName($data,$ext=''){ + global $conf; + $md5 = md5($data); + $file = $conf['cachedir'].'/'.$md5{0}.'/'.$md5.$ext; + io_makeFileDir($file); + return $file; +} + +/** + * Checks a pageid against $conf['hidepages'] + * + * @author Andreas Gohr + */ +function isHiddenPage($id){ + global $conf; + if(empty($conf['hidepages'])) return false; + + if(preg_match('/'.$conf['hidepages'].'/ui',':'.$id)){ + return true; + } + return false; +} + +/** + * Reverse of isHiddenPage + * + * @author Andreas Gohr + */ +function isVisiblePage($id){ + return !isHiddenPage($id); +} + +/** + * Checks and sets HTTP headers for conditional HTTP requests + * + * @author Simon Willison + * @link http://simon.incutio.com/archive/2003/04/23/conditionalGet + * @param timestamp $timestamp lastmodified time of the cache file + * @returns void or void with previously header() commands executed + */ +function http_conditionalRequest($timestamp){ + // A PHP implementation of conditional get, see + // http://fishbowl.pastiche.org/archives/001132.html + $last_modified = substr(date('r', $timestamp), 0, -5).'GMT'; + $etag = '"'.md5($last_modified).'"'; + // Send the headers + header("Last-Modified: $last_modified"); + header("ETag: $etag"); + // See if the client has provided the required headers + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){ + $if_modified_since = stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']); + }else{ + $if_modified_since = false; + } + + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])){ + $if_none_match = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); + }else{ + $if_none_match = false; + } + + if (!$if_modified_since && !$if_none_match){ + return; + } + + // At least one of the headers is there - check them + if ($if_none_match && $if_none_match != $etag) { + return; // etag is there but doesn't match + } + + if ($if_modified_since && $if_modified_since != $last_modified) { + return; // if-modified-since is there but doesn't match + } + + // Nothing has changed since their last request - serve a 304 and exit + header('HTTP/1.0 304 Not Modified'); + exit; +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parser/handler.php b/plugins/dokuwiki/inc/parser/handler.php new file mode 100644 index 0000000..bd307d6 --- /dev/null +++ b/plugins/dokuwiki/inc/parser/handler.php @@ -0,0 +1,1653 @@ + FALSE, + 'section_edit_start' => -1, + 'section_edit_level' => 1, + 'section_edit_title' => '' + ); + + var $rewriteBlocks = TRUE; + + function __construct() { + $this->CallWriter = new Doku_Handler_CallWriter($this); + } + + function _addCall($handler, $args, $pos) { + $call = array($handler,$args, $pos); + $this->CallWriter->writeCall($call); + } + + function _finalize(){ + + $this->CallWriter->finalise(); + + if ( $this->status['section'] ) { + $last_call = end($this->calls); + array_push($this->calls,array('section_close',array(), $last_call[2])); + if ($this->status['section_edit_start']>1) { + // ignore last edit section if there is only one header + array_push($this->calls,array('section_edit',array($this->status['section_edit_start'], 0, $this->status['section_edit_level'], $this->status['section_edit_title']), $last_call[2])); + } + } + + if ( $this->rewriteBlocks ) { + $B = new Doku_Handler_Block(); + $this->calls = $B->process($this->calls); + } + + trigger_event('PARSER_HANDLER_DONE',$this); + + array_unshift($this->calls,array('document_start',array(),0)); + $last_call = end($this->calls); + array_push($this->calls,array('document_end',array(),$last_call[2])); + } + + function fetch() { + $call = each($this->calls); + if ( $call ) { + return $call['value']; + } + return FALSE; + } + + + /** + * Special plugin handler + * + * This handler is called for all modes starting with 'plugin_'. + * An additional parameter with the plugin name is passed + * + * @author Andreas Gohr + */ + function plugin($match, $state, $pos, $pluginname){ + $data = array($match); + $plugin =& plugin_load('syntax',$pluginname); + if($plugin != null){ + $data = $plugin->handle($match, $state, $pos, $this); + } + $this->_addCall('plugin',array($pluginname,$data,$state),$pos); + return TRUE; + } + + function base($match, $state, $pos) { + switch ( $state ) { + case DOKU_LEXER_UNMATCHED: + $this->_addCall('cdata',array($match), $pos); + return TRUE; + break; + + } + } + + function header($match, $state, $pos) { + global $conf; + + // get level and title + $title = trim($match); + $level = 7 - strspn($title,'='); + if($level < 1) $level = 1; + $title = trim($title,'='); + $title = trim($title); + + if ($this->status['section']) $this->_addCall('section_close',array(),$pos); + + if ($level<=$conf['maxseclevel']) { + $this->_addCall('section_edit',array($this->status['section_edit_start'], $pos-1, $this->status['section_edit_level'], $this->status['section_edit_title']), $pos); + $this->status['section_edit_start'] = $pos; + $this->status['section_edit_level'] = $level; + $this->status['section_edit_title'] = $title; + } + + $this->_addCall('header',array($title,$level,$pos), $pos); + + $this->_addCall('section_open',array($level),$pos); + $this->status['section'] = TRUE; + return TRUE; + } + + function notoc($match, $state, $pos) { + $this->_addCall('notoc',array(),$pos); + return TRUE; + } + + function nocache($match, $state, $pos) { + $this->_addCall('nocache',array(),$pos); + return TRUE; + } + + function linebreak($match, $state, $pos) { + $this->_addCall('linebreak',array(),$pos); + return TRUE; + } + + function eol($match, $state, $pos) { + $this->_addCall('eol',array(),$pos); + return TRUE; + } + + function hr($match, $state, $pos) { + $this->_addCall('hr',array(),$pos); + return TRUE; + } + + function _nestingTag($match, $state, $pos, $name) { + switch ( $state ) { + case DOKU_LEXER_ENTER: + $this->_addCall($name.'_open', array(), $pos); + break; + case DOKU_LEXER_EXIT: + $this->_addCall($name.'_close', array(), $pos); + break; + case DOKU_LEXER_UNMATCHED: + $this->_addCall('cdata',array($match), $pos); + break; + } + } + + function strong($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'strong'); + return TRUE; + } + + function emphasis($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'emphasis'); + return TRUE; + } + + function underline($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'underline'); + return TRUE; + } + + function monospace($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'monospace'); + return TRUE; + } + + function subscript($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'subscript'); + return TRUE; + } + + function superscript($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'superscript'); + return TRUE; + } + + function deleted($match, $state, $pos) { + $this->_nestingTag($match, $state, $pos, 'deleted'); + return TRUE; + } + + + function footnote($match, $state, $pos) { +// $this->_nestingTag($match, $state, $pos, 'footnote'); + if (!isset($this->_footnote)) $this->_footnote = false; + + switch ( $state ) { + case DOKU_LEXER_ENTER: + // footnotes can not be nested - however due to limitations in lexer it can't be prevented + // we will still enter a new footnote mode, we just do nothing + if ($this->_footnote) { + $this->_addCall('cdata',array($match), $pos); + break; + } + + $this->_footnote = true; + + $ReWriter = new Doku_Handler_Nest($this->CallWriter,'footnote_close'); + $this->CallWriter = & $ReWriter; + $this->_addCall('footnote_open', array(), $pos); + break; + case DOKU_LEXER_EXIT: + // check whether we have already exitted the footnote mode, can happen if the modes were nested + if (!$this->_footnote) { + $this->_addCall('cdata',array($match), $pos); + break; + } + + $this->_footnote = false; + + $this->_addCall('footnote_close', array(), $pos); + $this->CallWriter->process(); + $ReWriter = & $this->CallWriter; + $this->CallWriter = & $ReWriter->CallWriter; + break; + case DOKU_LEXER_UNMATCHED: + $this->_addCall('cdata', array($match), $pos); + break; + } + return TRUE; + } + + function listblock($match, $state, $pos) { + switch ( $state ) { + case DOKU_LEXER_ENTER: + $ReWriter = new Doku_Handler_List($this->CallWriter); + $this->CallWriter = & $ReWriter; + $this->_addCall('list_open', array($match), $pos); + break; + case DOKU_LEXER_EXIT: + $this->_addCall('list_close', array(), $pos); + $this->CallWriter->process(); + $ReWriter = & $this->CallWriter; + $this->CallWriter = & $ReWriter->CallWriter; + break; + case DOKU_LEXER_MATCHED: + $this->_addCall('list_item', array($match), $pos); + break; + case DOKU_LEXER_UNMATCHED: + $this->_addCall('cdata', array($match), $pos); + break; + } + return TRUE; + } + + function unformatted($match, $state, $pos) { + if ( $state == DOKU_LEXER_UNMATCHED ) { + $this->_addCall('unformatted',array($match), $pos); + } + return TRUE; + } + + function php($match, $state, $pos) { + global $conf; + if ( $state == DOKU_LEXER_UNMATCHED ) { + if ($conf['phpok']) { + $this->_addCall('php',array($match), $pos); + } else { + $this->_addCall('file',array($match), $pos); + } + } + return TRUE; + } + + function html($match, $state, $pos) { + global $conf; + if ( $state == DOKU_LEXER_UNMATCHED ) { + if($conf['htmlok']){ + $this->_addCall('html',array($match), $pos); + } else { + $this->_addCall('file',array($match), $pos); + } + } + return TRUE; + } + + function preformatted($match, $state, $pos) { + switch ( $state ) { + case DOKU_LEXER_ENTER: + $ReWriter = new Doku_Handler_Preformatted($this->CallWriter); + $this->CallWriter = & $ReWriter; + $this->_addCall('preformatted_start',array(), $pos); + break; + case DOKU_LEXER_EXIT: + $this->_addCall('preformatted_end',array(), $pos); + $this->CallWriter->process(); + $ReWriter = & $this->CallWriter; + $this->CallWriter = & $ReWriter->CallWriter; + break; + case DOKU_LEXER_MATCHED: + $this->_addCall('preformatted_newline',array(), $pos); + break; + case DOKU_LEXER_UNMATCHED: + $this->_addCall('preformatted_content',array($match), $pos); + break; + } + + return TRUE; + } + + function file($match, $state, $pos) { + if ( $state == DOKU_LEXER_UNMATCHED ) { + $this->_addCall('file',array($match), $pos); + } + return TRUE; + } + + function quote($match, $state, $pos) { + + switch ( $state ) { + + case DOKU_LEXER_ENTER: + $ReWriter = new Doku_Handler_Quote($this->CallWriter); + $this->CallWriter = & $ReWriter; + $this->_addCall('quote_start',array($match), $pos); + break; + + case DOKU_LEXER_EXIT: + $this->_addCall('quote_end',array(), $pos); + $this->CallWriter->process(); + $ReWriter = & $this->CallWriter; + $this->CallWriter = & $ReWriter->CallWriter; + break; + + case DOKU_LEXER_MATCHED: + $this->_addCall('quote_newline',array($match), $pos); + break; + + case DOKU_LEXER_UNMATCHED: + $this->_addCall('cdata',array($match), $pos); + break; + + } + + return TRUE; + } + + function code($match, $state, $pos) { + switch ( $state ) { + case DOKU_LEXER_UNMATCHED: + $matches = preg_split('/>/u',$match,2); + $matches[0] = trim($matches[0]); + if ( trim($matches[0]) == '' ) { + $matches[0] = NULL; + } + # $matches[0] contains name of programming language + # if available, We shortcut html here. + if($matches[0] == 'html') $matches[0] = 'html4strict'; + $this->_addCall( + 'code', + array($matches[1],$matches[0]), + $pos + ); + break; + } + return TRUE; + } + + function acronym($match, $state, $pos) { + $this->_addCall('acronym',array($match), $pos); + return TRUE; + } + + function smiley($match, $state, $pos) { + $this->_addCall('smiley',array($match), $pos); + return TRUE; + } + + function wordblock($match, $state, $pos) { + $this->_addCall('wordblock',array($match), $pos); + return TRUE; + } + + function entity($match, $state, $pos) { + $this->_addCall('entity',array($match), $pos); + return TRUE; + } + + function multiplyentity($match, $state, $pos) { + preg_match_all('/\d+/',$match,$matches); + $this->_addCall('multiplyentity',array($matches[0][0],$matches[0][1]), $pos); + return TRUE; + } + + function singlequoteopening($match, $state, $pos) { + $this->_addCall('singlequoteopening',array(), $pos); + return TRUE; + } + + function singlequoteclosing($match, $state, $pos) { + $this->_addCall('singlequoteclosing',array(), $pos); + return TRUE; + } + + function doublequoteopening($match, $state, $pos) { + $this->_addCall('doublequoteopening',array(), $pos); + return TRUE; + } + + function doublequoteclosing($match, $state, $pos) { + $this->_addCall('doublequoteclosing',array(), $pos); + return TRUE; + } + + function camelcaselink($match, $state, $pos) { + $this->_addCall('camelcaselink',array($match), $pos); + return TRUE; + } + + /* + */ + function internallink($match, $state, $pos) { + // Strip the opening and closing markup + $link = preg_replace(array('/^\[\[/','/\]\]$/u'),'',$match); + + // Split title from URL + $link = preg_split('/\|/u',$link,2); + if ( !isset($link[1]) ) { + $link[1] = NULL; + } else if ( preg_match('/^\{\{[^\}]+\}\}$/',$link[1]) ) { + // If the title is an image, convert it to an array containing the image details + $link[1] = Doku_Handler_Parse_Media($link[1]); + } + $link[0] = trim($link[0]); + + //decide which kind of link it is + + if ( preg_match('/^[a-zA-Z\.]+>{1}.*$/u',$link[0]) ) { + // Interwiki + $interwiki = preg_split('/>/u',$link[0]); + $this->_addCall( + 'interwikilink', + array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]), + $pos + ); + }elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) { + // Windows Share + $this->_addCall( + 'windowssharelink', + array($link[0],$link[1]), + $pos + ); + }elseif ( preg_match('#^([a-z0-9\-\.+]+?)://#i',$link[0]) ) { + // external link (accepts all protocols) + $this->_addCall( + 'externallink', + array($link[0],$link[1]), + $pos + ); + }elseif ( preg_match('#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i',$link[0]) ) { + // E-Mail + $this->_addCall( + 'emaillink', + array($link[0],$link[1]), + $pos + ); + }elseif ( preg_match('!^#.+!',$link[0]) ){ + // local link + $this->_addCall( + 'locallink', + array(substr($link[0],1),$link[1]), + $pos + ); + }else{ + // internal link + $this->_addCall( + 'internallink', + array($link[0],$link[1]), + $pos + ); + } + + return TRUE; + } + + function filelink($match, $state, $pos) { + $this->_addCall('filelink',array($match, NULL), $pos); + return TRUE; + } + + function windowssharelink($match, $state, $pos) { + $this->_addCall('windowssharelink',array($match, NULL), $pos); + return TRUE; + } + + function media($match, $state, $pos) { + $p = Doku_Handler_Parse_Media($match); + + $this->_addCall( + $p['type'], + array($p['src'], $p['title'], $p['align'], $p['width'], + $p['height'], $p['cache'], $p['linking']), + $pos + ); + return TRUE; + } + + function rss($match, $state, $pos) { + $link = preg_replace(array('/^\{\{rss>/','/\}\}$/'),'',$match); + + // get params + list($link,$params) = explode(' ',$link,2); + + $p = array(); + if(preg_match('/\b(\d+)\b/',$params,$match)){ + $p['max'] = $match[1]; + }else{ + $p['max'] = 8; + } + $p['reverse'] = (preg_match('/rev/',$params)); + $p['author'] = (preg_match('/\b(by|author)/',$params)); + $p['date'] = (preg_match('/\b(date)/',$params)); + $p['details'] = (preg_match('/\b(desc|detail)/',$params)); + + if (preg_match('/\b(\d+)([dhm])\b/',$params,$match)) { + $period = array('d' => 86400, 'h' => 3600, 'm' => 60); + $p['refresh'] = max(600,$match[1]*$period[$match[2]]); // n * period in seconds, minimum 10 minutes + } else { + $p['refresh'] = 14400; // default to 4 hours + } + + $this->_addCall('rss',array($link,$p),$pos); + return TRUE; + } + + function externallink($match, $state, $pos) { + // Prevent use of multibyte strings in URLs + // See: http://www.boingboing.net/2005/02/06/shmoo_group_exploit_.html + // Not worried about other charsets so long as page is output as UTF-8 + /*if ( strlen($match) != utf8_strlen($match) ) { + $this->_addCall('cdata',array($match), $pos); + } else {*/ + + $this->_addCall('externallink',array($match, NULL), $pos); + //} + return TRUE; + } + + function emaillink($match, $state, $pos) { + $email = preg_replace(array('/^$/'),'',$match); + $this->_addCall('emaillink',array($email, NULL), $pos); + return TRUE; + } + + function table($match, $state, $pos) { + switch ( $state ) { + + case DOKU_LEXER_ENTER: + + $ReWriter = new Doku_Handler_Table($this->CallWriter); + $this->CallWriter = & $ReWriter; + + $this->_addCall('table_start', array(), $pos); + //$this->_addCall('table_row', array(), $pos); + if ( trim($match) == '^' ) { + $this->_addCall('tableheader', array(), $pos); + } else { + $this->_addCall('tablecell', array(), $pos); + } + break; + + case DOKU_LEXER_EXIT: + $this->_addCall('table_end', array(), $pos); + $this->CallWriter->process(); + $ReWriter = & $this->CallWriter; + $this->CallWriter = & $ReWriter->CallWriter; + break; + + case DOKU_LEXER_UNMATCHED: + if ( trim($match) != '' ) { + $this->_addCall('cdata',array($match), $pos); + } + break; + + case DOKU_LEXER_MATCHED: + if ( $match == ' ' ){ + $this->_addCall('cdata', array($match), $pos); + } else if ( preg_match('/\t+/',$match) ) { + $this->_addCall('table_align', array($match), $pos); + } else if ( preg_match('/ {2,}/',$match) ) { + $this->_addCall('table_align', array($match), $pos); + } else if ( $match == "\n|" ) { + $this->_addCall('table_row', array(), $pos); + $this->_addCall('tablecell', array(), $pos); + } else if ( $match == "\n^" ) { + $this->_addCall('table_row', array(), $pos); + $this->_addCall('tableheader', array(), $pos); + } else if ( $match == '|' ) { + $this->_addCall('tablecell', array(), $pos); + } else if ( $match == '^' ) { + $this->_addCall('tableheader', array(), $pos); + } + break; + } + return TRUE; + } +} + +//------------------------------------------------------------------------ +function Doku_Handler_Parse_Media($match) { + + // Strip the opening and closing markup + $link = preg_replace(array('/^\{\{/','/\}\}$/u'),'',$match); + + // Split title from URL + $link = preg_split('/\|/u',$link,2); + + + // Check alignment + $ralign = (bool)preg_match('/^ /',$link[0]); + $lalign = (bool)preg_match('/ $/',$link[0]); + + // Logic = what's that ;)... + if ( $lalign & $ralign ) { + $align = 'center'; + } else if ( $ralign ) { + $align = 'right'; + } else if ( $lalign ) { + $align = 'left'; + } else { + $align = NULL; + } + + // The title... + if ( !isset($link[1]) ) { + $link[1] = NULL; + } + + //remove aligning spaces + $link[0] = trim($link[0]); + + //split into src and parameters (using the very last questionmark) + $pos = strrpos($link[0], '?'); + if($pos !== false){ + $src = substr($link[0],0,$pos); + $param = substr($link[0],$pos+1); + }else{ + $src = $link[0]; + $param = ''; + } + + //parse width and height + if(preg_match('#(\d+)(x(\d+))?#i',$param,$size)){ + ($size[1]) ? $w = $size[1] : $w = NULL; + ($size[3]) ? $h = $size[3] : $h = NULL; + } else { + $w = NULL; + $h = NULL; + } + + //get linking command + if(preg_match('/nolink/i',$param)){ + $linking = 'nolink'; + }else if(preg_match('/direct/i',$param)){ + $linking = 'direct'; + }else{ + $linking = 'details'; + } + + //get caching command + if (preg_match('/(nocache|recache)/i',$param,$cachemode)){ + $cache = $cachemode[1]; + }else{ + $cache = 'cache'; + } + + // Check whether this is a local or remote image + if ( preg_match('#^(https?|ftp)#i',$src) ) { + $call = 'externalmedia'; + } else { + $call = 'internalmedia'; + } + + $params = array( + 'type'=>$call, + 'src'=>$src, + 'title'=>$link[1], + 'align'=>$align, + 'width'=>$w, + 'height'=>$h, + 'cache'=>$cache, + 'linking'=>$linking, + ); + + return $params; +} + +//------------------------------------------------------------------------ +class Doku_Handler_CallWriter { + + var $Handler; + + function __construct(& $Handler) { + $this->Handler = & $Handler; + } + + function writeCall($call) { + $this->Handler->calls[] = $call; + } + + function writeCalls($calls) { + $this->Handler->calls = array_merge($this->Handler->calls, $calls); + } + + // function is required, but since this call writer is first/highest in + // the chain it is not required to do anything + function finalise() { + } +} + +//------------------------------------------------------------------------ +/** + * Generic call writer class to handle nesting of rendering instructions + * within a render instruction. Also see nest() method of renderer base class + * + * @author Chris Smith + */ +class Doku_Handler_Nest { + + var $CallWriter; + var $calls = array(); + + var $closingInstruction; + + /** + * constructor + * + * @param object $CallWriter the renderers current call writer + * @param string $close closing instruction name, this is required to properly terminate the + * syntax mode if the document ends without a closing pattern + */ + function __construct(& $CallWriter, $close="nest_close") { + $this->CallWriter = & $CallWriter; + + $this->closingInstruction = $close; + } + + function writeCall($call) { + $this->calls[] = $call; + } + + function writeCalls($calls) { + $this->calls = array_merge($this->calls, $calls); + } + + function finalise() { + $last_call = end($this->calls); + $this->writeCall(array($this->closingInstruction,array(), $last_call[2])); + + $this->process(); + $this->CallWriter->finalise(); + } + + function process() { + $first_call = reset($this->calls); + $this->CallWriter->writeCall(array("nest", array($this->calls), $first_call[2])); + } +} + +class Doku_Handler_List { + + var $CallWriter; + + var $calls = array(); + var $listCalls = array(); + var $listStack = array(); + + function __construct(& $CallWriter) { + $this->CallWriter = & $CallWriter; + } + + function writeCall($call) { + $this->calls[] = $call; + } + + // Probably not needed but just in case... + function writeCalls($calls) { + $this->calls = array_merge($this->calls, $calls); +# $this->CallWriter->writeCalls($this->calls); + } + + function finalise() { + $last_call = end($this->calls); + $this->writeCall(array('list_close',array(), $last_call[2])); + + $this->process(); + $this->CallWriter->finalise(); + } + + //------------------------------------------------------------------------ + function process() { + + foreach ( $this->calls as $call ) { + switch ($call[0]) { + case 'list_item': + $this->listOpen($call); + break; + case 'list_open': + $this->listStart($call); + break; + case 'list_close': + $this->listEnd($call); + break; + default: + $this->listContent($call); + break; + } + } + + $this->CallWriter->writeCalls($this->listCalls); + } + + //------------------------------------------------------------------------ + function listStart($call) { + $depth = $this->interpretSyntax($call[1][0], $listType); + + $this->initialDepth = $depth; + $this->listStack[] = array($listType, $depth); + + $this->listCalls[] = array('list'.$listType.'_open',array(),$call[2]); + $this->listCalls[] = array('listitem_open',array(1),$call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + } + + //------------------------------------------------------------------------ + function listEnd($call) { + $closeContent = TRUE; + + while ( $list = array_pop($this->listStack) ) { + if ( $closeContent ) { + $this->listCalls[] = array('listcontent_close',array(),$call[2]); + $closeContent = FALSE; + } + $this->listCalls[] = array('listitem_close',array(),$call[2]); + $this->listCalls[] = array('list'.$list[0].'_close', array(), $call[2]); + } + } + + //------------------------------------------------------------------------ + function listOpen($call) { + $depth = $this->interpretSyntax($call[1][0], $listType); + $end = end($this->listStack); + + // Not allowed to be shallower than initialDepth + if ( $depth < $this->initialDepth ) { + $depth = $this->initialDepth; + } + + //------------------------------------------------------------------------ + if ( $depth == $end[1] ) { + + // Just another item in the list... + if ( $listType == $end[0] ) { + $this->listCalls[] = array('listcontent_close',array(),$call[2]); + $this->listCalls[] = array('listitem_close',array(),$call[2]); + $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + + // Switched list type... + } else { + + $this->listCalls[] = array('listcontent_close',array(),$call[2]); + $this->listCalls[] = array('listitem_close',array(),$call[2]); + $this->listCalls[] = array('list'.$end[0].'_close', array(), $call[2]); + $this->listCalls[] = array('list'.$listType.'_open', array(), $call[2]); + $this->listCalls[] = array('listitem_open', array($depth-1), $call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + + array_pop($this->listStack); + $this->listStack[] = array($listType, $depth); + } + + //------------------------------------------------------------------------ + // Getting deeper... + } else if ( $depth > $end[1] ) { + + $this->listCalls[] = array('listcontent_close',array(),$call[2]); + $this->listCalls[] = array('list'.$listType.'_open', array(), $call[2]); + $this->listCalls[] = array('listitem_open', array($depth-1), $call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + + $this->listStack[] = array($listType, $depth); + + //------------------------------------------------------------------------ + // Getting shallower ( $depth < $end[1] ) + } else { + $this->listCalls[] = array('listcontent_close',array(),$call[2]); + $this->listCalls[] = array('listitem_close',array(),$call[2]); + $this->listCalls[] = array('list'.$end[0].'_close',array(),$call[2]); + + // Throw away the end - done + array_pop($this->listStack); + + while (1) { + $end = end($this->listStack); + + if ( $end[1] <= $depth ) { + + // Normalize depths + $depth = $end[1]; + + $this->listCalls[] = array('listitem_close',array(),$call[2]); + + if ( $end[0] == $listType ) { + $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + + } else { + // Switching list type... + $this->listCalls[] = array('list'.$end[0].'_close', array(), $call[2]); + $this->listCalls[] = array('list'.$listType.'_open', array(), $call[2]); + $this->listCalls[] = array('listitem_open', array($depth-1), $call[2]); + $this->listCalls[] = array('listcontent_open',array(),$call[2]); + + array_pop($this->listStack); + $this->listStack[] = array($listType, $depth); + } + + break; + + // Haven't dropped down far enough yet.... ( $end[1] > $depth ) + } else { + + $this->listCalls[] = array('listitem_close',array(),$call[2]); + $this->listCalls[] = array('list'.$end[0].'_close',array(),$call[2]); + + array_pop($this->listStack); + + } + + } + + } + } + + //------------------------------------------------------------------------ + function listContent($call) { + $this->listCalls[] = $call; + } + + //------------------------------------------------------------------------ + function interpretSyntax($match, & $type) { + if ( substr($match,-1) == '*' ) { + $type = 'u'; + } else { + $type = 'o'; + } + return count(explode(' ',str_replace("\t",' ',$match))); + } +} + +//------------------------------------------------------------------------ +class Doku_Handler_Preformatted { + + var $CallWriter; + + var $calls = array(); + var $pos; + var $text =''; + + + + function __construct(& $CallWriter) { + $this->CallWriter = & $CallWriter; + } + + function writeCall($call) { + $this->calls[] = $call; + } + + // Probably not needed but just in case... + function writeCalls($calls) { + $this->calls = array_merge($this->calls, $calls); +# $this->CallWriter->writeCalls($this->calls); + } + + function finalise() { + $last_call = end($this->calls); + $this->writeCall(array('preformatted_end',array(), $last_call[2])); + + $this->process(); + $this->CallWriter->finalise(); + } + + function process() { + foreach ( $this->calls as $call ) { + switch ($call[0]) { + case 'preformatted_start': + $this->pos = $call[2]; + break; + case 'preformatted_newline': + $this->text .= "\n"; + break; + case 'preformatted_content': + $this->text .= $call[1][0]; + break; + case 'preformatted_end': + $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos)); + break; + } + } + } + +} + +//------------------------------------------------------------------------ +class Doku_Handler_Quote { + + var $CallWriter; + + var $calls = array(); + + var $quoteCalls = array(); + + function __construct(& $CallWriter) { + $this->CallWriter = & $CallWriter; + } + + function writeCall($call) { + $this->calls[] = $call; + } + + // Probably not needed but just in case... + function writeCalls($calls) { + $this->calls = array_merge($this->calls, $calls); +# $this->CallWriter->writeCalls($this->calls); + } + + function finalise() { + $last_call = end($this->calls); + $this->writeCall(array('quote_end',array(), $last_call[2])); + + $this->process(); + $this->CallWriter->finalise(); + } + + function process() { + + $quoteDepth = 1; + + foreach ( $this->calls as $call ) { + switch ($call[0]) { + + case 'quote_start': + + $this->quoteCalls[] = array('quote_open',array(),$call[2]); + + case 'quote_newline': + + $quoteLength = $this->getDepth($call[1][0]); + + if ( $quoteLength > $quoteDepth ) { + $quoteDiff = $quoteLength - $quoteDepth; + for ( $i = 1; $i <= $quoteDiff; $i++ ) { + $this->quoteCalls[] = array('quote_open',array(),$call[2]); + } + } else if ( $quoteLength < $quoteDepth ) { + $quoteDiff = $quoteDepth - $quoteLength; + for ( $i = 1; $i <= $quoteDiff; $i++ ) { + $this->quoteCalls[] = array('quote_close',array(),$call[2]); + } + } else { + if ($call[0] != 'quote_start') $this->quoteCalls[] = array('linebreak',array(),$call[2]); + } + + $quoteDepth = $quoteLength; + + break; + + case 'quote_end': + + if ( $quoteDepth > 1 ) { + $quoteDiff = $quoteDepth - 1; + for ( $i = 1; $i <= $quoteDiff; $i++ ) { + $this->quoteCalls[] = array('quote_close',array(),$call[2]); + } + } + + $this->quoteCalls[] = array('quote_close',array(),$call[2]); + + $this->CallWriter->writeCalls($this->quoteCalls); + break; + + default: + $this->quoteCalls[] = $call; + break; + } + } + } + + function getDepth($marker) { + preg_match('/>{1,}/', $marker, $matches); + $quoteLength = strlen($matches[0]); + return $quoteLength; + } +} + +//------------------------------------------------------------------------ +class Doku_Handler_Table { + + var $CallWriter; + + var $calls = array(); + var $tableCalls = array(); + var $maxCols = 0; + var $maxRows = 1; + var $currentCols = 0; + var $firstCell = FALSE; + var $lastCellType = 'tablecell'; + + function __construct(& $CallWriter) { + $this->CallWriter = & $CallWriter; + } + + function writeCall($call) { + $this->calls[] = $call; + } + + // Probably not needed but just in case... + function writeCalls($calls) { + $this->calls = array_merge($this->calls, $calls); +# $this->CallWriter->writeCalls($this->calls); + } + + function finalise() { + $last_call = end($this->calls); + $this->writeCall(array('table_end',array(), $last_call[2])); + + $this->process(); + $this->CallWriter->finalise(); + } + + //------------------------------------------------------------------------ + function process() { + foreach ( $this->calls as $call ) { + switch ( $call[0] ) { + case 'table_start': + $this->tableStart($call); + break; + case 'table_row': + $this->tableRowClose(array('tablerow_close',$call[1],$call[2])); + $this->tableRowOpen(array('tablerow_open',$call[1],$call[2])); + break; + case 'tableheader': + case 'tablecell': + $this->tableCell($call); + break; + case 'table_end': + $this->tableRowClose(array('tablerow_close',$call[1],$call[2])); + $this->tableEnd($call); + break; + default: + $this->tableDefault($call); + break; + } + } + $this->CallWriter->writeCalls($this->tableCalls); + } + + function tableStart($call) { + $this->tableCalls[] = array('table_open',array(),$call[2]); + $this->tableCalls[] = array('tablerow_open',array(),$call[2]); + $this->firstCell = TRUE; + } + + function tableEnd($call) { + $this->tableCalls[] = array('table_close',array(),$call[2]); + $this->finalizeTable(); + } + + function tableRowOpen($call) { + $this->tableCalls[] = $call; + $this->currentCols = 0; + $this->firstCell = TRUE; + $this->lastCellType = 'tablecell'; + $this->maxRows++; + } + + function tableRowClose($call) { + // Strip off final cell opening and anything after it + while ( $discard = array_pop($this->tableCalls ) ) { + + if ( $discard[0] == 'tablecell_open' || $discard[0] == 'tableheader_open') { + + // Its a spanning element - put it back and close it + if ( $discard[1][0] > 1 ) { + + $this->tableCalls[] = $discard; + if ( strstr($discard[0],'cell') ) { + $name = 'tablecell'; + } else { + $name = 'tableheader'; + } + $this->tableCalls[] = array($name.'_close',array(),$call[2]); + } + + break; + } + } + $this->tableCalls[] = $call; + + if ( $this->currentCols > $this->maxCols ) { + $this->maxCols = $this->currentCols; + } + } + + function tableCell($call) { + if ( !$this->firstCell ) { + + // Increase the span + $lastCall = end($this->tableCalls); + + // A cell call which follows an open cell means an empty cell so span + if ( $lastCall[0] == 'tablecell_open' || $lastCall[0] == 'tableheader_open' ) { + $this->tableCalls[] = array('colspan',array(),$call[2]); + + } + + $this->tableCalls[] = array($this->lastCellType.'_close',array(),$call[2]); + $this->tableCalls[] = array($call[0].'_open',array(1,NULL),$call[2]); + $this->lastCellType = $call[0]; + + } else { + + $this->tableCalls[] = array($call[0].'_open',array(1,NULL),$call[2]); + $this->lastCellType = $call[0]; + $this->firstCell = FALSE; + + } + + $this->currentCols++; + } + + function tableDefault($call) { + $this->tableCalls[] = $call; + } + + function finalizeTable() { + + // Add the max cols and rows to the table opening + if ( $this->tableCalls[0][0] == 'table_open' ) { + // Adjust to num cols not num col delimeters + $this->tableCalls[0][1][] = $this->maxCols - 1; + $this->tableCalls[0][1][] = $this->maxRows; + } else { + trigger_error('First element in table call list is not table_open'); + } + + $lastRow = 0; + $lastCell = 0; + $toDelete = array(); + + // Look for the colspan elements and increment the colspan on the + // previous non-empty opening cell. Once done, delete all the cells + // that contain colspans + foreach ( $this->tableCalls as $key => $call ) { + + if ( $call[0] == 'tablerow_open' ) { + + $lastRow = $key; + + } else if ( $call[0] == 'tablecell_open' || $call[0] == 'tableheader_open' ) { + + $lastCell = $key; + + } else if ( $call[0] == 'table_align' ) { + + // If the previous element was a cell open, align right + if ( $this->tableCalls[$key-1][0] == 'tablecell_open' || $this->tableCalls[$key-1][0] == 'tableheader_open' ) { + $this->tableCalls[$key-1][1][1] = 'right'; + + // If the next element if the close of an element, align either center or left + } else if ( $this->tableCalls[$key+1][0] == 'tablecell_close' || $this->tableCalls[$key+1][0] == 'tableheader_close' ) { + if ( $this->tableCalls[$lastCell][1][1] == 'right' ) { + $this->tableCalls[$lastCell][1][1] = 'center'; + } else { + $this->tableCalls[$lastCell][1][1] = 'left'; + } + + } + + // Now convert the whitespace back to cdata + $this->tableCalls[$key][0] = 'cdata'; + + } else if ( $call[0] == 'colspan' ) { + + $this->tableCalls[$key-1][1][0] = FALSE; + + for($i = $key-2; $i > $lastRow; $i--) { + + if ( $this->tableCalls[$i][0] == 'tablecell_open' || $this->tableCalls[$i][0] == 'tableheader_open' ) { + + if ( FALSE !== $this->tableCalls[$i][1][0] ) { + $this->tableCalls[$i][1][0]++; + break; + } + + + } + } + + $toDelete[] = $key-1; + $toDelete[] = $key; + $toDelete[] = $key+1; + } + } + + + // condense cdata + $cnt = count($this->tableCalls); + for( $key = 0; $key < $cnt; $key++){ + if($this->tableCalls[$key][0] == 'cdata'){ + $ckey = $key; + $key++; + while($this->tableCalls[$key][0] == 'cdata'){ + $this->tableCalls[$ckey][1][0] .= $this->tableCalls[$key][1][0]; + $toDelete[] = $key; + $key++; + } + continue; + } + } + + foreach ( $toDelete as $delete ) { + unset($this->tableCalls[$delete]); + } + $this->tableCalls = array_values($this->tableCalls); + } +} + +//------------------------------------------------------------------------ +class Doku_Handler_Section { + + function process($calls) { + + $sectionCalls = array(); + $inSection = FALSE; + + foreach ( $calls as $call ) { + + if ( $call[0] == 'header' ) { + + if ( $inSection ) { + $sectionCalls[] = array('section_close',array(), $call[2]); + } + + $sectionCalls[] = $call; + $sectionCalls[] = array('section_open',array($call[1][1]), $call[2]); + $inSection = TRUE; + + } else { + + if ($call[0] == 'section_open' ) { + $inSection = TRUE; + } else if ($call[0] == 'section_open' ) { + $inSection = FALSE; + } + $sectionCalls[] = $call; + } + } + + if ( $inSection ) { + $sectionCalls[] = array('section_close',array(), $call[2]); + } + + return $sectionCalls; + } + +} + +/** + * Handler for paragraphs + * + * @author Harry Fuecks + */ +class Doku_Handler_Block { + + var $calls = array(); + + var $blockStack = array(); + + var $inParagraph = FALSE; + var $atStart = TRUE; + var $skipEolKey = -1; + + // Blocks these should not be inside paragraphs + var $blockOpen = array( + 'header', + 'listu_open','listo_open','listitem_open','listcontent_open', + 'table_open','tablerow_open','tablecell_open','tableheader_open', + 'quote_open', + 'section_open', // Needed to prevent p_open between header and section_open + 'code','file','hr','preformatted','rss', + ); + + var $blockClose = array( + 'header', + 'listu_close','listo_close','listitem_close','listcontent_close', + 'table_close','tablerow_close','tablecell_close','tableheader_close', + 'quote_close', + 'section_close', // Needed to prevent p_close after section_close + 'code','file','hr','preformatted','rss', + ); + + // Stacks can contain paragraphs + var $stackOpen = array( + 'footnote_open','section_open', + ); + + var $stackClose = array( + 'footnote_close','section_close', + ); + + + /** + * Constructor. Adds loaded syntax plugins to the block and stack + * arrays + * + * @author Andreas Gohr + */ + function __construct(){ + global $DOKU_PLUGINS; + //check if syntax plugins were loaded + if(empty($DOKU_PLUGINS['syntax'])) return; + foreach($DOKU_PLUGINS['syntax'] as $n => $p){ + $ptype = $p->getPType(); + if($ptype == 'block'){ + $this->blockOpen[] = 'plugin_'.$n; + $this->blockClose[] = 'plugin_'.$n; + }elseif($ptype == 'stack'){ + $this->stackOpen[] = 'plugin_'.$n; + $this->stackClose[] = 'plugin_'.$n; + } + } + } + + /** + * Close a paragraph if needed + * + * This function makes sure there are no empty paragraphs on the stack + * + * @author Andreas Gohr + */ + function closeParagraph($pos){ + // look back if there was any content - we don't want empty paragraphs + $content = ''; + for($i=count($this->calls)-1; $i>=0; $i--){ + if($this->calls[$i][0] == 'p_open'){ + break; + }elseif($this->calls[$i][0] == 'cdata'){ + $content .= $this->calls[$i][1][0]; + }else{ + $content = 'found markup'; + break; + } + } + + if(trim($content)==''){ + //remove the whole paragraph + array_splice($this->calls,$i); + }else{ + if ($this->calls[count($this->calls)-1][0] == 'section_edit') { + $tmp = array_pop($this->calls); + $this->calls[] = array('p_close',array(), $pos); + $this->calls[] = $tmp; + } else { + $this->calls[] = array('p_close',array(), $pos); + } + } + + $this->inParagraph = FALSE; + } + + /** + * Processes the whole instruction stack to open and close paragraphs + * + * @author Harry Fuecks + * @author Andreas Gohr + * @todo This thing is really messy and should be rewritten + */ + function process($calls) { + foreach ( $calls as $key => $call ) { + $cname = $call[0]; + if($cname == 'plugin') { + $cname='plugin_'.$call[1][0]; + + $plugin = true; + $plugin_open = (($call[1][2] == DOKU_LEXER_ENTER) || ($call[1][2] == DOKU_LEXER_SPECIAL)); + $plugin_close = (($call[1][2] == DOKU_LEXER_EXIT) || ($call[1][2] == DOKU_LEXER_SPECIAL)); + } else { + $plugin = false; + } + + // Process blocks which are stack like... (contain linefeeds) + if ( in_array($cname,$this->stackOpen ) && (!$plugin || $plugin_open) ) { + + $this->calls[] = $call; + + // Hack - footnotes shouldn't immediately contain a p_open + if ( $cname != 'footnote_open' ) { + $this->addToStack(); + } else { + $this->addToStack(FALSE); + } + continue; + } + + if ( in_array($cname,$this->stackClose ) && (!$plugin || $plugin_close)) { + + if ( $this->inParagraph ) { + $this->closeParagraph($call[2]); + } + $this->calls[] = $call; + $this->removeFromStack(); + continue; + } + + if ( !$this->atStart ) { + + if ( $cname == 'eol' ) { + + // Check this isn't an eol instruction to skip... + if ( $this->skipEolKey != $key ) { + // Look to see if the next instruction is an EOL + if ( isset($calls[$key+1]) && $calls[$key+1][0] == 'eol' ) { + + if ( $this->inParagraph ) { + //$this->calls[] = array('p_close',array(), $call[2]); + $this->closeParagraph($call[2]); + } + + $this->calls[] = array('p_open',array(), $call[2]); + $this->inParagraph = TRUE; + + + // Mark the next instruction for skipping + $this->skipEolKey = $key+1; + + }else{ + //if this is just a single eol make a space from it + $this->calls[] = array('cdata',array(" "), $call[2]); + } + } + + + } else { + + $storeCall = TRUE; + if ( $this->inParagraph && (in_array($cname, $this->blockOpen) && (!$plugin || $plugin_open))) { + $this->closeParagraph($call[2]); + $this->calls[] = $call; + $storeCall = FALSE; + } + + if ( in_array($cname, $this->blockClose) && (!$plugin || $plugin_close)) { + if ( $this->inParagraph ) { + $this->closeParagraph($call[2]); + } + if ( $storeCall ) { + $this->calls[] = $call; + $storeCall = FALSE; + } + + // This really sucks and suggests this whole class sucks but... + if ( isset($calls[$key+1])) { + $cname_plusone = $calls[$key+1][0]; + if ($cname_plusone == 'plugin') { + $cname_plusone = 'plugin'.$calls[$key+1][1][0]; + + // plugin test, true if plugin has a state which precludes it requiring blockOpen or blockClose + $plugin_plusone = true; + $plugin_test = ($call[$key+1][1][2] == DOKU_LEXER_MATCHED) || ($call[$key+1][1][2] == DOKU_LEXER_MATCHED); + } else { + $plugin_plusone = false; + } + if ((!in_array($cname_plusone, $this->blockOpen) && !in_array($cname_plusone, $this->blockClose)) || + ($plugin_plusone && $plugin_test) + ) { + + $this->calls[] = array('p_open',array(), $call[2]); + $this->inParagraph = TRUE; + } + } + } + + if ( $storeCall ) { + $this->calls[] = $call; + } + + } + + + } else { + + // Unless there's already a block at the start, start a paragraph + if ( !in_array($cname,$this->blockOpen) ) { + $this->calls[] = array('p_open',array(), $call[2]); + if ( $call[0] != 'eol' ) { + $this->calls[] = $call; + } + $this->atStart = FALSE; + $this->inParagraph = TRUE; + } else { + $this->calls[] = $call; + $this->atStart = FALSE; + } + + } + + } + + if ( $this->inParagraph ) { + if ( $cname == 'p_open' ) { + // Ditch the last call + array_pop($this->calls); + } else if ( !in_array($cname, $this->blockClose) ) { + //$this->calls[] = array('p_close',array(), $call[2]); + $this->closeParagraph($call[2]); + } else { + $last_call = array_pop($this->calls); + //$this->calls[] = array('p_close',array(), $call[2]); + $this->closeParagraph($call[2]); + $this->calls[] = $last_call; + } + } + + return $this->calls; + } + + function addToStack($newStart = TRUE) { + $this->blockStack[] = array($this->atStart, $this->inParagraph); + $this->atStart = $newStart; + $this->inParagraph = FALSE; + } + + function removeFromStack() { + $state = array_pop($this->blockStack); + $this->atStart = $state[0]; + $this->inParagraph = $state[1]; + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parser/lexer.php b/plugins/dokuwiki/inc/parser/lexer.php new file mode 100644 index 0000000..249048f --- /dev/null +++ b/plugins/dokuwiki/inc/parser/lexer.php @@ -0,0 +1,607 @@ +_case = $case; + $this->_patterns = array(); + $this->_labels = array(); + $this->_regex = null; + } + + /** + * Adds a pattern with an optional label. + * @param mixed $pattern Perl style regex. Must be UTF-8 + * encoded. If its a string, the (, ) + * lose their meaning unless they + * form part of a lookahead or + * lookbehind assertation. + * @param string $label Label of regex to be returned + * on a match. Label must be ASCII + * @access public + */ + function addPattern($pattern, $label = true) { + $duplicate = false; + // Nux: check if not duplicate + // Note! This prevents regexp overflow when viewing Flyspray issues with many comments + if (in_array($pattern, $this->_patterns)) { + $index = array_search($pattern, $this->_patterns, true); + // label also have to be the same + if (isset($this->_labels[$index]) && $this->_labels[$index] === $label) { + $duplicate = true; + } + } + // only add new pattern if not duplicate... + if (!$duplicate) { + $count = count($this->_patterns); + $this->_patterns[$count] = $pattern; + $this->_labels[$count] = $label; + } + $this->_regex = null; + } + + /** + * Attempts to match all patterns at once against + * a string. + * @param string $subject String to match against. + * @param string $match First matched portion of + * subject. + * @return boolean True on success. + * @access public + */ + function match($subject, &$match) { + if (count($this->_patterns) == 0) { + return false; + } + if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) { + $match = ""; + return false; + } + + $match = $matches[0]; + $size = count($matches); + for ($i = 1; $i < $size; $i++) { + if ($matches[$i] && isset($this->_labels[$i - 1])) { + return $this->_labels[$i - 1]; + } + } + return true; + } + + /** + * Attempts to split the string against all patterns at once + * + * @param string $subject String to match against. + * @param array $split The split result: array containing, pre-match, match & post-match strings + * @return boolean True on success. + * @access public + * + * @author Christopher Smith + */ + function explode($subject, &$split) { + if (count($this->_patterns) == 0) { + return false; + } + + if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) { + $split = array($subject, "", ""); + return false; + } + + $idx = count($matches)-2; + + list($pre, $post) = preg_split($this->_patterns[$idx].$this->_getPerlMatchingFlags(), $subject, 2); + + $split = array($pre, $matches[0], $post); + return isset($this->_labels[$idx]) ? $this->_labels[$idx] : true; + } + + /** + * Compounds the patterns into a single + * regular expression separated with the + * "or" operator. Caches the regex. + * Will automatically escape (, ) and / tokens. + * @param array $patterns List of patterns in order. + * @access private + */ + function _getCompoundedRegex() { + if ($this->_regex == null) { + $cnt = count($this->_patterns); + for ($i = 0; $i < $cnt; $i++) { + + // Replace lookaheads / lookbehinds with marker + $m = "\1\1"; + $pattern = preg_replace( + array ( + '/\(\?(i|m|s|x|U)\)/U', + '/\(\?(\-[i|m|s|x|U])\)/U', + '/\(\?\=(.*)\)/sU', + '/\(\?\!(.*)\)/sU', + '/\(\?\<\=(.*)\)/sU', + '/\(\?\<\!(.*)\)/sU', + '/\(\?\:(.*)\)/sU', + ), + array ( + $m.'SO:\\1'.$m, + $m.'SOR:\\1'.$m, + $m.'LA:IS:\\1'.$m, + $m.'LA:NOT:\\1'.$m, + $m.'LB:IS:\\1'.$m, + $m.'LB:NOT:\\1'.$m, + $m.'GRP:\\1'.$m, + ), + $this->_patterns[$i] + ); + // Quote the rest + $pattern = str_replace( + array('/', '(', ')'), + array('\/', '\(', '\)'), + $pattern + ); + + // Restore lookaheads / lookbehinds + $pattern = preg_replace( + array ( + '/'.$m.'SO:(.{1})'.$m.'/', + '/'.$m.'SOR:(.{2})'.$m.'/', + '/'.$m.'LA:IS:(.*)'.$m.'/sU', + '/'.$m.'LA:NOT:(.*)'.$m.'/sU', + '/'.$m.'LB:IS:(.*)'.$m.'/sU', + '/'.$m.'LB:NOT:(.*)'.$m.'/sU', + '/'.$m.'GRP:(.*)'.$m.'/sU', + ), + array ( + '(?\\1)', + '(?\\1)', + '(?=\\1)', + '(?!\\1)', + '(?<=\\1)', + '(?_patterns[$i] = '('.$pattern.')'; + } + $this->_regex = "/" . implode("|", $this->_patterns) . "/" . $this->_getPerlMatchingFlags(); + } + return $this->_regex; + } + + /** + * Accessor for perl regex mode flags to use. + * @return string Perl regex flags. + * @access private + */ + function _getPerlMatchingFlags() { + return ($this->_case ? "msS" : "msSi"); + } +} + +/** + * States for a stack machine. + * @package Lexer + * @subpackage Lexer + */ +class Doku_LexerStateStack { + var $_stack; + + /** + * Constructor. Starts in named state. + * @param string $start Starting state name. + * @access public + */ + function __construct($start) { + $this->_stack = array($start); + } + + /** + * Accessor for current state. + * @return string State. + * @access public + */ + function getCurrent() { + return $this->_stack[count($this->_stack) - 1]; + } + + /** + * Adds a state to the stack and sets it + * to be the current state. + * @param string $state New state. + * @access public + */ + function enter($state) { + array_push($this->_stack, $state); + } + + /** + * Leaves the current state and reverts + * to the previous one. + * @return boolean False if we drop off + * the bottom of the list. + * @access public + */ + function leave() { + if (count($this->_stack) == 1) { + return false; + } + array_pop($this->_stack); + return true; + } +} + +/** + * Accepts text and breaks it into tokens. + * Some optimisation to make the sure the + * content is only scanned by the PHP regex + * parser once. Lexer modes must not start + * with leading underscores. + * @package Doku + * @subpackage Lexer + */ +class Doku_Lexer { + var $_regexes; + var $_parser; + var $_mode; + var $_mode_handlers; + var $_case; + + /** + * Sets up the lexer in case insensitive matching + * by default. + * @param Doku_Parser $parser Handling strategy by + * reference. + * @param string $start Starting handler. + * @param boolean $case True for case sensitive. + * @access public + */ + function __construct(&$parser, $start = "accept", $case = false) { + $this->_case = $case; + $this->_regexes = array(); + $this->_parser = &$parser; + $this->_mode = new Doku_LexerStateStack($start); + $this->_mode_handlers = array(); + } + + /** + * Adds a token search pattern for a particular + * parsing mode. The pattern does not change the + * current mode. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @access public + */ + function addPattern($pattern, $mode = "accept") { + if (! isset($this->_regexes[$mode])) { + $this->_regexes[$mode] = new Doku_LexerParallelRegex($this->_case); + } + $this->_regexes[$mode]->addPattern($pattern); + } + + /** + * Adds a pattern that will enter a new parsing + * mode. Useful for entering parenthesis, strings, + * tags, etc. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $new_mode Change parsing to this new + * nested mode. + * @access public + */ + function addEntryPattern($pattern, $mode, $new_mode) { + if (! isset($this->_regexes[$mode])) { + $this->_regexes[$mode] = new Doku_LexerParallelRegex($this->_case); + } + $this->_regexes[$mode]->addPattern($pattern, $new_mode); + } + + /** + * Adds a pattern that will exit the current mode + * and re-enter the previous one. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Mode to leave. + * @access public + */ + function addExitPattern($pattern, $mode) { + if (! isset($this->_regexes[$mode])) { + $this->_regexes[$mode] = new Doku_LexerParallelRegex($this->_case); + } + $this->_regexes[$mode]->addPattern($pattern, "__exit"); + } + + /** + * Adds a pattern that has a special mode. Acts as an entry + * and exit pattern in one go, effectively calling a special + * parser handler for this token only. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $special Use this mode for this one token. + * @access public + */ + function addSpecialPattern($pattern, $mode, $special) { + if (! isset($this->_regexes[$mode])) { + $this->_regexes[$mode] = new Doku_LexerParallelRegex($this->_case); + } + $this->_regexes[$mode]->addPattern($pattern, "_$special"); + } + + /** + * Adds a mapping from a mode to another handler. + * @param string $mode Mode to be remapped. + * @param string $handler New target handler. + * @access public + */ + function mapHandler($mode, $handler) { + $this->_mode_handlers[$mode] = $handler; + } + + /** + * Splits the page text into tokens. Will fail + * if the handlers report an error or if no + * content is consumed. If successful then each + * unparsed and parsed token invokes a call to the + * held listener. + * @param string $raw Raw HTML text. + * @return boolean True on success, else false. + * @access public + */ + function parse($raw) { + if (! isset($this->_parser)) { + return false; + } + $initialLength = strlen($raw); + $length = $initialLength; + $pos = 0; + while (is_array($parsed = $this->_reduce($raw))) { + list($unmatched, $matched, $mode) = $parsed; + $currentLength = strlen($raw); + $matchPos = $initialLength - $currentLength - strlen($matched); + if (! $this->_dispatchTokens($unmatched, $matched, $mode, $pos, $matchPos)) { + return false; + } + if ($currentLength == $length) { + return false; + } + $length = $currentLength; + $pos = $initialLength - $currentLength; + } + if (!$parsed) { + return false; + } + return $this->_invokeParser($raw, DOKU_LEXER_UNMATCHED, $pos); + } + + /** + * Sends the matched token and any leading unmatched + * text to the parser changing the lexer to a new + * mode if one is listed. + * @param string $unmatched Unmatched leading portion. + * @param string $matched Actual token match. + * @param string $mode Mode after match. A boolean + * false mode causes no change. + * @param int $pos Current byte index location in raw doc + * thats being parsed + * @return boolean False if there was any error + * from the parser. + * @access private + */ + function _dispatchTokens($unmatched, $matched, $mode = false, $initialPos, $matchPos) { + if (! $this->_invokeParser($unmatched, DOKU_LEXER_UNMATCHED, $initialPos) ){ + return false; + } + if ($this->_isModeEnd($mode)) { + if (! $this->_invokeParser($matched, DOKU_LEXER_EXIT, $matchPos)) { + return false; + } + return $this->_mode->leave(); + } + if ($this->_isSpecialMode($mode)) { + $this->_mode->enter($this->_decodeSpecial($mode)); + if (! $this->_invokeParser($matched, DOKU_LEXER_SPECIAL, $matchPos)) { + return false; + } + return $this->_mode->leave(); + } + if (is_string($mode)) { + $this->_mode->enter($mode); + return $this->_invokeParser($matched, DOKU_LEXER_ENTER, $matchPos); + } + return $this->_invokeParser($matched, DOKU_LEXER_MATCHED, $matchPos); + } + + /** + * Tests to see if the new mode is actually to leave + * the current mode and pop an item from the matching + * mode stack. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private + */ + function _isModeEnd($mode) { + return ($mode === "__exit"); + } + + /** + * Test to see if the mode is one where this mode + * is entered for this token only and automatically + * leaves immediately afterwoods. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private + */ + function _isSpecialMode($mode) { + return (strncmp($mode, "_", 1) == 0); + } + + /** + * Strips the magic underscore marking single token + * modes. + * @param string $mode Mode to decode. + * @return string Underlying mode name. + * @access private + */ + function _decodeSpecial($mode) { + return substr($mode, 1); + } + + /** + * Calls the parser method named after the current + * mode. Empty content will be ignored. The lexer + * has a parser handler for each mode in the lexer. + * @param string $content Text parsed. + * @param boolean $is_match Token is recognised rather + * than unparsed data. + * @param int $pos Current byte index location in raw doc + * thats being parsed + * @access private + */ + function _invokeParser($content, $is_match, $pos) { + if (($content === "") || ($content === false)) { + return true; + } + $handler = $this->_mode->getCurrent(); + if (isset($this->_mode_handlers[$handler])) { + $handler = $this->_mode_handlers[$handler]; + } + + // modes starting with plugin_ are all handled by the same + // handler but with an additional parameter + if(substr($handler,0,7)=='plugin_'){ + list($handler,$plugin) = explode('_',$handler,2); + return $this->_parser->$handler($content, $is_match, $pos, $plugin); + } + + return $this->_parser->$handler($content, $is_match, $pos); + } + + /** + * Tries to match a chunk of text and if successful + * removes the recognised chunk and any leading + * unparsed data. Empty strings will not be matched. + * @param string $raw The subject to parse. This is the + * content that will be eaten. + * @return array Three item list of unparsed + * content followed by the + * recognised token and finally the + * action the parser is to take. + * True if no match, false if there + * is a parsing error. + * @access private + */ + function _reduce(&$raw) { + if (! isset($this->_regexes[$this->_mode->getCurrent()])) { + return false; + } + if ($raw === "") { + return true; + } + if ($action = $this->_regexes[$this->_mode->getCurrent()]->explode($raw, $split)) { + list($unparsed, $match, $raw) = $split; + return array($unparsed, $match, $action); + } + return true; + } +} + +/** +* Escapes regex characters other than (, ) and / +* @TODO +*/ +function Doku_Lexer_Escape($str) { + //$str = addslashes($str); + $chars = array( + '/\\\\/', + '/\./', + '/\+/', + '/\*/', + '/\?/', + '/\[/', + '/\^/', + '/\]/', + '/\$/', + '/\{/', + '/\}/', + '/\=/', + '/\!/', + '/\/', + '/\|/', + '/\:/' + ); + + $escaped = array( + '\\\\\\\\', + '\.', + '\+', + '\*', + '\?', + '\[', + '\^', + '\]', + '\$', + '\{', + '\}', + '\=', + '\!', + '\<', + '\>', + '\|', + '\:' + ); + return preg_replace($chars, $escaped, $str); +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parser/parser.php b/plugins/dokuwiki/inc/parser/parser.php new file mode 100644 index 0000000..b77af88 --- /dev/null +++ b/plugins/dokuwiki/inc/parser/parser.php @@ -0,0 +1,932 @@ + array('listblock','table','quote','hr'), + + // some mode are allowed inside the base mode only + 'baseonly' => array('header'), + + // modes for styling text -- footnote behaves similar to styling + 'formatting' => array('strong', 'emphasis', 'underline', 'monospace', + 'subscript', 'superscript', 'deleted', 'footnote'), + + // modes where the token is simply replaced - they can not contain any + // other modes + 'substition' => array('acronym','smiley','wordblock','entity', + 'camelcaselink', 'internallink','media', + 'externallink','linebreak','emaillink', + 'windowssharelink','filelink','notoc', + 'nocache','multiplyentity','quotes','rss'), + + // modes which have a start and end token but inside which + // no other modes should be applied + 'protected' => array('preformatted','code','file','php','html'), + + // inside this mode no wiki markup should be applied but lineendings + // and whitespace isn't preserved + 'disabled' => array('unformatted'), + + // used to mark paragraph boundaries + 'paragraphs' => array('eol') +); + +//------------------------------------------------------------------- + +/** +* Sets up the Lexer with modes and points it to the Handler +* For an intro to the Lexer see: wiki:parser +*/ +class Doku_Parser { + + var $Handler; + + var $Lexer; + + var $modes = array(); + + var $connected = FALSE; + + function addBaseMode(& $BaseMode) { + $this->modes['base'] = & $BaseMode; + if ( !$this->Lexer ) { + $this->Lexer = new Doku_Lexer($this->Handler,'base', TRUE); + } + $this->modes['base']->Lexer = & $this->Lexer; + } + + /** + * PHP preserves order of associative elements + * Mode sequence is important + */ + function addMode($name, & $Mode) { + if ( !isset($this->modes['base']) ) { + $this->addBaseMode(new Doku_Parser_Mode_base()); + } + $Mode->Lexer = & $this->Lexer; + $this->modes[$name] = & $Mode; + } + + function connectModes() { + + if ( $this->connected ) { + return; + } + + foreach ( array_keys($this->modes) as $mode ) { + + // Base isn't connected to anything + if ( $mode == 'base' ) { + continue; + } + + $this->modes[$mode]->preConnect(); + + foreach ( array_keys($this->modes) as $cm ) { + + if ( $this->modes[$cm]->accepts($mode) ) { + $this->modes[$mode]->connectTo($cm); + } + + } + + $this->modes[$mode]->postConnect(); + } + + $this->connected = TRUE; + } + + function parse($doc) { + if ( $this->Lexer ) { + $this->connectModes(); + // Normalize CRs and pad doc + $doc = "\n".str_replace("\r\n","\n",$doc)."\n"; + $this->Lexer->parse($doc); + $this->Handler->_finalize(); + return $this->Handler->calls; + } else { + return FALSE; + } + } + +} + +//------------------------------------------------------------------- +/** + * This class and all the subclasses below are + * used to reduce the effort required to register + * modes with the Lexer. For performance these + * could all be eliminated later perhaps, or + * the Parser could be serialized to a file once + * all modes are registered + * + * @author Harry Fuecks +*/ +class Doku_Parser_Mode { + + var $Lexer; + + var $allowedModes = array(); + + // returns a number used to determine in which order modes are added + function getSort() { + trigger_error('getSort() not implemented in '.get_class($this), E_USER_WARNING); + } + + // Called before any calls to connectTo + function preConnect() {} + + // Connects the mode + function connectTo($mode) {} + + // Called after all calls to connectTo + function postConnect() {} + + function accepts($mode) { + return in_array($mode, $this->allowedModes ); + } + +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_base extends Doku_Parser_Mode { + + function __construct() { + global $PARSER_MODES; + + $this->allowedModes = array_merge ( + $PARSER_MODES['container'], + $PARSER_MODES['baseonly'], + $PARSER_MODES['paragraphs'], + $PARSER_MODES['formatting'], + $PARSER_MODES['substition'], + $PARSER_MODES['protected'], + $PARSER_MODES['disabled'] + ); + } + + function getSort() { + return 0; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_footnote extends Doku_Parser_Mode { + + function __construct() { + global $PARSER_MODES; + + $this->allowedModes = array_merge ( + $PARSER_MODES['container'], + $PARSER_MODES['formatting'], + $PARSER_MODES['substition'], + $PARSER_MODES['protected'], + $PARSER_MODES['disabled'] + ); + + unset($this->allowedModes[array_search('footnote', $this->allowedModes)]); + } + + function connectTo($mode) { + $this->Lexer->addEntryPattern( + '\x28\x28(?=.*\x29\x29)',$mode,'footnote' + ); + } + + function postConnect() { + $this->Lexer->addExitPattern( + '\x29\x29','footnote' + ); + } + + function getSort() { + return 150; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_header extends Doku_Parser_Mode { + + function preConnect() { + //we're not picky about the closing ones, two are enough + $this->Lexer->addSpecialPattern( + '[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)', + 'base', + 'header' + ); + } + + function getSort() { + return 50; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_notoc extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern('~~NOTOC~~',$mode,'notoc'); + } + + function getSort() { + return 30; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_nocache extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern('~~NOCACHE~~',$mode,'nocache'); + } + + function getSort() { + return 40; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_linebreak extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern('\x5C{2}(?=\s)',$mode,'linebreak'); + } + + function getSort() { + return 140; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_eol extends Doku_Parser_Mode { + + function connectTo($mode) { + $badModes = array('listblock','table'); + if ( in_array($mode, $badModes) ) { + return; + } + $this->Lexer->addSpecialPattern('\n',$mode,'eol'); + } + + function getSort() { + return 370; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_hr extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern('\n[ \t]*-{4,}[ \t]*(?=\n)',$mode,'hr'); + } + + function getSort() { + return 160; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_formatting extends Doku_Parser_Mode { + var $type; + + var $formatting = array ( + 'strong' => array ( + 'entry'=>'\*\*(?=.*\*\*)', + 'exit'=>'\*\*', + 'sort'=>70 + ), + + 'emphasis'=> array ( + 'entry'=>'//(?=[^\x00]*[^:]//)', //hack for bug #384 + 'exit'=>'//', + 'sort'=>80 + ), + + 'underline'=> array ( + 'entry'=>'__(?=.*__)', + 'exit'=>'__', + 'sort'=>90 + ), + + 'monospace'=> array ( + 'entry'=>'\x27\x27(?=.*\x27\x27)', + 'exit'=>'\x27\x27', + 'sort'=>100 + ), + + 'subscript'=> array ( + 'entry'=>'(?=.*)', + 'exit'=>'', + 'sort'=>110 + ), + + 'superscript'=> array ( + 'entry'=>'(?=.*)', + 'exit'=>'', + 'sort'=>120 + ), + + 'deleted'=> array ( + 'entry'=>'(?=.*)', + 'exit'=>'', + 'sort'=>130 + ), + ); + + function __construct($type) { + global $PARSER_MODES; + + if ( !array_key_exists($type, $this->formatting) ) { + trigger_error('Invalid formatting type '.$type, E_USER_WARNING); + } + + $this->type = $type; + + // formatting may contain other formatting but not it self + $modes = $PARSER_MODES['formatting']; + $key = array_search($type, $modes); + if ( is_int($key) ) { + unset($modes[$key]); + } + + $this->allowedModes = array_merge ( + $modes, + $PARSER_MODES['substition'], + $PARSER_MODES['disabled'] + ); + } + + function connectTo($mode) { + + // Can't nest formatting in itself + if ( $mode == $this->type ) { + return; + } + + $this->Lexer->addEntryPattern( + $this->formatting[$this->type]['entry'], + $mode, + $this->type + ); + } + + function postConnect() { + + $this->Lexer->addExitPattern( + $this->formatting[$this->type]['exit'], + $this->type + ); + + } + + function getSort() { + return $this->formatting[$this->type]['sort']; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_listblock extends Doku_Parser_Mode { + + function __construct() { + global $PARSER_MODES; + + $this->allowedModes = array_merge ( + $PARSER_MODES['formatting'], + $PARSER_MODES['substition'], + $PARSER_MODES['disabled'], + $PARSER_MODES['protected'] #XXX new + ); + + // $this->allowedModes[] = 'footnote'; + } + + function connectTo($mode) { + $this->Lexer->addEntryPattern('\n {2,}[\-\*]',$mode,'listblock'); + $this->Lexer->addEntryPattern('\n\t{1,}[\-\*]',$mode,'listblock'); + + $this->Lexer->addPattern('\n {2,}[\-\*]','listblock'); + $this->Lexer->addPattern('\n\t{1,}[\-\*]','listblock'); + + } + + function postConnect() { + $this->Lexer->addExitPattern('\n','listblock'); + } + + function getSort() { + return 10; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_table extends Doku_Parser_Mode { + + function __construct() { + global $PARSER_MODES; + + $this->allowedModes = array_merge ( + $PARSER_MODES['formatting'], + $PARSER_MODES['substition'], + $PARSER_MODES['disabled'], + $PARSER_MODES['protected'] + ); + } + + function connectTo($mode) { + $this->Lexer->addEntryPattern('\n\^',$mode,'table'); + $this->Lexer->addEntryPattern('\n\|',$mode,'table'); + } + + function postConnect() { + $this->Lexer->addPattern('\n\^','table'); + $this->Lexer->addPattern('\n\|','table'); + #$this->Lexer->addPattern(' {2,}','table'); + $this->Lexer->addPattern('[\t ]+','table'); + $this->Lexer->addPattern('\^','table'); + $this->Lexer->addPattern('\|','table'); + $this->Lexer->addExitPattern('\n','table'); + } + + function getSort() { + return 60; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_unformatted extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addEntryPattern('(?=.*)',$mode,'unformatted'); + $this->Lexer->addEntryPattern('%%(?=.*%%)',$mode,'unformattedalt'); + } + + function postConnect() { + $this->Lexer->addExitPattern('','unformatted'); + $this->Lexer->addExitPattern('%%','unformattedalt'); + $this->Lexer->mapHandler('unformattedalt','unformatted'); + } + + function getSort() { + return 170; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_php extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addEntryPattern('(?=.*)',$mode,'php'); + } + + function postConnect() { + $this->Lexer->addExitPattern('','php'); + } + + function getSort() { + return 180; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_html extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addEntryPattern('(?=.*)',$mode,'html'); + } + + function postConnect() { + $this->Lexer->addExitPattern('','html'); + } + + function getSort() { + return 190; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_preformatted extends Doku_Parser_Mode { + + function connectTo($mode) { + // Has hard coded awareness of lists... + $this->Lexer->addEntryPattern('\n (?![\*\-])',$mode,'preformatted'); + $this->Lexer->addEntryPattern('\n\t(?![\*\-])',$mode,'preformatted'); + + // How to effect a sub pattern with the Lexer! + $this->Lexer->addPattern('\n ','preformatted'); + $this->Lexer->addPattern('\n\t','preformatted'); + + } + + function postConnect() { + $this->Lexer->addExitPattern('\n','preformatted'); + } + + function getSort() { + return 20; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_code extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addEntryPattern(')',$mode,'code'); + } + + function postConnect() { + $this->Lexer->addExitPattern('','code'); + } + + function getSort() { + return 200; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_file extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addEntryPattern('(?=.*)',$mode,'file'); + } + + function postConnect() { + $this->Lexer->addExitPattern('','file'); + } + + function getSort() { + return 210; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_quote extends Doku_Parser_Mode { + + function __construct() { + global $PARSER_MODES; + + $this->allowedModes = array_merge ( + $PARSER_MODES['formatting'], + $PARSER_MODES['substition'], + $PARSER_MODES['disabled'], + $PARSER_MODES['protected'] #XXX new + ); + #$this->allowedModes[] = 'footnote'; + #$this->allowedModes[] = 'preformatted'; + #$this->allowedModes[] = 'unformatted'; + } + + function connectTo($mode) { + $this->Lexer->addEntryPattern('\n>{1,}',$mode,'quote'); + } + + function postConnect() { + $this->Lexer->addPattern('\n>{1,}','quote'); + $this->Lexer->addExitPattern('\n','quote'); + } + + function getSort() { + return 220; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { + // A list + var $acronyms = array(); + var $pattern = ''; + + function __construct($acronyms) { + $this->acronyms = $acronyms; + } + + function preConnect() { + if(!count($this->acronyms)) return; + + $bound = '[\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]'; + $acronyms = array_map('Doku_Lexer_Escape',$this->acronyms); + $this->pattern = '(?<=^|'.$bound.')(?:'.join('|',$acronyms).')(?='.$bound.')'; + } + + function connectTo($mode) { + if(!count($this->acronyms)) return; + + if ( strlen($this->pattern) > 0 ) { + $this->Lexer->addSpecialPattern($this->pattern,$mode,'acronym'); + } + } + + function getSort() { + return 240; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_smiley extends Doku_Parser_Mode { + // A list + var $smileys = array(); + var $pattern = ''; + + function __construct($smileys) { + $this->smileys = $smileys; + } + + function preConnect() { + if(!count($this->smileys)) return; + + $sep = ''; + // Nux: fix for potential pattern overflow... + $this->pattern = ''; + foreach ( $this->smileys as $smiley ) { + $this->pattern .= $sep.Doku_Lexer_Escape($smiley); + $sep = '|'; + } + } + + function connectTo($mode) { + if(!count($this->smileys)) return; + + if ( strlen($this->pattern) > 0 ) { + $this->Lexer->addSpecialPattern($this->pattern,$mode,'smiley'); + } + } + + function getSort() { + return 230; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_wordblock extends Doku_Parser_Mode { + // A list + var $badwords = array(); + var $pattern = ''; + + function __construct($badwords) { + $this->badwords = $badwords; + } + + function preConnect() { + + if ( count($this->badwords) == 0 ) { + return; + } + + $sep = ''; + // Nux: fix for potential pattern overflow... + $this->pattern = ''; + foreach ( $this->badwords as $badword ) { + $this->pattern .= $sep.'(?<=\b)(?i)'.Doku_Lexer_Escape($badword).'(?-i)(?=\b)'; + $sep = '|'; + } + + } + + function connectTo($mode) { + if ( strlen($this->pattern) > 0 ) { + $this->Lexer->addSpecialPattern($this->pattern,$mode,'wordblock'); + } + } + + function getSort() { + return 250; + } +} + +//------------------------------------------------------------------- +/** +* @TODO Quotes and 640x480 are not supported - just straight replacements here +*/ +class Doku_Parser_Mode_entity extends Doku_Parser_Mode { + // A list + var $entities = array(); + var $pattern = ''; + + function __construct($entities) { + $this->entities = $entities; + } + + function preConnect() { + if(!count($this->entities)) return; + + $sep = ''; + // Nux: fix for potential pattern overflow... + $this->pattern = ''; + foreach ( $this->entities as $entity ) { + $this->pattern .= $sep.Doku_Lexer_Escape($entity); + $sep = '|'; + } + } + + function connectTo($mode) { + if(!count($this->entities)) return; + + if ( strlen($this->pattern) > 0 ) { + $this->Lexer->addSpecialPattern($this->pattern,$mode,'entity'); + } + } + + function getSort() { + return 260; + } +} + +//------------------------------------------------------------------- +// Implements the 640x480 replacement +class Doku_Parser_Mode_multiplyentity extends Doku_Parser_Mode { + + function connectTo($mode) { + + $this->Lexer->addSpecialPattern( + '(?<=\b)\d+[xX]\d+(?=\b)',$mode,'multiplyentity' + ); + + } + + function getSort() { + return 270; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_quotes extends Doku_Parser_Mode { + + function connectTo($mode) { + + $this->Lexer->addSpecialPattern( + '(?<=^|\s)\'(?=\S)',$mode,'singlequoteopening' + ); + $this->Lexer->addSpecialPattern( + '(?<=^|\S)\'',$mode,'singlequoteclosing' + ); + $this->Lexer->addSpecialPattern( + '(?<=^|\s)"(?=\S)',$mode,'doublequoteopening' + ); + $this->Lexer->addSpecialPattern( + '(?<=^|\S)"',$mode,'doublequoteclosing' + ); + + } + + function getSort() { + return 280; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_camelcaselink extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern( + '\b[A-Z]+[a-z]+[A-Z][A-Za-z]*\b',$mode,'camelcaselink' + ); + } + + function getSort() { + return 290; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_internallink extends Doku_Parser_Mode { + + function connectTo($mode) { + // Word boundaries? + $this->Lexer->addSpecialPattern("\[\[.+?\]\]",$mode,'internallink'); + } + + function getSort() { + return 300; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_media extends Doku_Parser_Mode { + + function connectTo($mode) { + // Word boundaries? + $this->Lexer->addSpecialPattern("\{\{[^\}]+\}\}",$mode,'media'); + } + + function getSort() { + return 320; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_rss extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern("\{\{rss>[^\}]+\}\}",$mode,'rss'); + } + + function getSort() { + return 310; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_externallink extends Doku_Parser_Mode { + var $schemes = array('http','https','telnet','gopher','wais','ftp','ed2k','irc','ldap'); + var $patterns = array(); + + function preConnect() { + + $ltrs = '\w'; + $gunk = '/\#~:.?+=&%@!\-'; + $punc = '.:?\-;,'; + $host = $ltrs.$punc; + $any = $ltrs.$gunk.$punc; + + foreach ( $this->schemes as $scheme ) { + $this->patterns[] = '\b(?i)'.$scheme.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; + } + + $this->patterns[] = '\b(?i)www?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; + $this->patterns[] = '\b(?i)ftp?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; + + } + + function connectTo($mode) { + foreach ( $this->patterns as $pattern ) { + $this->Lexer->addSpecialPattern($pattern,$mode,'externallink'); + } + } + + function getSort() { + return 330; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_filelink extends Doku_Parser_Mode { + + var $pattern; + + function preConnect() { + + $ltrs = '\w'; + $gunk = '/\#~:.?+=&%@!\-'; + $punc = '.:?\-;,'; + $host = $ltrs.$punc; + $any = $ltrs.$gunk.$punc; + + $this->pattern = '\b(?i)file(?-i)://['.$any.']+?['. + $punc.']*[^'.$any.']'; + } + + function connectTo($mode) { + $this->Lexer->addSpecialPattern( + $this->pattern,$mode,'filelink'); + } + + function getSort() { + return 360; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_windowssharelink extends Doku_Parser_Mode { + + var $pattern; + + function preConnect() { + $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w$]+)+"; + } + + function connectTo($mode) { + $this->Lexer->addSpecialPattern( + $this->pattern,$mode,'windowssharelink'); + } + + function getSort() { + return 350; + } +} + +//------------------------------------------------------------------- +class Doku_Parser_Mode_emaillink extends Doku_Parser_Mode { + + function connectTo($mode) { + $this->Lexer->addSpecialPattern("<[\w0-9\-_.]+?@[\w\-]+\.[\w\-\.]+\.*[\w]+>",$mode,'emaillink'); + } + + function getSort() { + return 340; + } +} + + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parser/renderer.php b/plugins/dokuwiki/inc/parser/renderer.php new file mode 100644 index 0000000..f9dcaab --- /dev/null +++ b/plugins/dokuwiki/inc/parser/renderer.php @@ -0,0 +1,212 @@ + + * @author Andreas Gohr + */ +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); + +require_once DOKU_INC . 'inc/parser/renderer.php'; +require_once DOKU_INC . 'inc/pluginutils.php'; + +class Doku_Renderer { + var $info = array( + 'cache' => TRUE, // may the rendered result cached? + 'toc' => TRUE, // render the TOC? + ); + + + function nocache() { + $this->info['cache'] = FALSE; + } + + function notoc() { + $this->info['toc'] = FALSE; + } + + //handle plugin rendering + function plugin($name,$data){ + $plugin =& plugin_load('syntax',$name); + if($plugin != null){ + // determine mode from renderer class name - format = "Doku_Renderer_" + $mode = substr(get_class($this), 14); + $plugin->render($mode,$this,$data); + } + } + + /** + * handle nested render instructions + * this method (and nest_close method) should not be overloaded in actual renderer output classes + */ + function nest($instructions) { + + foreach ( $instructions as $instruction ) { + // execute the callback against ourself + call_user_func_array(array(&$this, $instruction[0]),$instruction[1]); + } + } + + // dummy closing instruction issued by Doku_Handler_Nest, normally the syntax mode should + // override this instruction when instantiating Doku_Handler_Nest - however plugins will not + // be able to - as their instructions require data. + function nest_close() {} + + function document_start() {} + + function document_end() {} + + function render_TOC() { return ''; } + + function header($text, $level, $pos) {} + + function section_edit($start, $end, $level, $name) {} + + function section_open($level) {} + + function section_close() {} + + function cdata($text) {} + + function p_open() {} + + function p_close() {} + + function linebreak() {} + + function hr() {} + + function strong_open() {} + + function strong_close() {} + + function emphasis_open() {} + + function emphasis_close() {} + + function underline_open() {} + + function underline_close() {} + + function monospace_open() {} + + function monospace_close() {} + + function subscript_open() {} + + function subscript_close() {} + + function superscript_open() {} + + function superscript_close() {} + + function deleted_open() {} + + function deleted_close() {} + + function footnote_open() {} + + function footnote_close() {} + + function listu_open() {} + + function listu_close() {} + + function listo_open() {} + + function listo_close() {} + + function listitem_open($level) {} + + function listitem_close() {} + + function listcontent_open() {} + + function listcontent_close() {} + + function unformatted($text) {} + + function php($text) {} + + function html($text) {} + + function preformatted($text) {} + + function file($text) {} + + function quote_open() {} + + function quote_close() {} + + function code($text, $lang = NULL) {} + + function acronym($acronym) {} + + function smiley($smiley) {} + + function wordblock($word) {} + + function entity($entity) {} + + // 640x480 ($x=640, $y=480) + function multiplyentity($x, $y) {} + + function singlequoteopening() {} + + function singlequoteclosing() {} + + function doublequoteopening() {} + + function doublequoteclosing() {} + + // $link like 'SomePage' + function camelcaselink($link) {} + + // $link like 'wiki:syntax', $title could be an array (media) + function internallink($link, $title = NULL) {} + + // $link is full URL with scheme, $title could be an array (media) + function externallink($link, $title = NULL) {} + + // $link is the original link - probably not much use + // $wikiName is an indentifier for the wiki + // $wikiUri is the URL fragment to append to some known URL + function interwikilink($link, $title = NULL, $wikiName, $wikiUri) {} + + // Link to file on users OS, $title could be an array (media) + function filelink($link, $title = NULL) {} + + // Link to a Windows share, , $title could be an array (media) + function windowssharelink($link, $title = NULL) {} + +// function email($address, $title = NULL) {} + function emaillink($address, $name = NULL) {} + + function internalmedialink ( + $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL + ) {} + + function externalmedialink( + $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL + ) {} + + function table_open($maxcols = NULL, $numrows = NULL){} + + function table_close(){} + + function tablerow_open(){} + + function tablerow_close(){} + + function tableheader_open($colspan = 1, $align = NULL){} + + function tableheader_close(){} + + function tablecell_open($colspan = 1, $align = NULL){} + + function tablecell_close(){} + +} + + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parser/xhtml.php b/plugins/dokuwiki/inc/parser/xhtml.php new file mode 100644 index 0000000..a220819 --- /dev/null +++ b/plugins/dokuwiki/inc/parser/xhtml.php @@ -0,0 +1,1097 @@ + + * @author Andreas Gohr + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); + +if ( !defined('DOKU_LF') ) { + // Some whitespace to help View > Source + define ('DOKU_LF',"\n"); +} + +if ( !defined('DOKU_TAB') ) { + // Some whitespace to help View > Source + define ('DOKU_TAB',"\t"); +} + +require_once DOKU_INC . 'inc/parser/renderer.php'; +require_once DOKU_INC . 'inc/html.php'; + +/** + * The Renderer + */ +class Doku_Renderer_xhtml extends Doku_Renderer { + + // @access public + var $doc = ''; // will contain the whole document + var $toc = array(); // will contain the Table of Contents + + + var $headers = array(); + + var $footnotes = array(); + + var $acronyms = array(); + var $smileys = array(); + var $badwords = array(); + var $entities = array(); + var $interwiki = array(); + + var $lastsec = 0; + + var $store = ''; + + function document_start() { + //reset some internals + $this->toc = array(); + $this->headers = array(); + } + + function document_end() { + if ( count ($this->footnotes) > 0 ) { + $this->doc .= '
        '.DOKU_LF; + + $id = 0; + foreach ( $this->footnotes as $footnote ) { + $id++; // the number of the current footnote + + // check its not a placeholder that indicates actual footnote text is elsewhere + if (substr($footnote, 0, 5) != "@@FNT") { + + // open the footnote and set the anchor and backlink + $this->doc .= '
        '; + $this->doc .= ''; + $this->doc .= $id.') '.DOKU_LF; + + // get any other footnotes that use the same markup + $alt = array_keys($this->footnotes, "@@FNT$id"); + + if (count($alt)) { + foreach ($alt as $ref) { + // set anchor and backlink for the other footnotes + $this->doc .= ', '; + $this->doc .= ($ref+1).') '.DOKU_LF; + } + } + + // add footnote markup and close this footnote + $this->doc .= $footnote; + $this->doc .= '
        ' . DOKU_LF; + } + } + $this->doc .= '
        '.DOKU_LF; + } + + // prepend the TOC + if($this->info['toc']){ + $this->doc = $this->render_TOC().$this->doc; + } + + // make sure there are no empty paragraphs + $this->doc = preg_replace('#

        \s*

        #','',$this->doc); + } + + /** + * Return the TOC rendered to XHTML + * + * @author Andreas Gohr + */ + function render_TOC(){ + if(count($this->toc) < 3) return ''; + global $lang; + $out = '
        '.DOKU_LF; + $out .= '
        '; + $out .= $lang['toc']; + $out .= '
        '.DOKU_LF; + $out .= '
        '.DOKU_LF; + $out .= html_buildlist($this->toc,'toc',array($this,'_tocitem')); + $out .= '
        '.DOKU_LF.'
        '.DOKU_LF; + return $out; + } + + /** + * Callback for html_buildlist + */ + function _tocitem($item){ + return ''. + $this->_xmlEntities($item['title']).''; + } + + function header($text, $level, $pos) { + global $conf; + + // create a unique header id + $hid = $this->_headerToLink($text,'true'); + + //handle TOC + if($level >= $conf['toptoclevel'] && $level <= $conf['maxtoclevel']){ + // the TOC is one of our standard ul list arrays ;-) + $this->toc[] = array( 'hid' => $hid, + 'title' => $text, + 'type' => 'ul', + 'level' => $level-$conf['toptoclevel']+1); + } + + // write the header + $this->doc .= DOKU_LF.''.$this->_xmlEntities($text)."".DOKU_LF; + } + + /** + * Section edit marker is replaced by an edit button when + * the page is editable. Replacement done in 'inc/html.php#html_secedit' + * + * @author Andreas Gohr + * @author Ben Coburn + */ + function section_edit($start, $end, $level, $name) { + global $conf; + + if ($start!=-1 && $level<=$conf['maxseclevel']) { + $name = str_replace('"', '', $name); + $this->doc .= ''; + } + } + + function section_open($level) { + $this->doc .= "
        ".DOKU_LF; + } + + function section_close() { + $this->doc .= DOKU_LF.'
        '.DOKU_LF; + } + + function cdata($text) { + $this->doc .= $this->_xmlEntities($text); + } + + function p_open() { + $this->doc .= DOKU_LF.'

        '.DOKU_LF; + } + + function p_close() { + $this->doc .= DOKU_LF.'

        '.DOKU_LF; + } + + function linebreak() { + $this->doc .= '
        '.DOKU_LF; + } + + function hr() { + $this->doc .= '
        '.DOKU_LF; + } + + function strong_open() { + $this->doc .= ''; + } + + function strong_close() { + $this->doc .= ''; + } + + function emphasis_open() { + $this->doc .= ''; + } + + function emphasis_close() { + $this->doc .= ''; + } + + function underline_open() { + $this->doc .= ''; + } + + function underline_close() { + $this->doc .= ''; + } + + function monospace_open() { + $this->doc .= ''; + } + + function monospace_close() { + $this->doc .= ''; + } + + function subscript_open() { + $this->doc .= ''; + } + + function subscript_close() { + $this->doc .= ''; + } + + function superscript_open() { + $this->doc .= ''; + } + + function superscript_close() { + $this->doc .= ''; + } + + function deleted_open() { + $this->doc .= ''; + } + + function deleted_close() { + $this->doc .= ''; + } + + /** + * Callback for footnote start syntax + * + * All following content will go to the footnote instead of + * the document. To achieve this the previous rendered content + * is moved to $store and $doc is cleared + * + * @author Andreas Gohr + */ + function footnote_open() { + + // move current content to store and record footnote + $this->store = $this->doc; + $this->doc = ''; + } + + /** + * Callback for footnote end syntax + * + * All rendered content is moved to the $footnotes array and the old + * content is restored from $store again + * + * @author Andreas Gohr + */ + function footnote_close() { + + // recover footnote into the stack and restore old content + $footnote = $this->doc; + $this->doc = $this->store; + $this->store = ''; + + // check to see if this footnote has been seen before + $i = array_search($footnote, $this->footnotes); + + if ($i === false) { + // its a new footnote, add it to the $footnotes array + $id = count($this->footnotes)+1; + $this->footnotes[count($this->footnotes)] = $footnote; + } else { + // seen this one before, translate the index to an id and save a placeholder + $i++; + $id = count($this->footnotes)+1; + $this->footnotes[count($this->footnotes)] = "@@FNT".($i); + } + + // output the footnote reference and link, incl. onmouseover for insitu footnote popup + $this->doc .= ''.$id.')'; + } + + function listu_open() { + $this->doc .= '
          '.DOKU_LF; + } + + function listu_close() { + $this->doc .= '
        '.DOKU_LF; + } + + function listo_open() { + $this->doc .= '
          '.DOKU_LF; + } + + function listo_close() { + $this->doc .= '
        '.DOKU_LF; + } + + function listitem_open($level) { + $this->doc .= '
      9. '; + } + + function listitem_close() { + $this->doc .= '
      10. '.DOKU_LF; + } + + function listcontent_open() { + $this->doc .= '
        '; + } + + function listcontent_close() { + $this->doc .= '
        '.DOKU_LF; + } + + function unformatted($text) { + $this->doc .= $this->_xmlEntities($text); + } + + /** + * Execute PHP code if allowed + * + * @author Andreas Gohr + */ + function php($text) { + global $conf; + if($conf['phpok']){ + ob_start(); + eval($text); + $this->doc .= ob_get_contents(); + ob_end_clean(); + }else{ + $this->file($text); + } + } + + /** + * Insert HTML if allowed + * + * @author Andreas Gohr + */ + function html($text) { + global $conf; + if($conf['htmlok']){ + $this->doc .= $text; + }else{ + $this->file($text); + } + } + + function preformatted($text) { + $this->doc .= '
        ' . $this->_xmlEntities($text) . '
        '. DOKU_LF; + } + + function file($text) { + $this->doc .= '
        ' . $this->_xmlEntities($text). '
        '. DOKU_LF; + } + + function quote_open() { + $this->doc .= '
        '.DOKU_LF; + } + + function quote_close() { + $this->doc .= '
        '.DOKU_LF; + } + + /** + * Callback for code text + * + * Uses GeSHi to highlight language syntax + * + * @author Andreas Gohr + */ + function code($text, $language = NULL) { + global $conf; + + if ( is_null($language) ) { + $this->preformatted($text); + } else { + //strip leading and trailing blank line + $text = preg_replace('/^\s*?\n/','',$text); + $text = preg_replace('/\s*?\n$/','',$text); + $this->doc .= p_xhtml_cached_geshi($text, $language); + } + } + + function geshi_cached($text = '') { + $this->doc .= $text; + } + + function acronym($acronym) { + + if ( array_key_exists($acronym, $this->acronyms) ) { + + $title = $this->_xmlEntities($this->acronyms[$acronym]); + + $this->doc .= ''.$this->_xmlEntities($acronym).''; + + } else { + $this->doc .= $this->_xmlEntities($acronym); + } + } + + function smiley($smiley) { + if ( array_key_exists($smiley, $this->smileys) ) { + $title = $this->_xmlEntities($this->smileys[$smiley]); + $this->doc .= ''.
+                    $this->_xmlEntities($smiley).''; + } else { + $this->doc .= $this->_xmlEntities($smiley); + } + } + + /* + * not used + function wordblock($word) { + if ( array_key_exists($word, $this->badwords) ) { + $this->doc .= '** BLEEP **'; + } else { + $this->doc .= $this->_xmlEntities($word); + } + } + */ + + function entity($entity) { + if ( array_key_exists($entity, $this->entities) ) { + $this->doc .= $this->entities[$entity]; + } else { + $this->doc .= $this->_xmlEntities($entity); + } + } + + function multiplyentity($x, $y) { + $this->doc .= "$x×$y"; + } + + function singlequoteopening() { + $this->doc .= "‘"; + } + + function singlequoteclosing() { + $this->doc .= "’"; + } + + function doublequoteopening() { + $this->doc .= "“"; + } + + function doublequoteclosing() { + $this->doc .= "”"; + } + + /** + */ + function camelcaselink($link) { + $this->internallink($link,$link); + } + + + function locallink($hash, $name = NULL){ + global $ID; + $name = $this->_getLinkTitle($name, $hash, $isImage); + $hash = $this->_headerToLink($hash); + $title = $ID.' ↵'; + $this->doc .= ''; + $this->doc .= $name; + $this->doc .= ''; + } + + /** + * Render an internal Wiki Link + * + * $search and $returnonly are not for the renderer but are used + * elsewhere - no need to implement them in other renderers + * + * @author Andreas Gohr + */ + function internallink($id, $name = NULL, $search=NULL,$returnonly=false) { + global $conf; + global $ID; + // default name is based on $id as given + $default = $this->_simpleTitle($id); + // now first resolve and clean up the $id + resolve_pageid(getNS($ID),$id,$exists); + $name = $this->_getLinkTitle($name, $default, $isImage, $id); + if ( !$isImage ) { + if ( $exists ) { + $class='wikilink1'; + } else { + $class='wikilink2'; + } + } else { + $class='media'; + } + + //keep hash anchor + list($id,$hash) = explode('#',$id,2); + + //prepare for formating + $link['target'] = $conf['target']['wiki']; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + // highlight link to current page + if ($id == $ID) { + $link['pre'] = ''; + $link['suf'] = ''; + } + $link['more'] = ''; + $link['class'] = $class; + $link['url'] = wl($id); + $link['name'] = $name; + $link['title'] = $id; + //add search string + if($search){ + ($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&s='; + $link['url'] .= rawurlencode($search); + } + + //keep hash + if($hash) $link['url'].='#'.$hash; + + //output formatted + if($returnonly){ + return $this->_formatLink($link); + }else{ + $this->doc .= $this->_formatLink($link); + } + } + + function externallink($url, $name = NULL) { + global $conf; + + $name = $this->_getLinkTitle($name, $url, $isImage); + + // add protocol on simple short URLs + if(substr($url,0,3) == 'ftp' && (substr($url,0,6) != 'ftp://')) $url = 'ftp://'.$url; + if(substr($url,0,3) == 'www') $url = 'http://'.$url; + + if ( !$isImage ) { + $class='urlextern'; + } else { + $class='media'; + } + + //prepare for formating + $link['target'] = $conf['target']['extern']; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['class'] = $class; + $link['url'] = $url; + + $link['name'] = $name; + $link['title'] = $this->_xmlEntities($url); + if($conf['relnofollow']) $link['more'] .= ' rel="nofollow"'; + + //output formatted + $this->doc .= $this->_formatLink($link); + } + + /** + */ + function interwikilink($match, $name = NULL, $wikiName, $wikiUri) { + global $conf; + + $link = array(); + $link['target'] = $conf['target']['interwiki']; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['name'] = $this->_getLinkTitle($name, $wikiUri, $isImage); + + //get interwiki URL + if ( isset($this->interwiki[$wikiName]) ) { + $url = $this->interwiki[$wikiName]; + } else { + // Default to Google I'm feeling lucky + $url = 'http://www.google.com/search?q={URL}&btnI=lucky'; + $wikiName = 'go'; + } + + if ( !$isImage ) { + $class = preg_replace('/[^_\-a-z0-9]+/i','_',$wikiName); + $link['class'] = "interwiki iw_$class"; + } else { + $link['class'] = 'media'; + } + + //do we stay at the same server? Use local target + if( strpos($url,DOKU_URL) === 0 ){ + $link['target'] = $conf['target']['wiki']; + } + + //split into hash and url part + list($wikiUri,$hash) = explode('#',$wikiUri,2); + + //replace placeholder + if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#',$url)){ + //use placeholders + $url = str_replace('{URL}',rawurlencode($wikiUri),$url); + $url = str_replace('{NAME}',$wikiUri,$url); + $parsed = parse_url($wikiUri); + if(!$parsed['port']) $parsed['port'] = 80; + $url = str_replace('{SCHEME}',$parsed['scheme'],$url); + $url = str_replace('{HOST}',$parsed['host'],$url); + $url = str_replace('{PORT}',$parsed['port'],$url); + $url = str_replace('{PATH}',$parsed['path'],$url); + $url = str_replace('{QUERY}',$parsed['query'],$url); + $link['url'] = $url; + }else{ + //default + $link['url'] = $url.rawurlencode($wikiUri); + } + if($hash) $link['url'] .= '#'.rawurlencode($hash); + + $link['title'] = htmlspecialchars($link['url']); + + //output formatted + $this->doc .= $this->_formatLink($link); + } + + /** + */ + function windowssharelink($url, $name = NULL) { + global $conf; + global $lang; + //simple setup + $link['target'] = $conf['target']['windows']; + $link['pre'] = ''; + $link['suf'] = ''; + $link['style'] = ''; + //Display error on browsers other than IE + $link['more'] = 'onclick="if(document.all == null){alert(\''. + $this->_xmlEntities($lang['nosmblinks'],ENT_QUOTES). + '\');}" onkeypress="if(document.all == null){alert(\''. + $this->_xmlEntities($lang['nosmblinks'],ENT_QUOTES).'\');}"'; + + $link['name'] = $this->_getLinkTitle($name, $url, $isImage); + if ( !$isImage ) { + $link['class'] = 'windows'; + } else { + $link['class'] = 'media'; + } + + + $link['title'] = $this->_xmlEntities($url); + $url = str_replace('\\','/',$url); + $url = 'file:///'.$url; + $link['url'] = $url; + + //output formatted + $this->doc .= $this->_formatLink($link); + } + + function emaillink($address, $name = NULL) { + global $conf; + //simple setup + $link = array(); + $link['target'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['style'] = ''; + $link['more'] = ''; + + $name = $this->_getLinkTitle($name, $address, $isImage); + if ( !$isImage ) { + $link['class']='mail JSnocheck'; + } else { + $link['class']='media JSnocheck'; + } + + $address = $this->_xmlEntities($address); + $address = obfuscate($address); + $title = $address; + + if(empty($name)){ + $name = $address; + } +#elseif($isImage{ +# $name = $this->_xmlEntities($name); +# } + + if($conf['mailguard'] == 'visible') $address = rawurlencode($address); + + $link['url'] = 'mailto:'.$address; + $link['name'] = $name; + $link['title'] = $title; + + //output formatted + $this->doc .= $this->_formatLink($link); + } + + function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, + $height=NULL, $cache=NULL, $linking=NULL) { + global $conf; + global $ID; + resolve_mediaid(getNS($ID),$src, $exists); + + $link = array(); + $link['class'] = 'media'; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['target'] = $conf['target']['media']; + $noLink = false; + + $link['title'] = $this->_xmlEntities($src); + list($ext,$mime) = mimetype($src); + if(substr($mime,0,5) == 'image'){ + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),($linking=='direct')); + }elseif($mime == 'application/x-shockwave-flash'){ + // don't link flash movies + $noLink = TRUE; + }else{ + // add file icons + $class = preg_replace('/[^_\-a-z0-9]+/i','_',$ext); + $link['class'] .= ' mediafile mf_'.$class; + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),true); + } + $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); + + //output formatted + if ($linking == 'nolink' || $noLink) $this->doc .= $link['name']; + else $this->doc .= $this->_formatLink($link); + } + + /** + * @todo don't add link for flash + */ + function externalmedia ($src, $title=NULL, $align=NULL, $width=NULL, + $height=NULL, $cache=NULL, $linking=NULL) { + global $conf; + + $link = array(); + $link['class'] = 'media'; + $link['style'] = ''; + $link['pre'] = ''; + $link['suf'] = ''; + $link['more'] = ''; + $link['target'] = $conf['target']['media']; + + $link['title'] = $this->_xmlEntities($src); + $link['url'] = ml($src,array('cache'=>$cache)); + $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); + $noLink = false; + + list($ext,$mime) = mimetype($src); + if(substr($mime,0,5) == 'image'){ + // link only jpeg images + // if ($ext != 'jpg' && $ext != 'jpeg') $noLink = TRUE; + }elseif($mime == 'application/x-shockwave-flash'){ + // don't link flash movies + $noLink = TRUE; + }else{ + // add file icons + $link['class'] .= ' mediafile mf_'.$ext; + } + + //output formatted + if ($linking == 'nolink' || $noLink) $this->doc .= $link['name']; + else $this->doc .= $this->_formatLink($link); + } + + /** + * Renders an RSS feed + * + * @author Andreas Gohr + */ + function rss ($url,$params){ + global $lang; + global $conf; + + require_once(DOKU_INC.'inc/FeedParser.php'); + $feed = new FeedParser(); + $feed->feed_url($url); + + //disable warning while fetching + if (!defined('DOKU_E_LEVEL')) { $elvl = error_reporting(E_ERROR); } + $rc = $feed->init(); + if (!defined('DOKU_E_LEVEL')) { error_reporting($elvl); } + + //decide on start and end + if($params['reverse']){ + $mod = -1; + $start = $feed->get_item_quantity()-1; + $end = $start - ($params['max']); + $end = ($end < -1) ? -1 : $end; + }else{ + $mod = 1; + $start = 0; + $end = $feed->get_item_quantity(); + $end = ($end > $params['max']) ? $params['max'] : $end;; + } + + $this->doc .= '
          '; + if($rc){ + for ($x = $start; $x != $end; $x += $mod) { + $item = $feed->get_item($x); + $this->doc .= '
        • '; + $this->externallink($item->get_permalink(), + $item->get_title()); + if($params['author']){ + $author = $item->get_author(0); + if($author){ + $name = $author->get_name(); + if(!$name) $name = $author->get_email(); + if($name) $this->doc .= ' '.$lang['by'].' '.$name; + } + } + if($params['date']){ + $this->doc .= ' ('.$item->get_date($conf['dformat']).')'; + } + if($params['details']){ + $this->doc .= '
          '; + if($htmlok){ + $this->doc .= $item->get_description(); + }else{ + $this->doc .= strip_tags($item->get_description()); + } + $this->doc .= '
          '; + } + + $this->doc .= '
        • '; + } + }else{ + $this->doc .= '
        • '; + $this->doc .= ''.$lang['rssfailed'].''; + $this->externallink($url); + $this->doc .= '
        • '; + } + $this->doc .= '
        '; + } + + // $numrows not yet implemented + function table_open($maxcols = NULL, $numrows = NULL){ + $this->doc .= ''.DOKU_LF; + } + + function table_close(){ + $this->doc .= '
        '.DOKU_LF; + } + + function tablerow_open(){ + $this->doc .= DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB; + } + + function tablerow_close(){ + $this->doc .= DOKU_LF . DOKU_TAB . '' . DOKU_LF; + } + + function tableheader_open($colspan = 1, $align = NULL){ + $this->doc .= 'doc .= ' class="'.$align.'align"'; + } + if ( $colspan > 1 ) { + $this->doc .= ' colspan="'.$colspan.'"'; + } + $this->doc .= '>'; + } + + function tableheader_close(){ + $this->doc .= ''; + } + + function tablecell_open($colspan = 1, $align = NULL){ + $this->doc .= 'doc .= ' class="'.$align.'align"'; + } + if ( $colspan > 1 ) { + $this->doc .= ' colspan="'.$colspan.'"'; + } + $this->doc .= '>'; + } + + function tablecell_close(){ + $this->doc .= ''; + } + + //---------------------------------------------------------- + // Utils + + /** + * Build a link + * + * Assembles all parts defined in $link returns HTML for the link + * + * @author Andreas Gohr + */ + function _formatLink($link){ + //make sure the url is XHTML compliant (skip mailto) + if(substr($link['url'],0,7) != 'mailto:'){ + $link['url'] = str_replace('&','&',$link['url']); + $link['url'] = str_replace('&amp;','&',$link['url']); + } + //remove double encodings in titles + $link['title'] = str_replace('&amp;','&',$link['title']); + + // be sure there are no bad chars in url or title + // (we can't do this for name because it can contain an img tag) + $link['url'] = strtr($link['url'],array('>'=>'%3E','<'=>'%3C','"'=>'%22')); + $link['title'] = strtr($link['title'],array('>'=>'>','<'=>'<','"'=>'"')); + + $ret = ''; + $ret .= $link['pre']; + $ret .= ' + */ + function _simpleTitle($name){ + global $conf; + + //if there is a hash we use the ancor name only + list($name,$hash) = explode('#',$name,2); + if($hash) return $hash; + + //trim colons of a namespace link + $name = rtrim($name,':'); + + if($conf['useslash']){ + $nssep = '[:;/]'; + }else{ + $nssep = '[:;]'; + } + $name = preg_replace('!.*'.$nssep.'!','',$name); + + if(!$name) return $this->_simpleTitle($conf['start']); + return $name; + } + + /** + * Renders internal and external media + * + * @author Andreas Gohr + */ + function _media ($src, $title=NULL, $align=NULL, $width=NULL, + $height=NULL, $cache=NULL) { + + $ret = ''; + + list($ext,$mime) = mimetype($src); + if(substr($mime,0,5) == 'image'){ + //add image tag + $ret .= '_xmlEntities($title).'"'; + $ret .= ' alt="'.$this->_xmlEntities($title).'"'; + }elseif($ext == 'jpg' || $ext == 'jpeg'){ + //try to use the caption from IPTC/EXIF + require_once(DOKU_INC.'inc/JpegMeta.php'); + $jpeg = new JpegMeta(mediaFN($src)); + if($jpeg !== false) $cap = $jpeg->getTitle(); + if($cap){ + $ret .= ' title="'.$this->_xmlEntities($cap).'"'; + $ret .= ' alt="'.$this->_xmlEntities($cap).'"'; + } + }else{ + $ret .= ' alt=""'; + } + + if ( !is_null($width) ) + $ret .= ' width="'.$this->_xmlEntities($width).'"'; + + if ( !is_null($height) ) + $ret .= ' height="'.$this->_xmlEntities($height).'"'; + + $ret .= ' />'; + + }elseif($mime == 'application/x-shockwave-flash'){ + $ret .= '_xmlEntities($width).'"'; + if ( !is_null($height) ) $ret .= ' height="'.$this->_xmlEntities($height).'"'; + $ret .= '>'.DOKU_LF; + $ret .= ''.DOKU_LF; + $ret .= ''.DOKU_LF; + $ret .= '_xmlEntities($width).'"'; + if ( !is_null($height) ) $ret .= ' height="'.$this->_xmlEntities($height).'"'; + $ret .= ' type="application/x-shockwave-flash"'. + ' pluginspage="http://www.macromedia.com/go/getflashplayer">'.DOKU_LF; + $ret .= ''.DOKU_LF; + + }elseif(!is_null($title)){ + // well at least we have a title to display + $ret .= $this->_xmlEntities($title); + }else{ + // just show the sourcename + $ret .= $this->_xmlEntities(noNS($src)); + } + + return $ret; + } + + function _xmlEntities($string) { + return htmlspecialchars($string); + } + + /** + * Creates a linkid from a headline + * + * @param string $title The headline title + * @param boolean $create Create a new unique ID? + * @author Andreas Gohr + */ + function _headerToLink($title,$create=false) { + $title = str_replace(':','',cleanID($title)); + $title = ltrim($title,'0123456789._-'); + if(empty($title)) $title='section'; + + if($create){ + // make sure tiles are unique + $num = ''; + while(in_array($title.$num,$this->headers)){ + ($num) ? $num++ : $num = 1; + } + $title = $title.$num; + $this->headers[] = $title; + } + + return $title; + } + + /** + * Construct a title and handle images in titles + * + * @author Harry Fuecks + */ + function _getLinkTitle($title, $default, & $isImage, $id=NULL) { + global $conf; + + $isImage = FALSE; + if ( is_null($title) ) { + if ($conf['useheading'] && $id) { + $heading = p_get_first_heading($id); + if ($heading) { + return $this->_xmlEntities($heading); + } + } + return $this->_xmlEntities($default); + } else if ( is_string($title) ) { + return $this->_xmlEntities($title); + } else if ( is_array($title) ) { + $isImage = TRUE; + return $this->_imageTitle($title); + } + } + + /** + * Returns an HTML code for images used in link titles + * + * @todo Resolve namespace on internal images + * @author Andreas Gohr + */ + function _imageTitle($img) { + return $this->_media($img['src'], + $img['title'], + $img['align'], + $img['width'], + $img['height'], + $img['cache']); + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/parserutils.php b/plugins/dokuwiki/inc/parserutils.php new file mode 100644 index 0000000..41fa1c3 --- /dev/null +++ b/plugins/dokuwiki/inc/parserutils.php @@ -0,0 +1,524 @@ + + * @author Andreas Gohr + */ + + if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); + + require_once(DOKU_INC.'inc/confutils.php'); + require_once(DOKU_INC.'inc/pageutils.php'); + require_once(DOKU_INC.'inc/pluginutils.php'); + require_once(DOKU_INC.'inc/cache.php'); + +/** + * Returns the parsed Wikitext in XHTML for the given id and revision. + * + * If $excuse is true an explanation is returned if the file + * wasn't found + * + * @author Andreas Gohr + */ +function p_wiki_xhtml($id, $rev='', $excuse=true){ + $file = wikiFN($id,$rev); + $ret = ''; + + //ensure $id is in global $ID (needed for parsing) + global $ID; + $keep = $ID; + $ID = $id; + + if($rev){ + if(@file_exists($file)){ + $ret = p_render('xhtml',p_get_instructions(io_readfile($file)),$info); //no caching on old revisions + }elseif($excuse){ + $ret = p_locale_xhtml('norev'); + } + }else{ + if(@file_exists($file)){ + $ret = p_cached_output($file,'xhtml',$id); + }elseif($excuse){ + $ret = p_locale_xhtml('newpage'); + } + } + + //restore ID (just in case) + $ID = $keep; + + return $ret; +} + +/** + * Returns starting summary for a page (e.g. the first few + * paragraphs), marked up in XHTML. + * + * If $excuse is true an explanation is returned if the file + * wasn't found + * + * @param string wiki page id + * @param reference populated with page title from heading or page id + * @deprecated + * @author Harry Fuecks + */ +function p_wiki_xhtml_summary($id, &$title, $rev='', $excuse=true){ + $file = wikiFN($id,$rev); + $ret = ''; + + //ensure $id is in global $ID (needed for parsing) + global $ID; + $keep = $ID; + $ID = $id; + + if($rev){ + if(@file_exists($file)){ + //no caching on old revisions + $ins = p_get_instructions(io_readfile($file)); + }elseif($excuse){ + $ret = p_locale_xhtml('norev'); + //restore ID (just in case) + $ID = $keep; + return $ret; + } + + }else{ + + if(@file_exists($file)){ + // The XHTML for a summary is not cached so use the instruction cache + $ins = p_cached_instructions($file); + }elseif($excuse){ + $ret = p_locale_xhtml('newpage'); + //restore ID (just in case) + $ID = $keep; + return $ret; + } + } + + $ret = p_render('xhtmlsummary',$ins,$info); + + if ( $info['sum_pagetitle'] ) { + $title = $info['sum_pagetitle']; + } else { + $title = $id; + } + + $ID = $keep; + return $ret; +} + +/** + * Returns the specified local text in parsed format + * + * @author Andreas Gohr + */ +function p_locale_xhtml($id){ + //fetch parsed locale + $html = p_cached_output(localeFN($id)); + return $html; +} + +/** + * *** DEPRECATED *** + * + * use p_cached_output() + * + * Returns the given file parsed to XHTML + * + * Uses and creates a cachefile + * + * @deprecated + * @author Andreas Gohr + * @todo rewrite to use mode instead of hardcoded XHTML + */ +function p_cached_xhtml($file){ + return p_cached_output($file); +} + +/** + * Returns the given file parsed into the requested output format + * + * @author Andreas Gohr + * @author Chris Smith + */ +function p_cached_output($file, $format='xhtml', $id='') { + global $conf; + + $cache = new cache_renderer($id, $file, $format); + if ($cache->useCache()) { + $parsed = $cache->retrieveCache(); + if($conf['allowdebug']) $parsed .= "\n\n"; + } else { + $parsed = p_render($format, p_cached_instructions($file,false,$id), $info); + + if ($info['cache']) { + $cache->storeCache($parsed); //save cachefile + if($conf['allowdebug']) $parsed .= "\n\n"; + }else{ + $cache->removeCache(); //try to delete cachefile + if($conf['allowdebug']) $parsed .= "\n\n"; + } + } + + return $parsed; +} + +/** + * Returns the render instructions for a file + * + * Uses and creates a serialized cache file + * + * @author Andreas Gohr + */ +function p_cached_instructions($file,$cacheonly=false,$id='') { + global $conf; + + $cache = new cache_instructions($id, $file); + + if ($cacheonly || $cache->useCache()) { + return $cache->retrieveCache(); + } else if (@file_exists($file)) { + // no cache - do some work + $ins = p_get_instructions(io_readfile($file)); + $cache->storeCache($ins); + return $ins; + } + + return NULL; +} + +/** + * turns a page into a list of instructions + * + * @author Harry Fuecks + * @author Andreas Gohr + */ +function p_get_instructions($text){ + + $modes = p_get_parsermodes(); + + // Create the parser + $Parser = new Doku_Parser(); + + // Add the Handler + $Parser->Handler = new Doku_Handler(); + + //add modes to parser + foreach($modes as $mode){ + $Parser->addMode($mode['mode'],$mode['obj']); + } + + // Do the parsing + trigger_event('PARSER_WIKITEXT_PREPROCESS', $text); + $p = $Parser->parse($text); +// dbg($p); + return $p; +} + +/** + * returns the metadata of a page + * + * @author Esther Brunner + */ +function p_get_metadata($id, $key=false, $render=false){ + global $INFO; + + if ($id == $INFO['id'] && !empty($INFO['meta'])) { + $meta = $INFO['meta']; + } else { + $file = metaFN($id, '.meta'); + + if (@file_exists($file)) $meta = unserialize(io_readFile($file, false)); + else $meta = array(); + + // metadata has never been rendered before - do it! + if ($render && !$meta['description']['abstract']){ + $meta = p_render_metadata($id, $meta); + io_saveFile($file, serialize($meta)); + } + } + + // filter by $key + if ($key){ + list($key, $subkey) = explode(' ', $key, 2); + if (trim($subkey)) return $meta[$key][$subkey]; + else return $meta[$key]; + } + + return $meta; +} + +/** + * sets metadata elements of a page + * + * @author Esther Brunner + */ +function p_set_metadata($id, $data, $render=false){ + if (!is_array($data)) return false; + + $orig = p_get_metadata($id); + + // render metadata first? + if ($render) $meta = p_render_metadata($id, $orig); + else $meta = $orig; + + // now add the passed metadata + $protected = array('description', 'date', 'contributor'); + foreach ($data as $key => $value){ + + // be careful with sub-arrays of $meta['relation'] + if ($key == 'relation'){ + foreach ($value as $subkey => $subvalue){ + $meta[$key][$subkey] = array_merge($meta[$key][$subkey], $subvalue); + } + + // be careful with some senisitive arrays of $meta + } elseif (in_array($key, $protected)){ + if (is_array($value)){ + #FIXME not sure if this is the intended thing: + if(!is_array($meta[$key])) $meta[$key] = array($meta[$key]); + $meta[$key] = array_merge($meta[$key], $value); + } + + // no special treatment for the rest + } else { + $meta[$key] = $value; + } + } + + // save only if metadata changed + if ($meta == $orig) return true; + + // check if current page metadata has been altered - if so sync the changes + global $INFO; + if ($id == $INFO['id'] && isset($INFO['meta'])) { + $INFO['meta'] = $meta; + } + + return io_saveFile(metaFN($id, '.meta'), serialize($meta)); +} + +/** + * renders the metadata of a page + * + * @author Esther Brunner + */ +function p_render_metadata($id, $orig){ + require_once DOKU_INC."inc/parser/metadata.php"; + + // get instructions + $instructions = p_cached_instructions(wikiFN($id),false,$id); + + // set up the renderer + $renderer = new Doku_Renderer_metadata(); + $renderer->meta = $orig; + + // loop through the instructions + foreach ($instructions as $instruction){ + // execute the callback against the renderer + call_user_func_array(array(&$renderer, $instruction[0]), $instruction[1]); + } + + return $renderer->meta; +} + +/** + * returns all available parser syntax modes in correct order + * + * @author Andreas Gohr + */ +function p_get_parsermodes(){ + global $conf; + + //reuse old data + static $modes = null; + if($modes != null){ + return $modes; + } + + //import parser classes and mode definitions + require_once DOKU_INC . 'inc/parser/parser.php'; + + // we now collect all syntax modes and their objects, then they will + // be sorted and added to the parser in correct order + $modes = array(); + + // add syntax plugins + $pluginlist = plugin_list('syntax'); + if(count($pluginlist)){ + global $PARSER_MODES; + $obj = null; + foreach($pluginlist as $p){ + if(!$obj =& plugin_load('syntax',$p)) continue; //attempt to load plugin into $obj + $PARSER_MODES[$obj->getType()][] = "plugin_$p"; //register mode type + //add to modes + $modes[] = array( + 'sort' => $obj->getSort(), + 'mode' => "plugin_$p", + 'obj' => $obj, + ); + unset($obj); //remove the reference + } + } + + // add default modes + $std_modes = array('listblock','preformatted','notoc','nocache', + 'header','table','linebreak','footnote','hr', + 'unformatted','php','html','code','file','quote', + 'internallink','rss','media','externallink', + 'emaillink','windowssharelink','eol'); + if($conf['typography']){ + $std_modes[] = 'quotes'; + $std_modes[] = 'multiplyentity'; + } + foreach($std_modes as $m){ + $class = "Doku_Parser_Mode_$m"; + $obj = new $class(); + $modes[] = array( + 'sort' => $obj->getSort(), + 'mode' => $m, + 'obj' => $obj + ); + } + + // add formatting modes + $fmt_modes = array('strong','emphasis','underline','monospace', + 'subscript','superscript','deleted'); + foreach($fmt_modes as $m){ + $obj = new Doku_Parser_Mode_formatting($m); + $modes[] = array( + 'sort' => $obj->getSort(), + 'mode' => $m, + 'obj' => $obj + ); + } + + // add modes which need files + $obj = new Doku_Parser_Mode_smiley(array_keys(getSmileys())); + $modes[] = array('sort' => $obj->getSort(), 'mode' => 'smiley','obj' => $obj ); + $obj = new Doku_Parser_Mode_acronym(array_keys(getAcronyms())); + $modes[] = array('sort' => $obj->getSort(), 'mode' => 'acronym','obj' => $obj ); + $obj = new Doku_Parser_Mode_entity(array_keys(getEntities())); + $modes[] = array('sort' => $obj->getSort(), 'mode' => 'entity','obj' => $obj ); + + + // add optional camelcase mode + if($conf['camelcase']){ + $obj = new Doku_Parser_Mode_camelcaselink(); + $modes[] = array('sort' => $obj->getSort(), 'mode' => 'camelcaselink','obj' => $obj ); + } + + //sort modes + usort($modes,'p_sort_modes'); + + return $modes; +} + +/** + * Callback function for usort + * + * @author Andreas Gohr + */ +function p_sort_modes($a, $b){ + if($a['sort'] == $b['sort']) return 0; + return ($a['sort'] < $b['sort']) ? -1 : 1; +} + +/** + * Renders a list of instruction to the specified output mode + * + * In the $info array are informations from the renderer returned + * + * @author Harry Fuecks + * @author Andreas Gohr + */ +function p_render($mode,$instructions,& $info){ + if(is_null($instructions)) return ''; + + if ($mode=='wiki') { msg("Renderer for $mode not valid",-1); return null; } //FIXME!! remove this line when inc/parser/wiki.php works. + + // Create the renderer + if(!@file_exists(DOKU_INC."inc/parser/$mode.php")){ + msg("No renderer for $mode found",-1); + return null; + } + + require_once DOKU_INC."inc/parser/$mode.php"; + $rclass = "Doku_Renderer_$mode"; + if ( !class_exists($rclass) ) { + trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); + msg("Renderer for $mode not valid",-1); + return null; + } + $Renderer = new $rclass(); #FIXME any way to check for class existance? + + $Renderer->smileys = getSmileys(); + $Renderer->entities = getEntities(); + $Renderer->acronyms = getAcronyms(); + $Renderer->interwiki = getInterwiki(); + #$Renderer->badwords = getBadWords(); + + // Loop through the instructions + foreach ( $instructions as $instruction ) { + // Execute the callback against the Renderer + call_user_func_array(array(&$Renderer, $instruction[0]),$instruction[1]); + } + + //set info array + $info = $Renderer->info; + + // Post process and return the output + $data = array($mode,& $Renderer->doc); + trigger_event('RENDERER_CONTENT_POSTPROCESS',$data); + return $Renderer->doc; +} + +/** + * Gets the first heading from a file + * + * @author Andreas Gohr + */ +function p_get_first_heading($id){ + global $conf; + return $conf['useheading'] ? p_get_metadata($id,'title') : null; +} + +/** + * Wrapper for GeSHi Code Highlighter, provides caching of its output + * + * @author Christopher Smith + */ +function p_xhtml_cached_geshi($code, $language) { + $cache = getCacheName($language.$code,".code"); + + if (@file_exists($cache) && !$_REQUEST['purge'] && + (filemtime($cache) > filemtime(DOKU_INC . 'inc/geshi.php'))) { + + $highlighted_code = io_readFile($cache, false); + @touch($cache); + + } else { + + require_once(DOKU_INC . 'inc/geshi.php'); + + $geshi = new GeSHi($code, strtolower($language), DOKU_INC . 'inc/geshi'); + $geshi->set_encoding('utf-8'); + $geshi->enable_classes(); + $geshi->set_header_type(GESHI_HEADER_PRE); + + #$geshi->set_overall_class("code $language"); + # geshi 1.0.8.* now adds the language first + $geshi->set_overall_class("code"); + + $geshi->set_link_target($conf['target']['extern']); + + $highlighted_code = $geshi->parse_code(); + + io_saveFile($cache,$highlighted_code); + } + + return $highlighted_code; +} + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/plugins/dokuwiki/inc/pluginutils.php b/plugins/dokuwiki/inc/pluginutils.php new file mode 100644 index 0000000..183e222 --- /dev/null +++ b/plugins/dokuwiki/inc/pluginutils.php @@ -0,0 +1,95 @@ + + */ + +// plugin related constants +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +$plugin_types = array('admin','syntax','action'); + +/** + * Returns a list of available plugins of given type + * + * @param $type string, plugin_type name; + * the type of plugin to return, + * use empty string for all types + * @param $all bool; + * false to only return enabled plugins, + * true to return both enabled and disabled plugins + * + * @return array of plugin names + * + * @author Andreas Gohr + */ +function plugin_list($type='',$all=false){ + $plugins = array(); + if ($dh = opendir(DOKU_PLUGIN)) { + while (false !== ($plugin = readdir($dh))) { + if ($plugin == '.' || $plugin == '..' || $plugin == 'tmp') continue; + if (is_file(DOKU_PLUGIN.$plugin)) continue; + + // if required, skip disabled plugins + if (!$all && plugin_isdisabled($plugin)) continue; + + if ($type=='' || @file_exists(DOKU_PLUGIN."$plugin/$type.php")){ + $plugins[] = $plugin; + } else { + if ($dp = @opendir(DOKU_PLUGIN."$plugin/$type/")) { + while (false !== ($component = readdir($dp))) { + if ($component == '.' || $component == '..' || strtolower(substr($component, -4)) != ".php") continue; + if (is_file(DOKU_PLUGIN."$plugin/$type/$component")) { + $plugins[] = $plugin.'_'.substr($component, 0, -4); + } + } + closedir($dp); + } + } + } + closedir($dh); + } + return $plugins; +} + +/** + * Loads the given plugin and creates an object of it + * + * @author Andreas Gohr + * + * @param $type string type of plugin to load + * @param $name string name of the plugin to load + * @return objectreference the plugin object or null on failure + */ +function &plugin_load($type,$name){ + //we keep all loaded plugins available in global scope for reuse + global $DOKU_PLUGINS; + + + //plugin already loaded? + if(!empty($DOKU_PLUGINS[$type][$name])){ + return $DOKU_PLUGINS[$type][$name]; + } + + //try to load the wanted plugin file + if (@file_exists(DOKU_PLUGIN."$name/$type.php")){ + include_once(DOKU_PLUGIN."$name/$type.php"); + }else{ + list($plugin, $component) = preg_split("/_/",$name, 2); + if (!$component || !include_once(DOKU_PLUGIN."$plugin/$type/$component.php")) { + return null; + } + } + + //construct class and instantiate + $class = $type.'_plugin_'.$name; + if (!class_exists($class)) return null; + + $DOKU_PLUGINS[$type][$name] = new $class; + return $DOKU_PLUGINS[$type][$name]; +} + +function plugin_isdisabled($name) { return @file_exists(DOKU_PLUGIN.$name.'/disabled'); } +function plugin_enable($name) { return @unlink(DOKU_PLUGIN.$name.'/disabled'); } +function plugin_disable($name) { return @touch(DOKU_PLUGIN.$name.'/disabled'); } diff --git a/plugins/dokuwiki/inc/utf8.php b/plugins/dokuwiki/inc/utf8.php new file mode 100644 index 0000000..bdcf365 --- /dev/null +++ b/plugins/dokuwiki/inc/utf8.php @@ -0,0 +1,1276 @@ + + */ + +/** + * check for mb_string support + */ +if(!defined('UTF8_MBSTRING')){ + if(function_exists('mb_substr') && !defined('UTF8_NOMBSTRING')){ + define('UTF8_MBSTRING',1); + }else{ + define('UTF8_MBSTRING',0); + } +} + +if(UTF8_MBSTRING){ mb_internal_encoding('UTF-8'); } + + +/** + * URL-Encode a filename to allow unicodecharacters + * + * Slashes are not encoded + * + * When the second parameter is true the string will + * be encoded only if non ASCII characters are detected - + * This makes it safe to run it multiple times on the + * same string (default is true) + * + * @author Andreas Gohr + * @see urlencode + */ +if (!function_exists('utf8_encodeFN')){ +function utf8_encodeFN($file,$safe=true){ + if($safe && preg_match('#^[a-zA-Z0-9/_\-.%]+$#',$file)){ + return $file; + } + $file = urlencode($file); + $file = str_replace('%2F','/',$file); + return $file; +} +} + +/** + * URL-Decode a filename + * + * This is just a wrapper around urldecode + * + * @author Andreas Gohr + * @see urldecode + */ +if (!function_exists('utf8_decodeFN')){ +function utf8_decodeFN($file){ + $file = urldecode($file); + return $file; +} +} + +/** + * Checks if a string contains 7bit ASCII only + * + * @author Andreas Gohr + */ +if (!function_exists('utf8_isASCII')){ +function utf8_isASCII($str){ + for($i=0; $i127) return false; + } + return true; +} +} + +/** + * Strips all highbyte chars + * + * Returns a pure ASCII7 string + * + * @author Andreas Gohr + */ +if (!function_exists('utf8_strip')){ +function utf8_strip($str){ + $ascii = ''; + for($i=0; $i + * @link http://www.php.net/manual/en/function.utf8-encode.php + */ +if (!function_exists('utf8_check')){ +function utf8_check($Str) { + for ($i=0; $i + * @see strlen() + * @see utf8_decode() + */ +if(!function_exists('utf8_strlen')){ +function utf8_strlen($string){ + return strlen(utf8_decode($string)); +} +} + +/** + * UTF-8 aware alternative to substr + * + * Return part of a string given character offset (and optionally length) + * + * @author Harry Fuecks + * @author Chris Smith + * @param string + * @param integer number of UTF-8 characters offset (from left) + * @param integer (optional) length in UTF-8 characters from offset + * @return mixed string or FALSE if failure + */ +if(!function_exists('utf8_substr')){ +function utf8_substr($str, $offset, $length = null) { + if(UTF8_MBSTRING){ + if( $length === null ){ + return mb_substr($str, $offset); + }else{ + return mb_substr($str, $offset, $length); + } + } + + /* + * Notes: + * + * no mb string support, so we'll use pcre regex's with 'u' flag + * pcre only supports repetitions of less than 65536, in order to accept up to MAXINT values for + * offset and length, we'll repeat a group of 65535 characters when needed (ok, up to MAXINT-65536) + * + * substr documentation states false can be returned in some cases (e.g. offset > string length) + * mb_substr never returns false, it will return an empty string instead. + * + * calculating the number of characters in the string is a relatively expensive operation, so + * we only carry it out when necessary. It isn't necessary for +ve offsets and no specified length + */ + + // cast parameters to appropriate types to avoid multiple notices/warnings + $str = (string)$str; // generates E_NOTICE for PHP4 objects, but not PHP5 objects + $offset = (int)$offset; + if (!is_null($length)) $length = (int)$length; + + // handle trivial cases + if ($length === 0) return ''; + if ($offset < 0 && $length < 0 && $length < $offset) return ''; + + $offset_pattern = ''; + $length_pattern = ''; + + // normalise -ve offsets (we could use a tail anchored pattern, but they are horribly slow!) + if ($offset < 0) { + $strlen = strlen(utf8_decode($str)); // see notes + $offset = $strlen + $offset; + if ($offset < 0) $offset = 0; + } + + // establish a pattern for offset, a non-captured group equal in length to offset + if ($offset > 0) { + $Ox = (int)($offset/65535); + $Oy = $offset%65535; + + if ($Ox) $offset_pattern = '(?:.{65535}){'.$Ox.'}'; + $offset_pattern = '^(?:'.$offset_pattern.'.{'.$Oy.'})'; + } else { + $offset_pattern = '^'; // offset == 0; just anchor the pattern + } + + // establish a pattern for length + if (is_null($length)) { + $length_pattern = '(.*)$'; // the rest of the string + } else { + + if (!isset($strlen)) $strlen = strlen(utf8_decode($str)); // see notes + if ($offset > $strlen) return ''; // another trivial case + + if ($length > 0) { + + $length = min($strlen-$offset, $length); // reduce any length that would go passed the end of the string + + $Lx = (int)($length/65535); + $Ly = $length%65535; + + // +ve length requires ... a captured group of length characters + if ($Lx) $length_pattern = '(?:.{65535}){'.$Lx.'}'; + $length_pattern = '('.$length_pattern.'.{'.$Ly.'})'; + + } else if ($length < 0) { + + if ($length < ($offset - $strlen)) return ''; + + $Lx = (int)((-$length)/65535); + $Ly = (-$length)%65535; + + // -ve length requires ... capture everything except a group of -length characters + // anchored at the tail-end of the string + if ($Lx) $length_pattern = '(?:.{65535}){'.$Lx.'}'; + $length_pattern = '(.*)(?:'.$length_pattern.'.{'.$Ly.'})$'; + } + } + + if (!preg_match('#'.$offset_pattern.$length_pattern.'#us',$str,$match)) return ''; + return $match[1]; +} +} + +/** + * Unicode aware replacement for substr_replace() + * + * @author Andreas Gohr + * @see substr_replace() + */ +if (!function_exists('utf8_substr_replace')){ +function utf8_substr_replace($string, $replacement, $start , $length=0 ){ + $ret = ''; + if($start>0) $ret .= utf8_substr($string, 0, $start); + $ret .= $replacement; + $ret .= utf8_substr($string, $start+$length); + return $ret; +} +} + +/** + * Unicode aware replacement for explode + * + * @TODO support third limit arg + * @author Harry Fuecks + * @see explode(); + */ +if (!function_exists('utf8_explode')){ +function utf8_explode($sep, $str) { + if ( $sep == '' ) { + trigger_error('Empty delimiter',E_USER_WARNING); + return FALSE; + } + + return preg_split('!'.preg_quote($sep,'!').'!u',$str); +} +} + +/** + * Unicode aware replacement for strrepalce() + * + * @todo support PHP5 count (fourth arg) + * @author Harry Fuecks + * @see strreplace(); + */ +if (!function_exists('utf8_str_replace')){ +function utf8_str_replace($s,$r,$str){ + if(!is_array($s)){ + $s = '!'.preg_quote($s,'!').'!u'; + }else{ + foreach ($s as $k => $v) { + $s[$k] = '!'.preg_quote($v).'!u'; + } + } + return preg_replace($s,$r,$str); +} +} + +/** + * Unicode aware replacement for ltrim() + * + * @author Andreas Gohr + * @see ltrim() + * @return string + */ +if (!function_exists('utf8_ltrim')){ +function utf8_ltrim($str,$charlist=''){ + if($charlist == '') return ltrim($str); + + //quote charlist for use in a characterclass + $charlist = preg_replace('!([\\\\\\-\\]\\[/])!','\\\${1}',$charlist); + + return preg_replace('/^['.$charlist.']+/u','',$str); +} +} + +/** + * Unicode aware replacement for rtrim() + * + * @author Andreas Gohr + * @see rtrim() + * @return string + */ +if (!function_exists('utf8_rtrim')){ +function utf8_rtrim($str,$charlist=''){ + if($charlist == '') return rtrim($str); + + //quote charlist for use in a characterclass + $charlist = preg_replace('!([\\\\\\-\\]\\[/])!','\\\${1}',$charlist); + + return preg_replace('/['.$charlist.']+$/u','',$str); +} +} + +/** + * Unicode aware replacement for trim() + * + * @author Andreas Gohr + * @see trim() + * @return string + */ +if (!function_exists('utf8_trim')){ +function utf8_trim($str,$charlist='') { + if($charlist == '') return trim($str); + + return utf8_ltrim(utf8_rtrim($str)); +} +} + + +/** + * This is a unicode aware replacement for strtolower() + * + * Uses mb_string extension if available + * + * @author Andreas Gohr + * @see strtolower() + * @see utf8_strtoupper() + */ +if(!function_exists('utf8_strtolower')){ +function utf8_strtolower($string){ + if(UTF8_MBSTRING) return mb_strtolower($string,'utf-8'); + + global $UTF8_UPPER_TO_LOWER; + $uni = utf8_to_unicode($string); + $cnt = count($uni); + for ($i=0; $i < $cnt; $i++){ + if($UTF8_UPPER_TO_LOWER[$uni[$i]]){ + $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]]; + } + } + return unicode_to_utf8($uni); +} +} + +/** + * This is a unicode aware replacement for strtoupper() + * + * Uses mb_string extension if available + * + * @author Andreas Gohr + * @see strtoupper() + * @see utf8_strtoupper() + */ +if (!function_exists('utf8_strtoupper')){ +function utf8_strtoupper($string){ + if(UTF8_MBSTRING) return mb_strtoupper($string,'utf-8'); + + global $UTF8_LOWER_TO_UPPER; + $uni = utf8_to_unicode($string); + $cnt = count($uni); + for ($i=0; $i < $cnt; $i++){ + if($UTF8_LOWER_TO_UPPER[$uni[$i]]){ + $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]]; + } + } + return unicode_to_utf8($uni); +} +} + +/** + * Replace accented UTF-8 characters by unaccented ASCII-7 equivalents + * + * Use the optional parameter to just deaccent lower ($case = -1) or upper ($case = 1) + * letters. Default is to deaccent both cases ($case = 0) + * + * @author Andreas Gohr + */ +if (!function_exists('utf8_deaccent')){ +function utf8_deaccent($string,$case=0){ + if($case <= 0){ + global $UTF8_LOWER_ACCENTS; + $string = str_replace(array_keys($UTF8_LOWER_ACCENTS),array_values($UTF8_LOWER_ACCENTS),$string); + } + if($case >= 0){ + global $UTF8_UPPER_ACCENTS; + $string = str_replace(array_keys($UTF8_UPPER_ACCENTS),array_values($UTF8_UPPER_ACCENTS),$string); + } + return $string; +} +} + +/** + * Romanize a non-latin string + * + * @author Andreas Gohr + */ +if (!function_exists('utf8_romanize')){ +function utf8_romanize($string){ + if(utf8_isASCII($string)) return $string; //nothing to do + + global $UTF8_ROMANIZATION; + return strtr($string,$UTF8_ROMANIZATION); +} +} + +/** + * Removes special characters (nonalphanumeric) from a UTF-8 string + * + * This function adds the controlchars 0x00 to 0x19 to the array of + * stripped chars (they are not included in $UTF8_SPECIAL_CHARS) + * + * @author Andreas Gohr + * @param string $string The UTF8 string to strip of special chars + * @param string $repl Replace special with this string + * @param string $additional Additional chars to strip (used in regexp char class) + */ +if (!function_exists('utf8_stripspecials')){ +function utf8_stripspecials($string,$repl='',$additional=''){ + global $UTF8_SPECIAL_CHARS; + global $UTF8_SPECIAL_CHARS2; + + static $specials = null; + if(is_null($specials)){ +# $specials = preg_quote(unicode_to_utf8($UTF8_SPECIAL_CHARS), '/'); + $specials = preg_quote($UTF8_SPECIAL_CHARS2, '/'); + } + + return preg_replace('/['.$additional.'\x00-\x19'.$specials.']/u',$repl,$string); +} +} + +/** + * This is an Unicode aware replacement for strpos + * + * Uses mb_string extension if available + * + * @author Harry Fuecks + * @see strpos() + */ +if (!function_exists('utf8_strpos')){ +function utf8_strpos($haystack, $needle,$offset=0) { + if(UTF8_MBSTRING) return mb_strpos($haystack,$needle,$offset,'utf-8'); + + if(!$offset){ + $ar = utf8_explode($needle, $haystack); + if ( count($ar) > 1 ) { + return utf8_strlen($ar[0]); + } + return false; + }else{ + if ( !is_int($offset) ) { + trigger_error('Offset must be an integer',E_USER_WARNING); + return false; + } + + $haystack = utf8_substr($haystack, $offset); + + if ( false !== ($pos = utf8_strpos($haystack,$needle))){ + return $pos + $offset; + } + return false; + } +} +} + +/** + * Encodes UTF-8 characters to HTML entities + * + * @author + * @link http://www.php.net/manual/en/function.utf8-decode.php + */ +if (!function_exists('utf8_tohtml')){ +function utf8_tohtml ($str) { + $ret = ''; + $max = strlen($str); + $last = 0; // keeps the index of the last regular character + for ($i=0; $i<$max; $i++) { + $c = $str{$i}; + $c1 = ord($c); + if ($c1>>5 == 6) { // 110x xxxx, 110 prefix for 2 bytes unicode + $ret .= substr($str, $last, $i-$last); // append all the regular characters we've passed + $c1 &= 31; // remove the 3 bit two bytes prefix + $c2 = ord($str{++$i}); // the next byte + $c2 &= 63; // remove the 2 bit trailing byte prefix + $c2 |= (($c1 & 3) << 6); // last 2 bits of c1 become first 2 of c2 + $c1 >>= 2; // c1 shifts 2 to the right + $ret .= '&#' . ($c1 * 100 + $c2) . ';'; // this is the fastest string concatenation + $last = $i+1; + } + } + return $ret . substr($str, $last, $i); // append the last batch of regular characters +} +} + +/** + * Takes an UTF-8 string and returns an array of ints representing the + * Unicode characters. Astral planes are supported ie. the ints in the + * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates + * are not allowed. + * + * If $strict is set to true the function returns false if the input + * string isn't a valid UTF-8 octet sequence and raises a PHP error at + * level E_USER_WARNING + * + * Note: this function has been modified slightly in this library to + * trigger errors on encountering bad bytes + * + * @author + * @author Harry Fuecks + * @param string UTF-8 encoded string + * @param boolean Check for invalid sequences? + * @return mixed array of unicode code points or FALSE if UTF-8 invalid + * @see unicode_to_utf8 + * @link http://hsivonen.iki.fi/php-utf8/ + * @link http://sourceforge.net/projects/phputf8/ + */ +if (!function_exists('utf8_to_unicode')){ +function utf8_to_unicode($str,$strict=false) { + $mState = 0; // cached expected number of octets after the current octet + // until the beginning of the next UTF8 character sequence + $mUcs4 = 0; // cached Unicode character + $mBytes = 1; // cached expected number of octets in the current sequence + + $out = array(); + + $len = strlen($str); + + for($i = 0; $i < $len; $i++) { + + $in = ord($str{$i}); + + if ( $mState == 0) { + + // When mState is zero we expect either a US-ASCII character or a + // multi-octet sequence. + if (0 == (0x80 & ($in))) { + // US-ASCII, pass straight through. + $out[] = $in; + $mBytes = 1; + + } else if (0xC0 == (0xE0 & ($in))) { + // First octet of 2 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x1F) << 6; + $mState = 1; + $mBytes = 2; + + } else if (0xE0 == (0xF0 & ($in))) { + // First octet of 3 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x0F) << 12; + $mState = 2; + $mBytes = 3; + + } else if (0xF0 == (0xF8 & ($in))) { + // First octet of 4 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x07) << 18; + $mState = 3; + $mBytes = 4; + + } else if (0xF8 == (0xFC & ($in))) { + /* First octet of 5 octet sequence. + * + * This is illegal because the encoded codepoint must be either + * (a) not the shortest form or + * (b) outside the Unicode range of 0-0x10FFFF. + * Rather than trying to resynchronize, we will carry on until the end + * of the sequence and let the later error handling code catch it. + */ + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x03) << 24; + $mState = 4; + $mBytes = 5; + + } else if (0xFC == (0xFE & ($in))) { + // First octet of 6 octet sequence, see comments for 5 octet sequence. + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 1) << 30; + $mState = 5; + $mBytes = 6; + + } elseif($strict) { + /* Current octet is neither in the US-ASCII range nor a legal first + * octet of a multi-octet sequence. + */ + trigger_error( + 'utf8_to_unicode: Illegal sequence identifier '. + 'in UTF-8 at byte '.$i, + E_USER_WARNING + ); + return FALSE; + + } + + } else { + + // When mState is non-zero, we expect a continuation of the multi-octet + // sequence + if (0x80 == (0xC0 & ($in))) { + + // Legal continuation. + $shift = ($mState - 1) * 6; + $tmp = $in; + $tmp = ($tmp & 0x0000003F) << $shift; + $mUcs4 |= $tmp; + + /** + * End of the multi-octet sequence. mUcs4 now contains the final + * Unicode codepoint to be output + */ + if (0 == --$mState) { + + /* + * Check for illegal sequences and codepoints. + */ + // From Unicode 3.1, non-shortest form is illegal + if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || + ((3 == $mBytes) && ($mUcs4 < 0x0800)) || + ((4 == $mBytes) && ($mUcs4 < 0x10000)) || + (4 < $mBytes) || + // From Unicode 3.2, surrogate characters are illegal + (($mUcs4 & 0xFFFFF800) == 0xD800) || + // Codepoints outside the Unicode range are illegal + ($mUcs4 > 0x10FFFF)) { + + if($strict){ + trigger_error( + 'utf8_to_unicode: Illegal sequence or codepoint '. + 'in UTF-8 at byte '.$i, + E_USER_WARNING + ); + + return FALSE; + } + + } + + if (0xFEFF != $mUcs4) { + // BOM is legal but we don't want to output it + $out[] = $mUcs4; + } + + //initialize UTF8 cache + $mState = 0; + $mUcs4 = 0; + $mBytes = 1; + } + + } elseif($strict) { + /** + *((0xC0 & (*in) != 0x80) && (mState != 0)) + * Incomplete multi-octet sequence. + */ + trigger_error( + 'utf8_to_unicode: Incomplete multi-octet '. + ' sequence in UTF-8 at byte '.$i, + E_USER_WARNING + ); + + return FALSE; + } + } + } + return $out; +} +} + +/** + * Takes an array of ints representing the Unicode characters and returns + * a UTF-8 string. Astral planes are supported ie. the ints in the + * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates + * are not allowed. + * + * If $strict is set to true the function returns false if the input + * array contains ints that represent surrogates or are outside the + * Unicode range and raises a PHP error at level E_USER_WARNING + * + * Note: this function has been modified slightly in this library to use + * output buffering to concatenate the UTF-8 string (faster) as well as + * reference the array by it's keys + * + * @param array of unicode code points representing a string + * @param boolean Check for invalid sequences? + * @return mixed UTF-8 string or FALSE if array contains invalid code points + * @author + * @author Harry Fuecks + * @see utf8_to_unicode + * @link http://hsivonen.iki.fi/php-utf8/ + * @link http://sourceforge.net/projects/phputf8/ + */ +if (!function_exists('unicode_to_utf8')){ +function unicode_to_utf8($arr,$strict=false) { + if (!is_array($arr)) return ''; + ob_start(); + + foreach (array_keys($arr) as $k) { + + # ASCII range (including control chars) + if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) { + + echo chr($arr[$k]); + + # 2 byte sequence + } else if ($arr[$k] <= 0x07ff) { + + echo chr(0xc0 | ($arr[$k] >> 6)); + echo chr(0x80 | ($arr[$k] & 0x003f)); + + # Byte order mark (skip) + } else if($arr[$k] == 0xFEFF) { + + // nop -- zap the BOM + + # Test for illegal surrogates + } else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) { + + // found a surrogate + if($strict){ + trigger_error( + 'unicode_to_utf8: Illegal surrogate '. + 'at index: '.$k.', value: '.$arr[$k], + E_USER_WARNING + ); + return FALSE; + } + + # 3 byte sequence + } else if ($arr[$k] <= 0xffff) { + + echo chr(0xe0 | ($arr[$k] >> 12)); + echo chr(0x80 | (($arr[$k] >> 6) & 0x003f)); + echo chr(0x80 | ($arr[$k] & 0x003f)); + + # 4 byte sequence + } else if ($arr[$k] <= 0x10ffff) { + + echo chr(0xf0 | ($arr[$k] >> 18)); + echo chr(0x80 | (($arr[$k] >> 12) & 0x3f)); + echo chr(0x80 | (($arr[$k] >> 6) & 0x3f)); + echo chr(0x80 | ($arr[$k] & 0x3f)); + + } elseif($strict) { + + trigger_error( + 'unicode_to_utf8: Codepoint out of Unicode range '. + 'at index: '.$k.', value: '.$arr[$k], + E_USER_WARNING + ); + + // out of range + return FALSE; + } + } + + $result = ob_get_contents(); + ob_end_clean(); + return $result; +} +} + +/** + * UTF-8 to UTF-16BE conversion. + * + * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + */ +if (!function_exists('utf8_to_utf16be')){ +function utf8_to_utf16be(&$str, $bom = false) { + $out = $bom ? "\xFE\xFF" : ''; + if(UTF8_MBSTRING) return $out.mb_convert_encoding($str,'UTF-16BE','UTF-8'); + + $uni = utf8_to_unicode($str); + foreach($uni as $cp){ + $out .= pack('n',$cp); + } + return $out; +} +} + +/** + * UTF-8 to UTF-16BE conversion. + * + * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + */ +if (!function_exists('utf16be_to_utf8')){ +function utf16be_to_utf8(&$str) { + $uni = unpack('n*',$str); + return unicode_to_utf8($uni); +} +} + +/** + * Replace bad bytes with an alternative character + * + * ASCII character is recommended for replacement char + * + * PCRE Pattern to locate bad bytes in a UTF-8 string + * Comes from W3 FAQ: Multilingual Forms + * Note: modified to include full ASCII range including control chars + * + * @author Harry Fuecks + * @see http://www.w3.org/International/questions/qa-forms-utf-8 + * @param string to search + * @param string to replace bad bytes with (defaults to '?') - use ASCII + * @return string + */ +if (!function_exists('utf8_bad_replace')){ +function utf8_bad_replace($str, $replace = '') { + $UTF8_BAD = + '([\x00-\x7F]'. # ASCII (including control chars) + '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte + '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs + '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte + '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates + '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 + '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 + '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 + '|(.{1}))'; # invalid byte + ob_start(); + while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { + if ( !isset($matches[2])) { + echo $matches[0]; + } else { + echo $replace; + } + $str = substr($str,strlen($matches[0])); + } + $result = ob_get_contents(); + ob_end_clean(); + return $result; +} +} + +/** + * adjust a byte index into a utf8 string to a utf8 character boundary + * + * @param $str string utf8 character string + * @param $i int byte index into $str + * @param $next bool direction to search for boundary, + * false = up (current character) + * true = down (next character) + * + * @return int byte index into $str now pointing to a utf8 character boundary + * + * @author chris smith + */ +if (!function_exists('utf8_correctIdx')){ +function utf8_correctIdx(&$str,$i,$next=false) { + + if ($i <= 0) return 0; + + $limit = strlen($str); + if ($i>=$limit) return $limit; + + if ($next) { + while (($i<$limit) && ((ord($str[$i]) & 0xC0) == 0x80)) $i++; + } else { + while ($i && ((ord($str[$i]) & 0xC0) == 0x80)) $i--; + } + + return $i; +} +} + +// only needed if no mb_string available +if(!UTF8_MBSTRING){ + + /** + * UTF-8 Case lookup table + * + * This lookuptable defines the upper case letters to their correspponding + * lower case letter in UTF-8 + * + * @author Andreas Gohr + */ + global $UTF8_LOWER_TO_UPPER; + $UTF8_LOWER_TO_UPPER = array( + 0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042, + 0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100, + 0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393, + 0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C, + 0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F, + 0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E, + 0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3, + 0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A, + 0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9, + 0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C, + 0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4, + 0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164, + 0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156, + 0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118, + 0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128, + 0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428, + 0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055, + 0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A, + 0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC, + 0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0, + 0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D, + 0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0, + 0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5, + 0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA, + 0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045, + 0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F, + 0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048, + 0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6, + 0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407, + 0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395, + 0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396, + 0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051, + 0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408, + 0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F, + 0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126, + 0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C, + 0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E, + 0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB, + 0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421, + 0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A, + 0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102, + 0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9, + 0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122, + ); + + /** + * UTF-8 Case lookup table + * + * This lookuptable defines the lower case letters to their correspponding + * upper case letter in UTF-8 (it does so by flipping $UTF8_LOWER_TO_UPPER) + * + * @author Andreas Gohr + */ + global $UTF8_UPPER_TO_LOWER; + $UTF8_UPPER_TO_LOWER = @array_flip($UTF8_LOWER_TO_UPPER); + +} // end of case lookup tables + + +/** + * UTF-8 lookup table for lower case accented letters + * + * This lookuptable defines replacements for accented characters from the ASCII-7 + * range. This are lower case letters only. + * + * @author Andreas Gohr + * @see utf8_deaccent() + */ +global $UTF8_LOWER_ACCENTS; +$UTF8_LOWER_ACCENTS = array( + 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', + 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k', + 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', + 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o', + 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', + 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', + 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', + 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', + 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', + 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', + 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j', + 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', + 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', + 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', + 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', +); + +/** + * UTF-8 lookup table for upper case accented letters + * + * This lookuptable defines replacements for accented characters from the ASCII-7 + * range. This are upper case letters only. + * + * @author Andreas Gohr + * @see utf8_deaccent() + */ +global $UTF8_UPPER_ACCENTS; +$UTF8_UPPER_ACCENTS = array( + 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O', + 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', + 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O', + 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O', + 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C', + 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T', + 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L', + 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z', + 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T', + 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O', + 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J', + 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O', + 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G', + 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A', + 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E', +); + +/** + * UTF-8 array of common special characters + * + * This array should contain all special characters (not a letter or digit) + * defined in the various local charsets - it's not a complete list of non-alphanum + * characters in UTF-8. It's not perfect but should match most cases of special + * chars. + * + * The controlchars 0x00 to 0x19 are _not_ included in this array. The space 0x20 is! + * These chars are _not_ in the array either: _ (0x5f), : 0x3a, . 0x2e, - 0x2d, * 0x2a + * + * @author Andreas Gohr + * @see utf8_stripspecials() + */ +global $UTF8_SPECIAL_CHARS; +$UTF8_SPECIAL_CHARS = array( + 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, + 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002b, 0x002c, + 0x002f, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b, + 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e, + 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, + 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, + 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, + 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, + 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, + 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, + 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9, + 0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384, + 0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1, + 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc, + 0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c, + 0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, + 0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015, + 0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, + 0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab, + 0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, + 0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, + 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, + 0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, + 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, + 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310, + 0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, + 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553, + 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, + 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, + 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, + 0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7, + 0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702, + 0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, + 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, + 0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, + 0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, + 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, + 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742, + 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d, + 0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, + 0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f, + 0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, + 0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, + 0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, + 0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, + 0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, + 0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6, + 0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, + 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa, + 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d, +); + +// utf8 version of above data +global $UTF8_SPECIAL_CHARS2; +$UTF8_SPECIAL_CHARS2 = + ' !"#$%&\'()+,/;<=>?@[\]^`{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•�'. + '�—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½�'. + '�¿×÷ˇ˘˙˚˛˜˝̣̀́̃̉΄΅·βφϑϒϕϖְֱֲֳִֵֶַָֹֻּֽ־ֿ�'. + '�ׁׂ׃׳״،؛؟ـًٌٍَُِّْ٪฿‌‍‎‏–—―‗‘’‚“”�'. + '��†‡•…‰′″‹›⁄₧₪₫€№℘™Ωℵ←↑→↓↔↕↵'. + '⇐⇑⇒⇓⇔∀∂∃∅∆∇∈∉∋∏∑−∕∗∙√∝∞∠∧∨�'. + '�∪∫∴∼≅≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌐⌠⌡〈〉⑩─�'. + '��┌┐└┘├┤┬┴┼═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠'. + '╡╢╣╤╥╦╧╨╩╪╫╬▀▄█▌▐░▒▓■▲▼◆◊●�'. + '�★☎☛☞♠♣♥♦✁✂✃✄✆✇✈✉✌✍✎✏✐✑✒✓✔✕�'. + '��✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱'. + '✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋�'. + '�❏❐❑❒❖❘❙❚❛❜❝❞❡❢❣❤❥❦❧❿➉➓➔➘➙➚�'. + '��➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➱➲➳➴➵➶'. + '➷➸➹➺➻➼➽➾�'. + '�ﹼﹽ'; + +/** + * Romanization lookup table + * + * This lookup tables provides a way to transform strings written in a language + * different from the ones based upon latin letters into plain ASCII. + * + * Please note: this is not a scientific transliteration table. It only works + * oneway from nonlatin to ASCII and it works by simple character replacement + * only. Specialities of each language are not supported. + * + * @author Andreas Gohr + * @author Vitaly Blokhin + * @link http://www.uconv.com/translit.htm + * @author Bisqwit + * @link http://kanjidict.stc.cx/hiragana.php?src=2 + * @link http://www.translatum.gr/converter/greek-transliteration.htm + * @link http://en.wikipedia.org/wiki/Royal_Thai_General_System_of_Transcription + * @link http://www.btranslations.com/resources/romanization/korean.asp + */ +global $UTF8_ROMANIZATION; +$UTF8_ROMANIZATION = array( + //russian cyrillic + 'а'=>'a','А'=>'A','б'=>'b','Б'=>'B','в'=>'v','В'=>'V','г'=>'g','Г'=>'G', + 'д'=>'d','Д'=>'D','е'=>'e','Е'=>'E','ё'=>'jo','Ё'=>'Jo','ж'=>'zh','Ж'=>'Zh', + 'з'=>'z','З'=>'Z','и'=>'i','И'=>'I','й'=>'j','Й'=>'J','к'=>'k','К'=>'K', + 'л'=>'l','Л'=>'L','м'=>'m','М'=>'M','н'=>'n','Н'=>'N','о'=>'o','О'=>'O', + 'п'=>'p','П'=>'P','р'=>'r','Р'=>'R','с'=>'s','С'=>'S','т'=>'t','Т'=>'T', + 'у'=>'u','У'=>'U','ф'=>'f','Ф'=>'F','х'=>'x','Х'=>'X','ц'=>'c','Ц'=>'C', + 'ч'=>'ch','Ч'=>'Ch','ш'=>'sh','Ш'=>'Sh','щ'=>'sch','Щ'=>'Sch','ъ'=>'', + 'Ъ'=>'','ы'=>'y','Ы'=>'Y','ь'=>'','Ь'=>'','э'=>'eh','Э'=>'Eh','ю'=>'ju', + 'Ю'=>'Ju','я'=>'ja','Я'=>'Ja', + // Ukrainian cyrillic + 'Ґ'=>'Gh','ґ'=>'gh','Є'=>'Je','є'=>'je','І'=>'I','і'=>'i','Ї'=>'Ji','ї'=>'ji', + // Georgian + 'ა'=>'a','ბ'=>'b','გ'=>'g','დ'=>'d','ე'=>'e','ვ'=>'v','ზ'=>'z','თ'=>'th', + 'ი'=>'i','კ'=>'p','ლ'=>'l','მ'=>'m','ნ'=>'n','ო'=>'o','პ'=>'p','ჟ'=>'zh', + 'რ'=>'r','ს'=>'s','ტ'=>'t','უ'=>'u','ფ'=>'ph','ქ'=>'kh','ღ'=>'gh','ყ'=>'q', + 'შ'=>'sh','ჩ'=>'ch','ც'=>'c','ძ'=>'dh','წ'=>'w','ჭ'=>'j','ხ'=>'x','ჯ'=>'jh', + 'ჰ'=>'xh', + //Sanskrit + 'अ'=>'a','आ'=>'ah','इ'=>'i','ई'=>'ih','उ'=>'u','ऊ'=>'uh','ऋ'=>'ry', + 'ॠ'=>'ryh','ऌ'=>'ly','ॡ'=>'lyh','ए'=>'e','ऐ'=>'ay','ओ'=>'o','औ'=>'aw', + 'अं'=>'amh','अः'=>'aq','क'=>'k','ख'=>'kh','ग'=>'g','घ'=>'gh','ङ'=>'nh', + 'च'=>'c','छ'=>'ch','ज'=>'j','झ'=>'jh','ञ'=>'ny','ट'=>'tq','ठ'=>'tqh', + 'ड'=>'dq','ढ'=>'dqh','ण'=>'nq','त'=>'t','थ'=>'th','द'=>'d','ध'=>'dh', + 'न'=>'n','प'=>'p','फ'=>'ph','ब'=>'b','भ'=>'bh','म'=>'m','य'=>'z','र'=>'r', + 'ल'=>'l','व'=>'v','श'=>'sh','ष'=>'sqh','स'=>'s','ह'=>'x', + //Hebrew + 'א'=>'a', 'ב'=>'b','ג'=>'g','ד'=>'d','ה'=>'h','ו'=>'v','ז'=>'z','ח'=>'kh','ט'=>'th', + 'י'=>'y','ך'=>'h','כ'=>'k','ל'=>'l','ם'=>'m','מ'=>'m','ן'=>'n','נ'=>'n', + 'ס'=>'s','ע'=>'ah','ף'=>'f','פ'=>'p','ץ'=>'c','צ'=>'c','ק'=>'q','ר'=>'r', + 'ש'=>'sh','ת'=>'t', + //Arabic + 'ا'=>'a','ب'=>'b','ت'=>'t','ث'=>'th','ج'=>'g','ح'=>'xh','خ'=>'x','د'=>'d', + 'ذ'=>'dh','ر'=>'r','ز'=>'z','س'=>'s','ش'=>'sh','ص'=>'s\'','ض'=>'d\'', + 'ط'=>'t\'','ظ'=>'z\'','ع'=>'y','غ'=>'gh','ف'=>'f','ق'=>'q','ك'=>'k', + 'ل'=>'l','م'=>'m','ن'=>'n','ه'=>'x\'','و'=>'u','ي'=>'i', + + // Japanese hiragana + 'あ'=>'a','え'=>'e','い'=>'i','お'=>'o','う'=>'u','ば'=>'ba','べ'=>'be', + 'び'=>'bi','ぼ'=>'bo','ぶ'=>'bu','し'=>'ci','だ'=>'da','で'=>'de','ぢ'=>'di', + 'ど'=>'do','づ'=>'du','ふぁ'=>'fa','ふぇ'=>'fe','ふぃ'=>'fi','ふぉ'=>'fo', + 'ふ'=>'fu','が'=>'ga','げ'=>'ge','ぎ'=>'gi','ご'=>'go','ぐ'=>'gu','は'=>'ha', + 'へ'=>'he','ひ'=>'hi','ほ'=>'ho','ふ'=>'hu','じゃ'=>'ja','じぇ'=>'je', + 'じ'=>'ji','じょ'=>'jo','じゅ'=>'ju','か'=>'ka','け'=>'ke','き'=>'ki', + 'こ'=>'ko','く'=>'ku','ら'=>'la','れ'=>'le','り'=>'li','ろ'=>'lo','る'=>'lu', + 'ま'=>'ma','め'=>'me','み'=>'mi','も'=>'mo','む'=>'mu','な'=>'na','ね'=>'ne', + 'に'=>'ni','の'=>'no','ぬ'=>'nu','ぱ'=>'pa','ぺ'=>'pe','ぴ'=>'pi','ぽ'=>'po', + 'ぷ'=>'pu','ら'=>'ra','れ'=>'re','り'=>'ri','ろ'=>'ro','る'=>'ru','さ'=>'sa', + 'せ'=>'se','し'=>'si','そ'=>'so','す'=>'su','た'=>'ta','て'=>'te','ち'=>'ti', + 'と'=>'to','つ'=>'tu','ヴぁ'=>'va','ヴぇ'=>'ve','ヴぃ'=>'vi','ヴぉ'=>'vo', + 'ヴ'=>'vu','わ'=>'wa','うぇ'=>'we','うぃ'=>'wi','を'=>'wo','や'=>'ya','いぇ'=>'ye', + 'い'=>'yi','よ'=>'yo','ゆ'=>'yu','ざ'=>'za','ぜ'=>'ze','じ'=>'zi','ぞ'=>'zo', + 'ず'=>'zu','びゃ'=>'bya','びぇ'=>'bye','びぃ'=>'byi','びょ'=>'byo','びゅ'=>'byu', + 'ちゃ'=>'cha','ちぇ'=>'che','ち'=>'chi','ちょ'=>'cho','ちゅ'=>'chu','ちゃ'=>'cya', + 'ちぇ'=>'cye','ちぃ'=>'cyi','ちょ'=>'cyo','ちゅ'=>'cyu','でゃ'=>'dha','でぇ'=>'dhe', + 'でぃ'=>'dhi','でょ'=>'dho','でゅ'=>'dhu','どぁ'=>'dwa','どぇ'=>'dwe','どぃ'=>'dwi', + 'どぉ'=>'dwo','どぅ'=>'dwu','ぢゃ'=>'dya','ぢぇ'=>'dye','ぢぃ'=>'dyi','ぢょ'=>'dyo', + 'ぢゅ'=>'dyu','ぢ'=>'dzi','ふぁ'=>'fwa','ふぇ'=>'fwe','ふぃ'=>'fwi','ふぉ'=>'fwo', + 'ふぅ'=>'fwu','ふゃ'=>'fya','ふぇ'=>'fye','ふぃ'=>'fyi','ふょ'=>'fyo','ふゅ'=>'fyu', + 'ぎゃ'=>'gya','ぎぇ'=>'gye','ぎぃ'=>'gyi','ぎょ'=>'gyo','ぎゅ'=>'gyu','ひゃ'=>'hya', + 'ひぇ'=>'hye','ひぃ'=>'hyi','ひょ'=>'hyo','ひゅ'=>'hyu','じゃ'=>'jya','じぇ'=>'jye', + 'じぃ'=>'jyi','じょ'=>'jyo','じゅ'=>'jyu','きゃ'=>'kya','きぇ'=>'kye','きぃ'=>'kyi', + 'きょ'=>'kyo','きゅ'=>'kyu','りゃ'=>'lya','りぇ'=>'lye','りぃ'=>'lyi','りょ'=>'lyo', + 'りゅ'=>'lyu','みゃ'=>'mya','みぇ'=>'mye','みぃ'=>'myi','みょ'=>'myo','みゅ'=>'myu', + 'ん'=>'n','にゃ'=>'nya','にぇ'=>'nye','にぃ'=>'nyi','にょ'=>'nyo','にゅ'=>'nyu', + 'ぴゃ'=>'pya','ぴぇ'=>'pye','ぴぃ'=>'pyi','ぴょ'=>'pyo','ぴゅ'=>'pyu','りゃ'=>'rya', + 'りぇ'=>'rye','りぃ'=>'ryi','りょ'=>'ryo','りゅ'=>'ryu','しゃ'=>'sha','しぇ'=>'she', + 'し'=>'shi','しょ'=>'sho','しゅ'=>'shu','すぁ'=>'swa','すぇ'=>'swe','すぃ'=>'swi', + 'すぉ'=>'swo','すぅ'=>'swu','しゃ'=>'sya','しぇ'=>'sye','しぃ'=>'syi','しょ'=>'syo', + 'しゅ'=>'syu','てゃ'=>'tha','てぇ'=>'the','てぃ'=>'thi','てょ'=>'tho','てゅ'=>'thu', + 'つゃ'=>'tsa','つぇ'=>'tse','つぃ'=>'tsi','つょ'=>'tso','つ'=>'tsu','とぁ'=>'twa', + 'とぇ'=>'twe','とぃ'=>'twi','とぉ'=>'two','とぅ'=>'twu','ちゃ'=>'tya','ちぇ'=>'tye', + 'ちぃ'=>'tyi','ちょ'=>'tyo','ちゅ'=>'tyu','ヴゃ'=>'vya','ヴぇ'=>'vye','ヴぃ'=>'vyi', + 'ヴょ'=>'vyo','ヴゅ'=>'vyu','うぁ'=>'wha','うぇ'=>'whe','うぃ'=>'whi','うぉ'=>'who', + 'うぅ'=>'whu','ゑ'=>'wye','ゐ'=>'wyi','じゃ'=>'zha','じぇ'=>'zhe','じぃ'=>'zhi', + 'じょ'=>'zho','じゅ'=>'zhu','じゃ'=>'zya','じぇ'=>'zye','じぃ'=>'zyi','じょ'=>'zyo', + 'じゅ'=>'zyu', + // Japanese katakana + 'ア'=>'a','エ'=>'e','イ'=>'i','オ'=>'o','ウ'=>'u','バ'=>'ba','ベ'=>'be','ビ'=>'bi', + 'ボ'=>'bo','ブ'=>'bu','シ'=>'ci','ダ'=>'da','デ'=>'de','ヂ'=>'di','ド'=>'do', + 'ヅ'=>'du','ファ'=>'fa','フェ'=>'fe','フィ'=>'fi','フォ'=>'fo','フ'=>'fu','ガ'=>'ga', + 'ゲ'=>'ge','ギ'=>'gi','ゴ'=>'go','グ'=>'gu','ハ'=>'ha','ヘ'=>'he','ヒ'=>'hi','ホ'=>'ho', + 'フ'=>'hu','ジャ'=>'ja','ジェ'=>'je','ジ'=>'ji','ジョ'=>'jo','ジュ'=>'ju','カ'=>'ka', + 'ケ'=>'ke','キ'=>'ki','コ'=>'ko','ク'=>'ku','ラ'=>'la','レ'=>'le','リ'=>'li','ロ'=>'lo', + 'ル'=>'lu','マ'=>'ma','メ'=>'me','ミ'=>'mi','モ'=>'mo','ム'=>'mu','ナ'=>'na','ネ'=>'ne', + 'ニ'=>'ni','ノ'=>'no','ヌ'=>'nu','パ'=>'pa','ペ'=>'pe','ピ'=>'pi','ポ'=>'po','プ'=>'pu', + 'ラ'=>'ra','レ'=>'re','リ'=>'ri','ロ'=>'ro','ル'=>'ru','サ'=>'sa','セ'=>'se','シ'=>'si', + 'ソ'=>'so','ス'=>'su','タ'=>'ta','テ'=>'te','チ'=>'ti','ト'=>'to','ツ'=>'tu','ヴァ'=>'va', + 'ヴェ'=>'ve','ヴィ'=>'vi','ヴォ'=>'vo','ヴ'=>'vu','ワ'=>'wa','ウェ'=>'we','ウィ'=>'wi', + 'ヲ'=>'wo','ヤ'=>'ya','イェ'=>'ye','イ'=>'yi','ヨ'=>'yo','ユ'=>'yu','ザ'=>'za','ゼ'=>'ze', + 'ジ'=>'zi','ゾ'=>'zo','ズ'=>'zu','ビャ'=>'bya','ビェ'=>'bye','ビィ'=>'byi','ビョ'=>'byo', + 'ビュ'=>'byu','チャ'=>'cha','チェ'=>'che','チ'=>'chi','チョ'=>'cho','チュ'=>'chu', + 'チャ'=>'cya','チェ'=>'cye','チィ'=>'cyi','チョ'=>'cyo','チュ'=>'cyu','デャ'=>'dha', + 'デェ'=>'dhe','ディ'=>'dhi','デョ'=>'dho','デュ'=>'dhu','ドァ'=>'dwa','ドェ'=>'dwe', + 'ドィ'=>'dwi','ドォ'=>'dwo','ドゥ'=>'dwu','ヂャ'=>'dya','ヂェ'=>'dye','ヂィ'=>'dyi', + 'ヂョ'=>'dyo','ヂュ'=>'dyu','ヂ'=>'dzi','ファ'=>'fwa','フェ'=>'fwe','フィ'=>'fwi', + 'フォ'=>'fwo','フゥ'=>'fwu','フャ'=>'fya','フェ'=>'fye','フィ'=>'fyi','フョ'=>'fyo', + 'フュ'=>'fyu','ギャ'=>'gya','ギェ'=>'gye','ギィ'=>'gyi','ギョ'=>'gyo','ギュ'=>'gyu', + 'ヒャ'=>'hya','ヒェ'=>'hye','ヒィ'=>'hyi','ヒョ'=>'hyo','ヒュ'=>'hyu','ジャ'=>'jya', + 'ジェ'=>'jye','ジィ'=>'jyi','ジョ'=>'jyo','ジュ'=>'jyu','キャ'=>'kya','キェ'=>'kye', + 'キィ'=>'kyi','キョ'=>'kyo','キュ'=>'kyu','リャ'=>'lya','リェ'=>'lye','リィ'=>'lyi', + 'リョ'=>'lyo','リュ'=>'lyu','ミャ'=>'mya','ミェ'=>'mye','ミィ'=>'myi','ミョ'=>'myo', + 'ミュ'=>'myu','ン'=>'n','ニャ'=>'nya','ニェ'=>'nye','ニィ'=>'nyi','ニョ'=>'nyo', + 'ニュ'=>'nyu','ピャ'=>'pya','ピェ'=>'pye','ピィ'=>'pyi','ピョ'=>'pyo','ピュ'=>'pyu', + 'リャ'=>'rya','リェ'=>'rye','リィ'=>'ryi','リョ'=>'ryo','リュ'=>'ryu','シャ'=>'sha', + 'シェ'=>'she','シ'=>'shi','ショ'=>'sho','シュ'=>'shu','スァ'=>'swa','スェ'=>'swe', + 'スィ'=>'swi','スォ'=>'swo','スゥ'=>'swu','シャ'=>'sya','シェ'=>'sye','シィ'=>'syi', + 'ショ'=>'syo','シュ'=>'syu','テャ'=>'tha','テェ'=>'the','ティ'=>'thi','テョ'=>'tho', + 'テュ'=>'thu','ツャ'=>'tsa','ツェ'=>'tse','ツィ'=>'tsi','ツョ'=>'tso','ツ'=>'tsu', + 'トァ'=>'twa','トェ'=>'twe','トィ'=>'twi','トォ'=>'two','トゥ'=>'twu','チャ'=>'tya', + 'チェ'=>'tye','チィ'=>'tyi','チョ'=>'tyo','チュ'=>'tyu','ヴャ'=>'vya','ヴェ'=>'vye', + 'ヴィ'=>'vyi','ヴョ'=>'vyo','ヴュ'=>'vyu','ウァ'=>'wha','ウェ'=>'whe','ウィ'=>'whi', + 'ウォ'=>'who','ウゥ'=>'whu','ヱ'=>'wye','ヰ'=>'wyi','ジャ'=>'zha','ジェ'=>'zhe', + 'ジィ'=>'zhi','ジョ'=>'zho','ジュ'=>'zhu','ジャ'=>'zya','ジェ'=>'zye','ジィ'=>'zyi', + 'ジョ'=>'zyo','ジュ'=>'zyu', + + // "Greeklish" + 'Γ'=>'G','Δ'=>'E','Θ'=>'Th','Λ'=>'L','Ξ'=>'X','Π'=>'P','Σ'=>'S','Φ'=>'F','Ψ'=>'Ps', + 'γ'=>'g','δ'=>'e','θ'=>'th','λ'=>'l','ξ'=>'x','π'=>'p','σ'=>'s','φ'=>'f','ψ'=>'ps', + + // Thai + 'ก'=>'k','ข'=>'kh','ฃ'=>'kh','ค'=>'kh','ฅ'=>'kh','ฆ'=>'kh','ง'=>'ng','จ'=>'ch', + 'ฉ'=>'ch','ช'=>'ch','ซ'=>'s','ฌ'=>'ch','ญ'=>'y','ฎ'=>'d','ฏ'=>'t','ฐ'=>'th', + 'ฑ'=>'d','ฒ'=>'th','ณ'=>'n','ด'=>'d','ต'=>'t','ถ'=>'th','ท'=>'th','ธ'=>'th', + 'น'=>'n','บ'=>'b','ป'=>'p','ผ'=>'ph','ฝ'=>'f','พ'=>'ph','ฟ'=>'f','ภ'=>'ph', + 'ม'=>'m','ย'=>'y','ร'=>'r','ฤ'=>'rue','ฤๅ'=>'rue','ล'=>'l','ฦ'=>'lue', + 'ฦๅ'=>'lue','ว'=>'w','ศ'=>'s','ษ'=>'s','ส'=>'s','ห'=>'h','ฬ'=>'l','ฮ'=>'h', + 'ะ'=>'a','–ั'=>'a','รร'=>'a','า'=>'a','รร'=>'an','ำ'=>'am','–ิ'=>'i','–ี'=>'i', + '–ึ'=>'ue','–ื'=>'ue','–ุ'=>'u','–ู'=>'u','เะ'=>'e','เ–็'=>'e','เ'=>'e','แะ'=>'ae', + 'แ'=>'ae','โะ'=>'o','โ'=>'o','เาะ'=>'o','อ'=>'o','เอะ'=>'oe','เ–ิ'=>'oe', + 'เอ'=>'oe','เ–ียะ'=>'ia','เ–ีย'=>'ia','เ–ือะ'=>'uea','เ–ือ'=>'uea','–ัวะ'=>'ua', + '–ัว'=>'ua','ว'=>'ua','ใ'=>'ai','ไ'=>'ai','–ัย'=>'ai','ไย'=>'ai','าย'=>'ai', + 'เา'=>'ao','าว'=>'ao','–ุย'=>'ui','โย'=>'oi','อย'=>'oi','เย'=>'oei','เ–ือย'=>'ueai', + 'วย'=>'uai','–ิว'=>'io','เ–็ว'=>'eo','เว'=>'eo','แ–็ว'=>'aeo','แว'=>'aeo', + 'เ–ียว'=>'iao', + + // Korean + 'ㄱ'=>'k','ㅋ'=>'kh','ㄲ'=>'kk','ㄷ'=>'t','ㅌ'=>'th','ㄸ'=>'tt','ㅂ'=>'p', + 'ㅍ'=>'ph','ㅃ'=>'pp','ㅈ'=>'c','ㅊ'=>'ch','ㅉ'=>'cc','ㅅ'=>'s','ㅆ'=>'ss', + 'ㅎ'=>'h','ㅇ'=>'ng','ㄴ'=>'n','ㄹ'=>'l','ㅁ'=>'m', 'ㅏ'=>'a','ㅓ'=>'e','ㅗ'=>'o', + 'ㅜ'=>'wu','ㅡ'=>'u','ㅣ'=>'i','ㅐ'=>'ay','ㅔ'=>'ey','ㅚ'=>'oy','ㅘ'=>'wa','ㅝ'=>'we', + 'ㅟ'=>'wi','ㅙ'=>'way','ㅞ'=>'wey','ㅢ'=>'uy','ㅑ'=>'ya','ㅕ'=>'ye','ㅛ'=>'oy', + 'ㅠ'=>'yu','ㅒ'=>'yay','ㅖ'=>'yey', +); + +//Setup VIM: ex: et ts=2 enc=utf-8 : + -- cgit v1.2.3-54-g00ecf