*/
var $dflt = array (
'name'=>'',
'width'=>551,
'height'=>359,
'language'=>'',
'country'=>'',
'showToolBar'=>false,
'showToolBarHelp'=>false,
'showAlgebraInput'=>false,
'showResetIcon'=>true,
'showMenuBar'=>false,
'enableShiftDragZoom'=>true,
'enableLabelDrags'=>true,
'enableRightClick'=>true,
'errorDialogsActive' => false,
'borderColor'=>'',
'bgcolor'=>'',
'framePossible'=>'true',
'unsigned'=>'false',
'maxIconSize' => 32,
'ggbOnInitParam' => '',
'java_arguments' => '',
'customToolBar' => ''
);
/**
* return some info
*/
function getInfo()
{
return array (
'author'=>'Jürgen A.Lamers',
'email'=>'jaloma.ac@googlemail.com',
'date'=>@file_get_contents(DOKU_PLUGIN . 'geogebra/VERSION'),
'name'=>'GeoGebra Plugin',
'desc'=>'Include GeoGebra-Files to your Wiki with . See http://www.geogebra.org/source/program/applet/geogebra_applet_param.html',
'url'=>'http://code.google.com/p/dwpjaloma/wiki/GeoGebra'
);
}
/**
* Plugin Type
*/
function getType()
{
return 'substition';
}
function getSort()
{
return 316;
}
function connectTo($mode)
{
$this->Lexer->addSpecialPattern("", $mode, 'plugin_geogebra_geogebrafile');
}
function matchLength()
{
return strlen("matchLength(), -2));
$gmap = $this->_extract_params($match);
return $gmap;
}
/**
* extract parameters for the gmsdisplay from the parameter string
*
* @param string $str_params string of key="value" pairs
* @return array associative array of parameters key=>value
*/
function _extract_params($str_params)
{
$param = array ();
preg_match_all('/(\w*)="(.*?)"/us', $str_params, $param, PREG_SET_ORDER);
if (sizeof($param) == 0)
{
preg_match_all("/(\w*)='(.*?)'/us", $str_params, $param, PREG_SET_ORDER);
}
// parse match for instructions, break into key value pairs
$gmap = $this->dflt;
foreach ($param as $kvpair)
{
list ($match, $key, $val) = $kvpair;
if ( isset ($gmap[$key]))$gmap[$key] = $val;
}
return $gmap;
}
/**
* Create output
*/
function render($mode, & $renderer, $data)
{
if ($mode == 'xhtml')
{
$renderer->doc .= $this->_contact($data);
return true;
}
return false;
}
function getArchive()
{
return "geogebra.jar";
}
function getCode()
{
return "geogebra.GeoGebraApplet";
}
function _contact($data)
{
global $conf;
$file = $data['name'];
$hasfile = $file != null && $file != '';
$file = $conf['savedir'].'/media/'.str_replace(":", "/", $file);
$width = $data['width'];
$height = $data['height'];
$unsigned = $data['unsigned'];
$showToolBar = $data['showToolBar'];
$showToolBarHelp = $data['showToolBarHelp'];
$showAlgebraInput = $data['showAlgebraInput'];
$showResetIcon = $data['showResetIcon'];
$showMenuBar = $data['showMenuBar'];
$enableShiftDragZoom = $data['enableShiftDragZoom'];
$enableLabelDrags = $data['enableLabelDrags'];
$enableRightClick = $data['enableRightClick'];
$borderColor = $data['borderColor'];
$bgcolor = $data['bgcolor'];
$framePossible = $data['framePossible'];
$language = $data['language'];
$country = $data['country'];
$customToolBar = $data['customToolBar'];
// 3.2
$errorDialogsActive = $data['errorDialogsActive'];
$maxIconSize = $data['maxIconSize'];
if ($maxIconSize != 16 && $maxIconSize != 32) {
$maxIconSize = 32;
}
$ggbOnInitParam = $data['ggbOnInitParam'];
$java_arguments = $data['java_arguments'];
$txt = "";
if ($unsigned == 'true')
{
$codebase = $this->getConf('jarbase_unsigned');
$archive = $this->getArchive();
} else
{
$codebase = $this->getConf('jarbase');
$archive = $this->getArchive();
}
$txt .= '';
$txt .= '
';
if ($this->getConf('showHelpUrl'))
{
$txt .= 'Online-Hilfe —';
}
if ($this->getConf('showDownloadUrl') && $hasfile)
{
$txt .= ' Download —';
}
$user = $_SERVER['REMOTE_USER'];
$txt .= ' Erstellt mit © GeoGebra durch '.$user;
return $txt;
}
}//class