Source for file data.object.php
Documentation is available at data.object.php
* @subpackage plugins_data
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Damian Parker <damosoft@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// | Rewrote data function so plugin can cover more types of objects than just Flash
// | by: Jasp (Jared Woodbridge) <jaspp@users.sourceforge.net>
// +----------------------------------------------------------------------+
if( $gBitSystem->isPackageActive( 'wiki' ) ) { // Do not include this Plugin if the Package is not active
define( 'PLUGIN_GUID_DATAOBJECT', 'dataobject' );
'auto_activate' => FALSE,
'requires_pair' => FALSE,
'load_function' => 'data_object',
'help_page' => 'DataPluginObject',
'description' => tra("This plugin displays a Flash, Tcl or Java applet/object."),
'help_function' => 'data_object_help',
'syntax' => "{OBJECT type= src= width= height=}",
'<table class="data help">'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "key-word" ) . '<br />' . tra( "(manditory)" ) . '</td>'
. '<td>' . tra( "The type of object being displayed. Possible values are:") . ' <strong>tcl, flash, java</strong>.' . '</td>'
. '<td>' . tra( "string" ) . '<br />' . tra( "(manditory)" ) . '</td>'
. '<td>' . tra( "The location of the file used for the object. This can be any URL or a site value. See Examples.") . '</td>'
. '<td>param_<i>name</i></td>'
. '<td>' . tra( "string" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Can be used to specify custom object parameters. Currently only available for Tcl applets. Replace \"<i>name</i>\" with the name of the parameter.") . '</td>'
. '<td>' . tra( "number or percentage" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "The width of the object. This value can be given in pixels or as a percentage of available area. A pixel value is assumed so only a numeric value is needed. To specify a percentage - the character <strong>% MUST</strong> follow the value.") . '</td>'
. '<td>' . tra( "number or percentage" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "The height of the object. This value can be given in pixels or as a percentage. A pixel value is assumed so only a numeric value is needed. To specify a percentage - the character <strong>% MUST</strong> follow the value.") . '</td>'
. '<td>' . tra( "key-words" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Specifies how the object is to float on the page. Floating elements are positioned on the side specified, with content flowing around. Possible values are:") . ' <strong>left, right, none</strong>. '
. tra("(Default = ") . '<strong>' . tra( 'none - object is shown inline' ) . '</strong>)</td>'
. '<td>' . tra( "key-words" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Specifies which horizontal sides of the object can not have other content flowing around. Possible values are:") . ' <strong>left, right, both, none</strong>. '
. tra("(Default = ") . '<strong>' . tra( 'none - content is allowed to flow around object' ) . '</strong>)</td>'
. '<table class="data help">'
. '<caption>' . tra( "Flash specific parameters" ) . '</caption>'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "key-word" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "The quality at which to display a Flash applet. Possible values are unknown - except:") . ' <strong>high</strong> ' . tra("and probably") . ' <strong>low</strong>.</td>'
. '<table class="data help">'
. '<caption>' . tra( "Java specific parameters" ) . '</caption>'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "version number" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "The version of Java required for the applet. Should be in the form of <strong>X.x</strong>, eg: <strong>1.3</strong>." ) . '</td>'
. '<td>' . tra( "boolean" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Specifies if the applet can access Javascript features on the web page. Possible values are:") . ' <strong>true, false</strong>.</td>'
. '<td>' . tra( "boolean" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Specifies whether the applet is scriptable from the web page using JavaScript or VBScript. Possible values are:") . ' <strong>true, false</strong>.</td>'
. '<td>' . tra( "string" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "The base location of the Java applet." ) . '</td>'
. '<td>' . tra( "string" ) . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "Specifies the name of the Java archive." ) . '</td>'
. tra("Example: ") . "{OBJECT type=flash src=../liberty/icons/Mind-Reader.swf}<br />"
. tra("Example: ") . "{OBJECT type=flash src=http://www.bitweaver.org/liberty/icons/Mind-Reader.swf width='100%' height='600' quality='high'}<br />"
. tra('Both of these examples display "The Flash Mind Reader" by Andy Naughton. The first example is on your site and is not very large. The second example is located on the bitweaver.org site and takes the width of the center column with an appropriate height.');
// Need these plugin parameters
foreach (array("type", "src") as $parameter) {
return '<span class="warning">'. tra('When using <strong>{object}</strong>, a <strong>type</strong> and <strong>src</strong> parameter is required.'). '</span>';
switch ($params["type"]) {
// This loop scans for and sets param_ custom object parmeters. Note that in the future, it may be used for object types other than Tcl, so don't go making this part of the tcl clause below.
if (ereg("param_*", $parameter))
$objectParams[substr($parameter, 6)] = $params[$parameter];
$classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
$objectParams["type"] = "application/x-tcl";
$objectParams["pluginspage"] = "http://www.tcl.tk/software/plugin/";
$objectParams["src"] = $params["src"];
// Macromedia Flash movie
$classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
$objectParams["movie"] = $params["src"];
$objectParams["quality"] = $params["quality"];
$classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
$objectParams["code"] = $params["src"];
$objectParams["type"] = "application/x-java-applet";
$objectParams["type"] .= ';version='. $params["vmversion"];
$objectParams["mayscript"] = $params["pagescript"];
$objectParams["scriptable"] = $params["appletscript"];
$objectParams["codebase"] = $params["srcbase"];
$objectParams["archive"] = $params["archive"];
// Unrecognized object type
return '<span class="warning">'. tra('The <strong>type</strong> parameter of <strong>{object}</strong> must either be <strong>tcl</strong>, <strong>flash</strong> or <strong>java</strong>.'). '</span>';
// Build the <object> HTML code
$result = '<object classid="'. $classid. '" style="';
$result .= (array_key_exists("float", $params)) ? ' float: ' . $params["float"]. ';' : '';
$result .= (array_key_exists("clear", $params)) ? ' clear: ' . $params["clear"]. ';' : '';
$result .= (array_key_exists("width", $params)) ? ' width="' . $params["width"]. '"' : '';
$result .= (array_key_exists("height", $params)) ? ' height="'. $params["height"]. '"' : '';
$result .= '<param name="'. $parameter. '" value="'. $objectParams[$parameter]. '"/>';
|