Note : There's apparently a bug in the current release, witch i didn't recognize while testing locally. If you get a javascript-error, try reloading the page, and it should be fine.
<?php
// here we patch a common problem.
// older versions of php used to have magic_quotes turned on per default.
// if you have access to turn off magic_quotes you should do so, and in that
// case, you could get rid of theese lines
if (get_magic_quotes_gpc()) {
foreach (array_keys($_POST) as $key) $_POST[$key] = stripslashes($_POST[$key]);
}
// Include the library, and configure the clientside dir
define('DIR_WS_HTMLAREA', substr($_SERVER['PHP_SELF'], 0, -1 * strlen(basename(__FILE__))) . "htmlarea/" );
require_once('htmlarea.class.php');
// set language to use
// beware that all plugins used must supply the requested language, or htmlareea won't work
HTMLArea::setLang("en");
// create an instance for the demo
$widget =& new HTMLArea("ta", @$_POST['ta']);
// load the Indite plugin + ContextMenu. You may load additional plugs aswell.
$widget->addPlugin('ContextMenu');
// load the Indite plugin. You may optionally specify witch ruleset to run with.
// Here we choose 'article' witch is also the default, so we would have gotten that
// anyway. Currently it's the only one available
$widget->addPlugin('Indite', 'article');
// load a custom config
$widget->config = 'indite';
// height and width are optional parameters
$widget->width = 340;
$widget->height = 240;
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html>
<head>
<title>Indite RC3 demonstration</title>
<?php
echo HTMLArea::getStatic();
?>
</head>
<body>
<h1>Indite RC3 demonstration</h1>
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<?php
echo $widget->get();
?>
<p>
<input type="submit" />
</p>
</form>
<p>
Note : There's apparently a bug in the current release, witch i didn't recognize while testing locally.
If you get a javascript-error, try reloading the page, and it should be fine.
</p>
<div style="background-color:#eee;border:1px solid #ccc;padding:1em;margin-top:1em;">
<h2>The code of this page</h2>
<code>
<?php
// taken from http://www.php.net/highlight_file
function highlight_file_xhtml($file, $return=FALSE){
$syntax = show_source($file, TRUE);
$syntax = str_replace("<font color=\"", "<span style=\"color: ", $syntax);
$syntax = str_replace("</font>", "</span>", $syntax);
if ($return){
return $syntax;
} else {
print $syntax;
}
}
// this just dumps the content of this file, so the user needn't download the script
// to peek into the sourcecode.
highlight_file_xhtml(__FILE__);
?>
</code>
</div>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0!" height="31" width="88" style="border:0" /></a>
</p>
</body>
</html>