see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Damian Parker // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: StarRider // | Rewrote data function so plugin can cover more types of objects than just Flash // | by: Jasp (Jared Woodbridge) // +----------------------------------------------------------------------+ // $Id$ /** * definitions */ global $gBitSystem; if( $gBitSystem->isPackageActive( 'wiki' ) ) { // Do not include this Plugin if the Package is not active define( 'PLUGIN_GUID_DATAOBJECT', 'dataobject' ); global $gLibertySystem; $pluginParams = [ 'tag' => 'OBJECT', 'auto_activate' => false, 'requires_pair' => false, 'load_function' => '\data_object', 'title' => 'Object', 'help_page' => 'DataPluginObject', 'description' => KernelTools::tra("This plugin displays a Flash, Tcl or Java applet/object."), 'help_function' => '\data_object_help', 'syntax' => "{OBJECT type= src= width= height=}", 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAOBJECT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAOBJECT ); function data_object_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
type' . KernelTools::tra( "key-word" ) . '
' . KernelTools::tra( "(manditory)" ) . '
' . KernelTools::tra( "The type of object being displayed. Possible values are:") . ' tcl, flash, java.' . '
src' . KernelTools::tra( "string" ) . '
' . KernelTools::tra( "(manditory)" ) . '
' . KernelTools::tra( "The location of the file used for the object. This can be any URL or a site value. See Examples.") . '
param_name' . KernelTools::tra( "string" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "Can be used to specify custom object parameters. Currently only available for Tcl applets. Replace \"name\" with the name of the parameter.") . '
width' . KernelTools::tra( "number or percentage" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::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 % MUST follow the value.") . '
height' . KernelTools::tra( "number or percentage" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::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 % MUST follow the value.") . '
float' . KernelTools::tra( "key-words" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::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:") . ' left, right, none. ' . KernelTools::tra("(Default = ") . '' . KernelTools::tra( 'none - object is shown inline' ) . ')
clear' . KernelTools::tra( "key-words" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "Specifies which horizontal sides of the object can not have other content flowing around. Possible values are:") . ' left, right, both, none. ' . KernelTools::tra("(Default = ") . '' . KernelTools::tra( 'none - content is allowed to flow around object' ) . ')
' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Flash specific parameters" ) . '
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
quality' . KernelTools::tra( "key-word" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "The quality at which to display a Flash applet. Possible values are unknown - except:") . ' high ' . KernelTools::tra("and probably") . ' low.
' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Java specific parameters" ) . '
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
vmversion' . KernelTools::tra( "version number" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "The version of Java required for the applet. Should be in the form of X.x, eg: 1.3." ) . '
pagescript' . KernelTools::tra( "boolean" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "Specifies if the applet can access Javascript features on the web page. Possible values are:") . ' true, false.
appletscript' . KernelTools::tra( "boolean" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "Specifies whether the applet is scriptable from the web page using JavaScript or VBScript. Possible values are:") . ' true, false.
srcbase' . KernelTools::tra( "string" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "The base location of the Java applet." ) . '
archive' . KernelTools::tra( "string" ) . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "Specifies the name of the Java archive." ) . '
' . KernelTools::tra("Example: ") . "{OBJECT type=flash src=../liberty/icons/Mind-Reader.swf}
" . KernelTools::tra("Example: ") . "{OBJECT type=flash src=https://www.bitweaver.org/liberty/icons/Mind-Reader.swf width='100%' height='600' quality='high'}
" . KernelTools::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.'); return $help; } function data_object ($data, $params) { // Need these plugin parameters foreach (["type", "src"] as $parameter) { if (!array_key_exists($parameter, $params)) return ''.KernelTools::tra('When using {object}, a type and src parameter is required.').''; } $objectParams = []; switch ($params["type"]) { case "tcl": // 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. foreach (array_keys($params) as $parameter) { if (mb_ereg("param_*", $parameter)) $objectParams[substr($parameter, 6)] = $params[$parameter]; } // case "tcl": // Tcl Plugin applet $classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; $objectParams["type"] = "application/x-tcl"; $objectParams["pluginspage"] = "http://www.tcl.tk/software/plugin/"; $objectParams["src"] = $params["src"]; break; case "flash": // Macromedia Flash movie $classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; $objectParams["movie"] = $params["src"]; if (array_key_exists("quality", $params)) $objectParams["quality"] = $params["quality"]; break; case "java": // Java applet $classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; $objectParams["code"] = $params["src"]; $objectParams["type"] = "application/x-java-applet"; if (array_key_exists("vmversion", $params)) $objectParams["type"] .= ';version='.$params["vmversion"]; if (array_key_exists("pagescript", $params)) $objectParams["mayscript"] = $params["pagescript"]; if (array_key_exists("appletscript", $params)) $objectParams["scriptable"] = $params["appletscript"]; if (array_key_exists("srcbase", $params)) $objectParams["codebase"] = $params["srcbase"]; if (array_key_exists("archive", $params)) $objectParams["archive"] = $params["archive"]; break; default: // Unrecognized object type return ''.KernelTools::tra('The type parameter of {object} must either be tcl, flash or java.').''; } // Build the HTML code $result = ''; $result .= ''; // ...and we're done return $result; } }