<?php if (!defined('PmWiki')) exit (); /* * This script allows to embed Windows Media Player content * in pmwiki pages. * Code original for quicktime content by Sebastian Siedentopf <schlaefer@macnews.de> * modified for Windows Media Player by Hans Bracker * * Markup (:wmplayer Attach:filename width=number height=number [key=value] [key=value] ... :) * * use Attach:filename or http://urlpath/filepath/filename * height= an width= parameters are mandantory * other parameters can be supplied to control the player's behaviour * Example (music): (:wmplayer Attach:mymusic.wma width=200 height=25 :) * Example (video): (:wmplayer Attach:myvideo.wmv width=500 height=300 :) * * * Version History * --------------- * 0.1 - initial release */ # set to 0 to disable loading of files with http://urlpath... SDV($EnableExternalResource, 1); Markup('wmplayer', '<img', "/\\(:wmplayer (.*?:)(.*?)(\\s.*?)?\\s*?:\\)/e", "WMPlayer('$1','$2','$3')"); function WMPlayer($imap, $path, $args) { global $UploadFileFmt, $pagename, $PageUrl, $PubDirUrl, $IMapLinkFmt, $EnableExternalResource; if ($EnableExternalResource==1 && $imap=='http:') { $exturl=1; $FileUrl = 'http:'.$path; } else { $filepath = FmtPageName("$UploadFileFmt/".$path, $pagename); if (file_exists($filepath)) $IMapLinkFmt['Attach:'] = '$LinkUrl'; $FileUrl = LinkUpload($pagename, $imap, $path, $path, $path); } if (file_exists($filepath) || $exturl==1) { $args = ParseArgs($args); ## object tag $out = "<object id=\"mediaPlayer\" "; $out.= "classid=\"clsid:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" "; $out.= "codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" "; $out.= "standby=\"Loading Microsoft Windows Media Player components...\" "; $out.= "type=\"application/x-oleobject\" "; if (isset($args['width'])) $out .= " width=\"".$args['width']."\""; if (isset($args['height'])) $out .= " height=\"".$args['height']."\""; $out .= ">"; $out .= "<param name=\"Filename\" value=\"$FileUrl\" />"; foreach ($args as $key => $arg) if ($key != '#') $out .= "<param name=\"$key\" value=\"$arg\" />"; $out .= "</object>"; return Keep($out); } if($imap=='http:') return ""; else return Keep($FileUrl); }