|
[xoops-svn] SF.net SVN: xoops-svn:[12279]
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/ textsanitizer
From: <rgr...@us...> - 2014-01-30 02:53:08
|
Revision: 12279
http://sourceforge.net/p/xoops/svn/12279
Author: rgriffith
Date: 2014-01-30 02:53:06 +0000 (Thu, 30 Jan 2014)
Log Message:
-----------
Add [soundcloud] BB code as supplied by iHackCode
See: http://xoops.org/modules/newbb/viewtopic.php?post_id=356724#forumpost356724
Usage: [soundcode]https://soundcloud.com/(user)/(track)[/soundcode]
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/config.php
Added Paths:
-----------
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/index.html
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/soundcloud.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/config.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/config.php 2014-01-26 11:40:49 UTC (rev 12278)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/config.php 2014-01-30 02:53:06 UTC (rev 12279)
@@ -31,6 +31,7 @@
"wiki" => is_dir(XOOPS_ROOT_PATH . '/modules/mediawiki/'),
"mms" => 0,
"rtsp" => 0,
+ "soundcloud" => 1,
"ul" => 1,
"li" => 1),
Added: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/index.html
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/index.html (rev 0)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/index.html 2014-01-30 02:53:06 UTC (rev 12279)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/soundcloud.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/soundcloud.php (rev 0)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/soundcloud/soundcloud.php 2014-01-30 02:53:06 UTC (rev 12279)
@@ -0,0 +1,63 @@
+<?php
+
+class MytsSoundcloud extends MyTextSanitizerExtension
+{
+ public function encode($textarea_id)
+ {
+ $config = parent::loadConfig( dirname(__FILE__) );
+ $code = "<img src='{$this->image_path}/soundcloud.png' alt='SoundCloud' "
+ . "onclick='xoopsCodeSoundCloud(\"{$textarea_id}\",\""
+ . htmlspecialchars('Enter SoundCloud Profile URL', ENT_QUOTES)
+ . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $javascript = <<<EOH
+ function xoopsCodeSoundCloud(id, enterSoundCloud)
+ {
+ var selection = xoopsGetSelect(id);
+ if (selection.length > 0) {
+ var text = selection;
+ } else {
+ var text = prompt(enterSoundCloud, "");
+ }
+
+ var domobj = xoopsGetElementById(id);
+ xoopsInsertText(domobj, "[soundcloud]"+text+"[/soundcloud]");
+ domobj.focus();
+ }
+EOH;
+
+ return array($code, $javascript);
+ }
+
+ public function load(&$ts)
+ {
+ $ts->callbackPatterns[] = "/\[soundcloud\](http[s]?:\/\/[^\"'<>]*)(.*)\[\/soundcloud\]/sU";
+ $ts->callbacks[] = __CLASS__ . "::myCallback";
+
+ }
+
+ public static function myCallback($match)
+ {
+ $url = $match[1] . $match[2];
+ $config = parent::loadConfig(dirname(__FILE__));
+ if (!preg_match("/^http[s]?:\/\/(www\.)?soundcloud\.com\/(.*)/i", $url, $matches)) {
+ trigger_error("Not matched: {$url}", E_USER_WARNING);
+
+ return "";
+ }
+
+ $code = '<object height="81" width="100%"><param name="movie" '
+ . 'value="http://player.soundcloud.com/player.swf?url='.$url.'&g=bb">'
+ . '</param><param name="allowscriptaccess" value="always"></param>'
+ . '<embed allowscriptaccess="always" height="81" '
+ . 'src="http://player.soundcloud.com/player.swf?url=' . $url
+ . '&g=bb" type="application/x-shockwave-flash" width="100%"></embed></object>'
+ . '<a href="'.$url.'">'.$url.'</a>';
+
+ return $code;
+ }
+
+// public static function decode($url1, $url2)
+// {
+// }
+
+}
|
|
[xoops-svn] SF.net SVN: xoops-svn:[12282]
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/ textsanitizer
From: <be...@us...> - 2014-01-30 12:25:31
|
Revision: 12282
http://sourceforge.net/p/xoops/svn/12282
Author: beckmi
Date: 2014-01-30 10:14:26 +0000 (Thu, 30 Jan 2014)
Log Message:
-----------
Added "title" to buttons
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/flash/flash.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mms/mms.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mp3/mp3.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/rtsp/rtsp.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wiki/wiki.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wmp/wmp.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/youtube/youtube.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/flash/flash.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/flash/flash.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/flash/flash.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -24,7 +24,11 @@
function encode($textarea_id)
{
$config = parent::loadConfig(dirname(__FILE__));
- $code = "<img src='{$this->image_path}/swf.gif' alt='" . _XOOPS_FORM_ALTFLASH . "' onclick='xoopsCodeFlash(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERFLASHURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\", \"" . $config['detect_dimension'] . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $code = "<img src='{$this->image_path}/swf.gif' alt='" . _XOOPS_FORM_ALTFLASH . "' title='" . _XOOPS_FORM_ALTFLASH . "' '" . "' onclick='xoopsCodeFlash(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERFLASHURL, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\", \"" . $config['detect_dimension']
+ . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOF
function xoopsCodeFlash(id, enterFlashPhrase, enterFlashHeightPhrase, enterFlashWidthPhrase, enableDimensionDetect)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mms/mms.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mms/mms.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mms/mms.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -24,7 +24,10 @@
function encode($textarea_id)
{
$config = parent::loadConfig(dirname(__FILE__));
- $code = "<img src='{$this->image_path}/mmssrc.gif' alt='" . _XOOPS_FORM_ALTMMS . "' onclick='xoopsCodeMms(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERMMSURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $code = "<img src='{$this->image_path}/mmssrc.gif' alt='" . _XOOPS_FORM_ALTMMS . "' title='" . _XOOPS_FORM_ALTMMS . "' '" . "' onclick='xoopsCodeMms(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERMMSURL, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOH
function xoopsCodeMms(id,enterMmsPhrase, enterMmsHeightPhrase, enterMmsWidthPhrase)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mp3/mp3.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mp3/mp3.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/mp3/mp3.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -23,7 +23,8 @@
{
function encode($textarea_id)
{
- $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\"'/> ";
+ $code = "<img src='{$this->image_path}/mp3.gif' alt='" . _XOOPS_FORM_ALTMP3 . "' title='" . _XOOPS_FORM_ALTMP3 . "' '" . "' onclick='xoopsCodeMp3(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERMP3URL, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOF
function xoopsCodeMp3(id, enterMp3Phrase)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/rtsp/rtsp.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/rtsp/rtsp.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/rtsp/rtsp.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -24,7 +24,10 @@
function encode($textarea_id)
{
$config = parent::loadConfig(dirname(__FILE__));
- $code = "<img src='{$this->image_path}/rtspimg.gif' alt='" . _XOOPS_FORM_ALTRTSP . "' onclick='xoopsCodeRtsp(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERRTSPURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $code = "<img src='{$this->image_path}/rtspimg.gif' alt='" . _XOOPS_FORM_ALTRTSP . "' title='" . _XOOPS_FORM_ALTRTSP . "' '" . "' onclick='xoopsCodeRtsp(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERRTSPURL, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOH
function xoopsCodeRtsp(id,enterRtspPhrase, enterRtspHeightPhrase, enterRtspWidthPhrase)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wiki/wiki.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wiki/wiki.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wiki/wiki.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -27,7 +27,9 @@
function encode($textarea_id)
{
$config = parent::loadConfig(dirname(__FILE__));
- $code = "<img src='{$this->image_path}/wiki.gif' alt='" . _XOOPS_FORM_ALTWIKI . "' onclick='xoopsCodeWiki(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWIKITERM, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $code = "<img src='{$this->image_path}/wiki.gif' alt='" . _XOOPS_FORM_ALTWIKI
+ . "' title='" . _XOOPS_FORM_ALTWIKI . "' '"
+ . "' onclick='xoopsCodeWiki(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERWIKITERM, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOH
function xoopsCodeWiki(id, enterWikiPhrase)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wmp/wmp.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wmp/wmp.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/wmp/wmp.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -24,7 +24,10 @@
function encode($textarea_id)
{
$config = parent::loadConfig(dirname(__FILE__));
- $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\"'/> ";
+ $code = "<img src='{$this->image_path}/wmp.gif' alt='" . _XOOPS_FORM_ALTWMP . "' title='" . _XOOPS_FORM_ALTWMP . "' '" . "' onclick='xoopsCodeWmp(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERWMPURL, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOH
function xoopsCodeWmp(id, enterWmpPhrase, enterWmpHeightPhrase, enterWmpWidthPhrase)
{
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/youtube/youtube.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/youtube/youtube.php 2014-01-30 10:13:27 UTC (rev 12281)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/textsanitizer/youtube/youtube.php 2014-01-30 10:14:26 UTC (rev 12282)
@@ -23,7 +23,10 @@
function encode($textarea_id)
{
$config = parent::loadConfig( dirname(__FILE__) );
- $code = "<img src='{$this->image_path}/youtube.gif' alt='" . _XOOPS_FORM_ALTYOUTUBE . "' onclick='xoopsCodeYoutube(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERYOUTUBEURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
+ $code = "<img src='{$this->image_path}/youtube.gif' alt='" . _XOOPS_FORM_ALTYOUTUBE . "' title='" . _XOOPS_FORM_ALTYOUTUBE . "' '" . "' onclick='xoopsCodeYoutube(\"{$textarea_id}\",\""
+ . htmlspecialchars(_XOOPS_FORM_ENTERYOUTUBEURL, ENT_QUOTES) . "\",\""
+ . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES)
+ . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/> ";
$javascript = <<<EOH
function xoopsCodeYoutube(id, enterFlashPhrase, enterFlashHeightPhrase, enterFlashWidthPhrase)
{
|