aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-02-05 16:28:51 -0800
committerfriendica <info@friendica.com>2014-02-05 16:28:51 -0800
commit1b406be544a2e434b56eed26bab14ede63fe2104 (patch)
tree21de2774fcc1eab2509a9f2b9e950d911e5f9718
parentda8a79ebfa948bc5f2f300404f661e71fdde788d (diff)
downloadvolse-hubzilla-1b406be544a2e434b56eed26bab14ede63fe2104.tar.gz
volse-hubzilla-1b406be544a2e434b56eed26bab14ede63fe2104.tar.bz2
volse-hubzilla-1b406be544a2e434b56eed26bab14ede63fe2104.zip
allow bookmarks to use richtext
-rw-r--r--include/menu.php5
-rw-r--r--library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js2
-rw-r--r--library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js2
3 files changed, 6 insertions, 3 deletions
diff --git a/include/menu.php b/include/menu.php
index 105e4216b..813d7bcdb 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -1,6 +1,7 @@
<?php /** @file */
require_once('include/security.php');
+require_once('include/bbcode.php');
function menu_fetch($name,$uid,$observer_xchan) {
@@ -27,11 +28,13 @@ function menu_render($menu) {
if(! $menu)
return '';
- for($x = 0; $x < count($menu['items']); $x ++)
+ for($x = 0; $x < count($menu['items']); $x ++) {
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID)
$menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']);
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN)
$menu['items'][$x]['newwin'] = '1';
+ $menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']);
+ }
return replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $menu['menu'],
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js
index 81b69e736..80e10d833 100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e,t){var n=this,r=e.getParam("bbcode_dialect","dfrn").toLowerCase();e.onBeforeSetContent.add(function(e,t){t.content=n["_"+r+"_bbcode2html"](t.content)});e.onPostProcess.add(function(e,t){if(t.set)t.content=n["_"+r+"_bbcode2html"](t.content);if(t.get)t.content=n["_"+r+"_html2bbcode"](t.content)})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_dfrn_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}function n(e){var t,n,r=[],i=[];var s=/<span [^>]*class *= *[\"'](?:[^\"']* )*oembed(?: [^\"']*)*[\"'][^>]*>(.*?(?:<span[^>]*>(.*?)<\/span *>)*.*?)<\/span *>/ig;while(t=s.exec(e)){var o=/<a([^>]* rel=[\"']oembed[\"'][^>]*)>.*?<\/a *>/ig;if(n=o.exec(t[1])){var u=/href=[\"']([^\"']*)[\"']/ig;var a=u.exec(n[1]);if(a[1]){r.push(t[0]);i.push("[EMBED]"+a[1]+"[/EMBED]")}}}for(var f=0;f<r.length;f++)e=e.replace(r[f],i[f]);return e}e=tinymce.trim(e);if(e.indexOf('class="oembed')>=0){e=n(e)}t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");t(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");t(/<font>(.*?)<\/font>/gi,"$1");t(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");t(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");t(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");t(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");t(/<ul class=\"listbullet\" style=\"list-style-type\: circle\;\">(.*?)<\/ul>/gi,"[list]$1[/list]");t(/<ul class=\"listnone\" style=\"list-style-type\: none\;\">(.*?)<\/ul>/gi,"[list=]$1[/list]");t(/<ul class=\"listdecimal\" style=\"list-style-type\: decimal\;\">(.*?)<\/ul>/gi,"[list=1]$1[/list]");t(/<ul class=\"listlowerroman\" style=\"list-style-type\: lower-roman\;\">(.*?)<\/ul>/gi,"[list=i]$1[/list]");t(/<ul class=\"listupperroman\" style=\"list-style-type\: upper-roman\;\">(.*?)<\/ul>/gi,"[list=I]$1[/list]");t(/<ul class=\"listloweralpha\" style=\"list-style-type\: lower-alpha\;\">(.*?)<\/ul>/gi,"[list=a]$1[/list]");t(/<ul class=\"listupperalpha\" style=\"list-style-type\: upper-alpha\;\">(.*?)<\/ul>/gi,"[list=A]$1[/list]");t(/<li>(.*?)<\/li>/gi,"[li]$1[/li]");t(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");t(/<\/(strong|b)>/gi,"[/b]");t(/<(strong|b)>/gi,"[b]");t(/<\/(em|i)>/gi,"[/i]");t(/<(em|i)>/gi,"[i]");t(/<\/u>/gi,"[/u]");t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");t(/<u>/gi,"[u]");t(/<blockquote[^>]*>/gi,"[quote]");t(/<\/blockquote>/gi,"[/quote]");t(/<hr \/>/gi,"[hr]");t(/<br (.*?)\/>/gi,"\n");t(/<br\/>/gi,"\n");t(/<br>/gi,"\n");t(/<p>/gi,"");t(/<\/p>/gi,"\n");t(/&nbsp;/gi," ");t(/&quot;/gi,'"');t(/&lt;/gi,"<");t(/&gt;/gi,">");t(/&/gi,"&");return e},_dfrn_bbcode2html:function(e){function t(t,n){var r=new Array;var i=e.split("[code]");var o=0;var u="";u=i.shift();u=u.replace(t,n);r.push(u);for(o=0;o<i.length;o++){var a=new Array;var f=i.shift();var l=f.split("[/code]");a.push(l.shift());u=l.shift();u=u.replace(t,n);a.push(u);r.push(a.join("[/code]"))}e=r.join("[code]")}function n(e,t){function n(t){e=t}t=bin2hex(t);$.ajax({url:"oembed/b2h?url="+t,async:false,success:n,dataType:"html"});return e}e=tinymce.trim(e);t(/\n/gi,"<br />");t(/\[b\]/gi,"<strong>");t(/\[\/b\]/gi,"</strong>");t(/\[i\]/gi,"<em>");t(/\[\/i\]/gi,"</em>");t(/\[u\]/gi,"<u>");t(/\[\/u\]/gi,"</u>");t(/\[hr\]/gi,"<hr />");t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');t(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,'<img width="$1" height="$2" src="$3" />');t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');t(/\[list\](.*?)\[\/list\]/gi,'<ul class="listbullet" style="list-style-type: circle;">$1</ul>');t(/\[list=\](.*?)\[\/list\]/gi,'<ul class="listnone" style="list-style-type: none;">$1</ul>');t(/\[list=1\](.*?)\[\/list\]/gi,'<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>');t(/\[list=i\](.*?)\[\/list\]/gi,'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>');t(/\[list=I\](.*?)\[\/list\]/gi,'<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>');t(/\[list=a\](.*?)\[\/list\]/gi,'<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>');t(/\[list=A\](.*?)\[\/list\]/gi,'<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>');t(/\[li\](.*?)\[\/li\]/gi,"<li>$1</li>");t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<span style="color: $1;">$2</span>');t(/\[size=(.*?)\](.*?)\[\/size\]/gi,'<span style="font-size: $1;">$2</span>');t(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");t(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");e=e.replace(/\[embed\](.*?)\[\/embed\]/gi,n);return e}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})()
+(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e,t){var n=this,r=e.getParam("bbcode_dialect","dfrn").toLowerCase();e.onBeforeSetContent.add(function(e,t){t.content=n["_"+r+"_bbcode2html"](t.content)});e.onPostProcess.add(function(e,t){if(t.set)t.content=n["_"+r+"_bbcode2html"](t.content);if(t.get)t.content=n["_"+r+"_html2bbcode"](t.content)})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_dfrn_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}function n(e){var t,n,r=[],i=[];var s=/<span [^>]*class *= *[\"'](?:[^\"']* )*oembed(?: [^\"']*)*[\"'][^>]*>(.*?(?:<span[^>]*>(.*?)<\/span *>)*.*?)<\/span *>/ig;while(t=s.exec(e)){var o=/<a([^>]* rel=[\"']oembed[\"'][^>]*)>.*?<\/a *>/ig;if(n=o.exec(t[1])){var u=/href=[\"']([^\"']*)[\"']/ig;var a=u.exec(n[1]);if(a[1]){r.push(t[0]);i.push("[EMBED]"+a[1]+"[/EMBED]")}}}for(var f=0;f<r.length;f++)e=e.replace(r[f],i[f]);return e}e=tinymce.trim(e);if(e.indexOf('class="oembed')>=0){e=n(e)}t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"#^[url=$1]$2[/url]");t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");t(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");t(/<font>(.*?)<\/font>/gi,"$1");t(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");t(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");t(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");t(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");t(/<ul class=\"listbullet\" style=\"list-style-type\: circle\;\">(.*?)<\/ul>/gi,"[list]$1[/list]");t(/<ul class=\"listnone\" style=\"list-style-type\: none\;\">(.*?)<\/ul>/gi,"[list=]$1[/list]");t(/<ul class=\"listdecimal\" style=\"list-style-type\: decimal\;\">(.*?)<\/ul>/gi,"[list=1]$1[/list]");t(/<ul class=\"listlowerroman\" style=\"list-style-type\: lower-roman\;\">(.*?)<\/ul>/gi,"[list=i]$1[/list]");t(/<ul class=\"listupperroman\" style=\"list-style-type\: upper-roman\;\">(.*?)<\/ul>/gi,"[list=I]$1[/list]");t(/<ul class=\"listloweralpha\" style=\"list-style-type\: lower-alpha\;\">(.*?)<\/ul>/gi,"[list=a]$1[/list]");t(/<ul class=\"listupperalpha\" style=\"list-style-type\: upper-alpha\;\">(.*?)<\/ul>/gi,"[list=A]$1[/list]");t(/<li>(.*?)<\/li>/gi,"[li]$1[/li]");t(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");t(/<\/(strong|b)>/gi,"[/b]");t(/<(strong|b)>/gi,"[b]");t(/<\/(em|i)>/gi,"[/i]");t(/<(em|i)>/gi,"[i]");t(/<\/u>/gi,"[/u]");t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");t(/<u>/gi,"[u]");t(/<blockquote[^>]*>/gi,"[quote]");t(/<\/blockquote>/gi,"[/quote]");t(/<hr \/>/gi,"[hr]");t(/<br (.*?)\/>/gi,"\n");t(/<br\/>/gi,"\n");t(/<br>/gi,"\n");t(/<p>/gi,"");t(/<\/p>/gi,"\n");t(/&nbsp;/gi," ");t(/&quot;/gi,'"');t(/&lt;/gi,"<");t(/&gt;/gi,">");t(/&/gi,"&");return e},_dfrn_bbcode2html:function(e){function t(t,n){var r=new Array;var i=e.split("[code]");var o=0;var u="";u=i.shift();u=u.replace(t,n);r.push(u);for(o=0;o<i.length;o++){var a=new Array;var f=i.shift();var l=f.split("[/code]");a.push(l.shift());u=l.shift();u=u.replace(t,n);a.push(u);r.push(a.join("[/code]"))}e=r.join("[code]")}function n(e,t){function n(t){e=t}t=bin2hex(t);$.ajax({url:"oembed/b2h?url="+t,async:false,success:n,dataType:"html"});return e}e=tinymce.trim(e);t(/\n/gi,"<br />");t(/\[b\]/gi,"<strong>");t(/\[\/b\]/gi,"</strong>");t(/\[i\]/gi,"<em>");t(/\[\/i\]/gi,"</em>");t(/\[u\]/gi,"<u>");t(/\[\/u\]/gi,"</u>");t(/\[hr\]/gi,"<hr />");t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');t(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,'<img width="$1" height="$2" src="$3" />');t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');t(/\[list\](.*?)\[\/list\]/gi,'<ul class="listbullet" style="list-style-type: circle;">$1</ul>');t(/\[list=\](.*?)\[\/list\]/gi,'<ul class="listnone" style="list-style-type: none;">$1</ul>');t(/\[list=1\](.*?)\[\/list\]/gi,'<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>');t(/\[list=i\](.*?)\[\/list\]/gi,'<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>');t(/\[list=I\](.*?)\[\/list\]/gi,'<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>');t(/\[list=a\](.*?)\[\/list\]/gi,'<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>');t(/\[list=A\](.*?)\[\/list\]/gi,'<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>');t(/\[li\](.*?)\[\/li\]/gi,"<li>$1</li>");t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<span style="color: $1;">$2</span>');t(/\[size=(.*?)\](.*?)\[\/size\]/gi,'<span style="font-size: $1;">$2</span>');t(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");t(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");e=e.replace(/\[embed\](.*?)\[\/embed\]/gi,n);return e}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})()
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
index 387ccdd59..4606845b4 100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -75,7 +75,7 @@
// example: <strong> to [b]
- rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
+ rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"#^[url=$1]$2[/url]");
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
rep(/<font>(.*?)<\/font>/gi,"$1");