1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Xoops\Core\Text\Sanitizer\Extensions;
13:
14: use Xoops\Core\Text\Sanitizer;
15: use Xoops\Core\Text\Sanitizer\ExtensionAbstract;
16:
17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
27: class Mms extends ExtensionAbstract
28: {
29: 30: 31:
32: protected static $defaultConfiguration = ['enabled' => false];
33:
34: 35: 36: 37: 38: 39: 40:
41: public function getDhtmlEditorSupport($textAreaId)
42: {
43: $buttonCode = $this->getEditorButtonHtml(
44: $textAreaId,
45: 'wmp.gif',
46: \XoopsLocale::MMS,
47: 'xoopsCodeWmp',
48: \XoopsLocale::MMS_URL,
49: \XoopsLocale::HEIGHT,
50: \XoopsLocale::WIDTH
51: );
52:
53: $javascript = <<<EOH
54: function xoopsCodeMms(id, enterMmsPhrase, enterMmsHeightPhrase, enterMmsWidthPhrase)
55: {
56: var selection = xoopsGetSelect(id);
57: if (selection.length > 0) {
58: var selection="mms://"+selection;
59: var text = selection;
60: } else {
61: var text = prompt(enterMmsPhrase+" mms or http", "mms://");
62: }
63: var domobj = xoopsGetElementById(id);
64: if ( text.length > 0 && text != "mms://") {
65: var text2 = prompt(enterMmsWidthPhrase, "480");
66: var text3 = prompt(enterMmsHeightPhrase, "330");
67: var result = "[mms="+text2+","+text3+"]" + text + "[/mms]";
68: xoopsInsertText(domobj, result);
69: }
70: domobj.focus();
71: }
72: EOH;
73: return [$buttonCode, $javascript];
74: }
75:
76: 77: 78: 79: 80:
81: public function registerExtensionProcessing()
82: {
83: $this->shortcodes->addShortcode(
84: 'mms',
85: function ($attributes, $content, $tagName) {
86: $args = ltrim($attributes[0], '=');
87: list($width, $height) = explode(',', $args);
88: $url = $content;
89:
90: $template = <<<'EOT'
91: <object id=videowindow1 height="%3$s" width="%2$s" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">
92: <param name="URL" value="%1$s">
93: <param name="rate" value="1">
94: <param name="balance" value="0">
95: <param name="currentPosition" value="0">
96: <param name="defaultFrame" value="">
97: <param name="playCount" value="1">
98: <param name="autoStart" value="0">
99: <param name="currentMarker" value="0">
100: <param name="invokeURLs" value="-1">
101: <param name="baseURL" value="">
102: <param name="volume" value="50">
103: <param name="mute" value="0">
104: <param name="uiMode" value="full">
105: <param name="stretchToFit" value="0">
106: <param name="windowlessVideo" value="0">
107: <param name="enabled" value="-1">
108: <param name="enableContextMenu" value="-1">
109: <param name="fullScreen" value="0">
110: <param name="SAMIStyle" value="">
111: <param name="SAMILang" value="">
112: <param name="SAMIFilename" value="">
113: <param name="captioningID" value="">
114: <param name="enableErrorDialogs" value="0">
115: <param name="_cx" value="12700">
116: <param name="_cy" value="8731">
117: </object>
118: EOT;
119:
120: $newContent = sprintf($template, $url, $width, $height);
121: return $newContent;
122: }
123: );
124: }
125: }
126: