XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
wmp.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
23 {
24  function encode($textarea_id)
25  {
26  $config = parent::loadConfig(dirname(__FILE__));
27  $code = "<img src='{$this->image_path}/wmp.gif' alt='" . _XOOPS_FORM_ALTWMP . "' onclick='xoopsCodeWmp(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWMPURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
28  $javascript = <<<EOH
29  function xoopsCodeWmp(id, enterWmpPhrase, enterWmpHeightPhrase, enterWmpWidthPhrase) {
30  var selection = xoopsGetSelect(id);
31  if (selection.length > 0) {
32  var text = selection;
33  } else {
34  var text = prompt(enterWmpPhrase, "");
35  }
36  var domobj = xoopsGetElementById(id);
37  if ( text.length > 0 ) {
38  var text2 = prompt(enterWmpWidthPhrase, "480");
39  var text3 = prompt(enterWmpHeightPhrase, "330");
40  var result = "[wmp="+text2+","+text3+"]" + text + "[/wmp]";
41  xoopsInsertText(domobj, result);
42  }
43  domobj.focus();
44  }
45 EOH;
46  return array(
47  $code,
48  $javascript);
49  }
50 
51  function load(&$ts)
52  {
53  $ts->patterns[] = "/\[wmp=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/wmp\]/sU";
54  $rp = "<object classid=\"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6\" id=\"WindowsMediaPlayer\" width=\"\\2\" height=\"\\3\">\n";
55  $rp .= "<param name=\"URL\" value=\"\\4\">\n";
56  $rp .= "<param name=\"AutoStart\" value=\"0\">\n";
57  $rp .= "<embed autostart=\"0\" src=\"\\4\" type=\"video/x-ms-wmv\" width=\"\\2\" height=\"\\3\" controls=\"ImageWindow\" console=\"cons\"> </embed>";
58  $rp .= "</object>\n";
59  $ts->replacements[] = $rp;
60  }
61 }
62 ?>