*/ if (!defined('PmWiki')) exit(); /* * PTViewer - Embed PTViewer java applet into PmWiki 2.2 pages * Copyright 2005-2014 by D.Faure (dfaure@cpan.org) * * You can redistribute it and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * See http://www.pmwiki.org/wiki/Cookbook/PTViewer for info. */ $RecipeInfo['PTViewer']['Version'] = '2014-08-25'; include_once("$FarmD/cookbook/applet.php"); include_once("$FarmD/cookbook/extlinkedres.php"); if(function_exists('Markup_e')) { Markup_e('ptviewer', 'directives', "/\\(:ptviewer\\s+(\\S+)(\\s+.*?)?:\\)/i", "PTViewer(\$pagename,\$m[1],\$m[2])"); } else { Markup('ptviewer', 'directives', "/\\(:ptviewer\\s+(\\S+)(\\s+.*?)?:\\)/ie", "PTViewer(\$pagename,'$1',PSS('$2'))"); } function PTViewer($pagename, $tgt, $args) { if(!ResolveLinkResource($pagename, $tgt, $url, $txt, $upname, $filepath, $size, $mime)) return isset($filepath) ? $url : ''; global $FarmPubDirUrl, $PubDirUrl; $opt = ParseArgs($args); $caption = $opt['caption']; unset($opt['caption']); unset($opt['codebase']); $opt['code'] = "ptviewer.class"; $opt['archive'] = IsEnabled($FarmPubDirUrl, $PubDirUrl) . "/ptviewer.jar"; $opt['file'] = $url; $out = Keep(Applet($opt)); if($caption) $out .= "[-$caption-]"; return $out; }