*/ if (!defined('PmWiki')) exit(); /* * applet - Embed java applets into PmWiki 2.0 pages * Copyright 2005-2014 by D.Faure (dfaure@cpan.org) * Thanks to Shayne Steele (steele cs fsu edu) for the * article at: http://ww2.cs.fsu.edu/~steele/XHTML/appletObject.html * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * See http://www.pmwiki.org/wiki/Cookbook/Applet for info. */ $RecipeInfo['Applet']['Version'] = '2014-08-25'; if(function_exists('Markup_e')) { Markup_e('applet', 'directives', "/\\(:applet(\\s+.*)\\s*:\\)/", "AppletMarkup(\$m[1])"); } else { Markup('applet', 'directives', "/\\(:applet(\\s+.*)\\s*:\\)/e", "AppletMarkup(PSS('$1'))"); } function AppletMarkup($args) { return Keep(Applet(ParseArgs($args, '(?>([\\w\\.]+)[:=])'))); } SDVA($Applet, array( 'classid' => "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93", 'codebase' => "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab", 'not_handled' => "ERROR: Applet not displayed. Visit the Java Software Website to check if Java is installed on your computer or try enabling the ActiveX if you are Internet Explorer user.", )); SDV($HTMLStylesFmt['applet'], " .applet { background-color: #cccccc; } .applet .not_handled { margin: 1em; } "); function Applet($opt) { global $Applet, $UrlScheme, $FarmPubDirUrl, $PubDirUrl; unset($opt['#'], $opt['-'], $opt['+'], $opt['']); $code = @$opt['code']; unset($opt['code']); $archive = @$opt['archive']; unset($opt['archive']); $codebase = @$opt['codebase']; unset($opt['codebase']); $width = @$opt['width']; unset($opt['width']); $height = @$opt['height']; unset($opt['height']); $name = @$opt['name']; unset($opt['name']); $id = @$opt['id']; unset($opt['id']); $title = @$opt['title']; unset($opt['title']); $baseurl = IsEnabled($FarmPubDirUrl, $PubDirUrl); if($archive) { if(!preg_match("/^($UrlScheme|\/)/i", $archive)) $archive = "$baseurl/$archive"; $objparms[] = ""; $archive = "archive=\"$archive\""; } if($codebase) { if(!preg_match("/^($UrlScheme|\/)/i", $codebase)) $codebase = "$baseurl/$codebase"; $objparms[] = ""; } if($name) { $objparms[] = ""; $name = "name=\"$name\""; } if($id) $id = "id=\"$id\""; if($title) $title = "title=\"$title\""; foreach($opt as $n => $v) $objparms[] = ""; $objparms = implode("\n", $objparms); $out = "
{$objparms} {$objparms}
{$Applet['not_handled']}
"; # StopWatch(TraceVars(array( # 'out' => $out, # ))); return $out; }