XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
mp3.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  $code = "<img src='{$this->image_path}/mp3.gif' alt='" . _XOOPS_FORM_ALTMP3 . "' onclick='xoopsCodeMp3(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERMP3URL, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
27  $javascript = <<<EOF
28  function xoopsCodeMp3(id, enterMp3Phrase)
29  {
30  var selection = xoopsGetSelect(id);
31  if (selection.length > 0) {
32  var text = selection;
33  } else {
34  var text = prompt(enterMp3Phrase, "");
35  }
36  var domobj = xoopsGetElementById(id);
37  if ( text.length > 0 ) {
38  var result = "[mp3]" + text + "[/mp3]";
39  xoopsInsertText(domobj, result);
40  }
41  domobj.focus();
42  }
43 EOF;
44 
45  return array(
46  $code ,
47  $javascript);
48  }
49 
50  function load(&$ts)
51  {
52  $ts->patterns[] = "/\[mp3\](.*?)\[\/mp3\]/es";
53  $ts->replacements[] = __CLASS__ . "::decode( '\\1' )";
54 
55  return true;
56  }
57 
58  function decode($url)
59  {
60  $rp = "<embed flashvars=\"playerID=1&amp;bg=0xf8f8f8&amp;leftbg=0x3786b3&amp;lefticon=0x78bee3&amp;rightbg=0x3786b3&amp;rightbghover=0x78bee3&amp;righticon=0x78bee3&amp;righticonhover=0x3786b3&amp;text=0x666666&amp;slider=0x3786b3&amp;track=0xcccccc&amp;border=0x666666&amp;loader=0x78bee3&amp;loop=no&amp;soundFile={$url}\" quality='high' menu='false' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' src='" . XOOPS_URL . "/images/form/player.swf' width=290 height=24 type='application/x-shockwave-flash'></embed>";
61  return $rp;
62  }
63 }
64 ?>