XOOPS  2.6.0
mp3.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}/mp3.gif' alt='" . XoopsLocale::MP3 . "' onclick='xoopsCodeMp3(\"{$textarea_id}\",\"" . htmlspecialchars(XoopsLocale::MP3_URL, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
33  $javascript = <<<EOF
34  function xoopsCodeMp3(id, enterMp3Phrase)
35  {
36  var selection = xoopsGetSelect(id);
37  if (selection.length > 0) {
38  var text = selection;
39  } else {
40  var text = prompt(enterMp3Phrase, "");
41  }
42  var domobj = xoopsGetElementById(id);
43  if ( text.length > 0 ) {
44  var result = "[mp3]" + text + "[/mp3]";
45  xoopsInsertText(domobj, result);
46  }
47  domobj.focus();
48  }
49 EOF;
50 
51  return array(
53  );
54  }
55 
56  static function myCallback($match) {
57  return self::decode($match[1]);
58  }
59 
60  public function load(MyTextSanitizer &$ts)
61  {
62 // $ts->patterns[] = "/\[mp3\](.*?)\[\/mp3\]/es";
63 // $ts->replacements[] = __CLASS__ . "::decode( '\\1' )";
64 //mb------------------------------
65  $ts->callbackPatterns[] = "/\[mp3\](.*?)\[\/mp3\]/s";
66  $ts->callbacks[] = __CLASS__ . "::myCallback";
67 //mb------------------------------
68 
69  return true;
70  }
71 
76  public static function decode ($url, $width, $height)
77  {
79  $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>";
80  return $rp;
81  }
82 }
encode($textarea_id)
Definition: mp3.php:30
$xoops_url
Definition: backend.php:32
load(MyTextSanitizer &$ts)
Definition: mp3.php:60
static decode($url, $width, $height)
Definition: mp3.php:76
static get($name)
Definition: mp3.php:24
$height
const MP3_URL
Definition: en_US.php:846
$url
Definition: register.php:72
$width
$code
Definition: lostpass.php:48
static myCallback($match)
Definition: mp3.php:56