Syntax Highlighter Manual
From MyUPBWiki
Back to Syntax Highlighter Main Page
This is a Syntax-Highlighter mod for MyUPBv2.0. It is powered by the Geshi Syntax highlighting library/class, which has been rebundled for ease of installation. It is important that you read the Manual before attempting to install.
Contents |
Requirements
Forum Version
UPB version 2.0B or later is required to run Syntax-Highlighter
Dependencies
To run Syntax-Highlighter, you must have installed the following modifications:
- None
Installation
- Download the Zip file, and extract in the "includes/lib/" folder.
- Open up "includes/inc/post.inc.php" with a text editor.
- Find the line that looks like the following: $msg = preg_replace("/\[code\](.*?)\[\/code\]/si", "<font color='red'>Code:<hr><pre>\\1<hr></pre></font>", $msg);
- Add this line after: $msg = preg_replace(":\[code=([a-zA-Z0-9]+)\](.*?)\[/code\]:esi", "doSyntaxHighlight('$2', '$1')", $msg);
- Add the following code before the '?>'
function doSyntaxHighlight($code, $lang) { if(file_exists("includes/lib/geshi/geshi/$lang.php" )) { if(!defined('GESHI_VERSION')) { require_once('includes/lib/geshi/geshi.php'); } $code = html_entity_decode($code, ENT_QUOTES); $result = geshi_highlight($code, $lang, 'includes/lib/geshi/geshi', true); } else { $result = $code; } return "<font color='red'>Code:</font><hr>".$result."<hr>"; }
Administration
There are no administration functions for this modification
Troubleshooting
Please contact me (Jono345) via PM on the forums
Credits
- Jono345
- The developers and contributors to the Geshi project
License
See the Geshi site for licensing information
