You need to download the MarkItUp editor end put it inside a folder, with a name like markitup, and put it inside your plugin folder. Also download jquery and download it into your markitup plugin folder, and then rename the file to jquery.js
I'm not sure if this step is still need, because I think I read somewhere that Q2A already uses jQuery, so it isn't needed do include the file again.
Then create the qa-plugin.php:
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../../');
exit;
}
qa_register_plugin_module('editor','qa-bbcode-markitup.php','qa_bbcode_markitup','BBCode Markitup');
After that, create a file named qa-bbcode-markitup.php:
<?php
class qa_bbcode_markitup {
var $page2plugin;
var $pdirectory;
function load_module($pdirectory, $page2plugin) {
$this->pdirectory = $pdirectory;
$this->page2plugin = $page2plugin;
}
function calc_quality($content, $format) {
if($format == 'bbcode') return 1.0;
elseif($format == 'html') return 0.0;
elseif($format == '') return 0.8;
else return 0;
}
function get_field(&$qa_content, $content, $format, $fieldname, $rows, $autofocus) {
if ($autofocus)
$qa_content['focusid'] = $fieldname;
$textfield = '
<script type="text/javascript" src="'.$this->page2plugin.'jquery.js"></script>
<script type="text/javascript" src="'.$this->page2plugin.'markitup/jquery.markitup.js"></script>
<script type="text/javascript" src="'.$this->page2plugin.'markitup/sets/bbcode/set.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->page2plugin.'markitup/skins/markitup/style.css" />
<link rel="stylesheet" type="text/css" href="'.$this->page2plugin.'markitup/sets/default/style.css" />
<script language="javascript">
$(document).ready(function() {
$(\'.markItUp\').markItUp(mySettings);
});
</script>
<textarea class="markItUp" name="'.$fieldname.'" id="'.$fieldname.'" cols="80" rows="'.$rows.'">'.$content.'</textarea>';
return array(
'type' => 'custom',
'html' => $textfield,
);
}
function read_post($fieldname) {
$text = qa_post_text($fieldname);
return array(
'format' => 'bbcode',
'content' => $text);
}
}