XOOPS  2.6.0
wmp.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
25 {
30  public function encode($textarea_id)
31  {
32  $code = "<img src='{$this->image_path}/wmp.gif' alt='" . XoopsLocale::WMP . "' onclick='xoopsCodeWmp(\"{$textarea_id}\",\"" . htmlspecialchars(XoopsLocale::WMP_URL, ENT_QUOTES) . "\",\"" . htmlspecialchars(XoopsLocale::HEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(XoopsLocale::WIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
33  $javascript = <<<EOH
34  function xoopsCodeWmp(id, enterWmpPhrase, enterWmpHeightPhrase, enterWmpWidthPhrase) {
35  var selection = xoopsGetSelect(id);
36  if (selection.length > 0) {
37  var text = selection;
38  } else {
39  var text = prompt(enterWmpPhrase, "");
40  }
41  var domobj = xoopsGetElementById(id);
42  if ( text.length > 0 ) {
43  var text2 = prompt(enterWmpWidthPhrase, "480");
44  var text3 = prompt(enterWmpHeightPhrase, "330");
45  var result = "[wmp="+text2+","+text3+"]" + text + "[/wmp]";
46  xoopsInsertText(domobj, result);
47  }
48  domobj.focus();
49  }
50 EOH;
51  return array(
53  );
54  }
55 
60  public function load(MyTextSanitizer &$ts)
61  {
62  $ts->patterns[] = "/\[wmp=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/wmp\]/sU";
63  $rp = "<object classid=\"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6\" id=\"WindowsMediaPlayer\" width=\"\\2\" height=\"\\3\">\n";
64  $rp .= "<param name=\"URL\" value=\"\\4\">\n";
65  $rp .= "<param name=\"AutoStart\" value=\"0\">\n";
66  $rp .= "<embed autostart=\"0\" src=\"\\4\" type=\"video/x-ms-wmv\" width=\"\\2\" height=\"\\3\" controls=\"ImageWindow\" console=\"cons\"> </embed>";
67  $rp .= "</object>\n";
68  $ts->replacements[] = $rp;
69  }
70 }
Definition: wmp.php:24
encode($textarea_id)
Definition: wmp.php:30
const HEIGHT
Definition: en_US.php:459
$code
Definition: lostpass.php:48
load(MyTextSanitizer &$ts)
Definition: wmp.php:60