provide a custom jsmart because friendica delimters diddn't work with the original

This commit is contained in:
rabuzarus 2016-05-05 18:39:15 +02:00
parent 75c76775a5
commit 462a942df2
2 changed files with 3520 additions and 41 deletions

File diff suppressed because it is too large Load diff

View file

@ -692,7 +692,11 @@
{
var params = getActualParamValues(node.params, data);
var a = params.from;
if (!(a instanceof Object))
if (typeof a == 'undefined')
{
a = [];
}
if (typeof a != 'object')
{
a = [a];
}
@ -1794,11 +1798,14 @@
{
s = s ? '1' : '';
}
if (s == null) {
s = '';
}
if (tree.length == 1)
{
return s;
}
res += s;
res += s!==null ? s : '';
if (data.smarty['continue'] || data.smarty['break'])
{
@ -2885,11 +2892,13 @@
aEncoded += address.substr(i,1);
}
}
aEncoded = aEncoded.toLowerCase();
var tEncoded = '';
for (var i=0; i<text.length; ++i)
{
tEncoded += '&#x' + jSmart.prototype.PHPJS('bin2hex','mailto').bin2hex(text.substr(i,1)) + ';';
}
tEncoded = tEncoded.toLowerCase();
return '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;' + aEncoded + '" ' + extra + '>' + tEncoded + '</a>';
}
return s;
@ -2941,6 +2950,8 @@
return '';
}
content = new String(content);
var wrap = params.__get('wrap',80);
var wrap_char = params.__get('wrap_char','\n');
var wrap_cut = params.__get('wrap_cut',false);
@ -2990,6 +3001,9 @@
'modifier',
'capitalize',
function(s, upDigits, lcRest) {
if (typeof s != 'string') {
return s;
}
var re = new RegExp(upDigits ? '[^a-zA-Z_\u00E0-\u00FC]+' : '[^a-zA-Z0-9_\u00E0-\u00FC]');
var found = null;
var res = '';
@ -3024,7 +3038,7 @@
function(s, value)
{
value = value ? value : '';
return s + value;
return new String(s) + value;
}
);
@ -3060,6 +3074,7 @@
'count_characters',
function(s, includeWhitespaces)
{
s = new String(s);
return includeWhitespaces ? s.length : s.replace(/\s/g,'').length;
}
);
@ -3069,7 +3084,7 @@
'count_paragraphs',
function(s)
{
var found = s.match(/\n+/g);
var found = (new String(s)).match(/\n+/g);
if (found)
{
return found.length+1;
@ -3082,12 +3097,15 @@
'modifier',
'count_sentences',
function(s)
{
if (typeof s == 'string')
{
var found = s.match(/[^\s]\.(?!\w)/g);
if (found)
{
return found.length;
}
}
return 0;
}
);
@ -3096,12 +3114,15 @@
'modifier',
'count_words',
function(s)
{
if (typeof s == 'string')
{
var found = s.match(/\w+/g);
if (found)
{
return found.length;
}
}
return 0;
}
);
@ -3139,7 +3160,7 @@
return s.replace(/&lt;/g, '<').replace(/&gt;/g,'>').replace(/&#039;/g,"'").replace(/&quot;/g,'"');
case 'entity':
case 'htmlall':
return jSmart.prototype.PHPJS('html_entity_decode','unescape').html_entity_decode(s, 0);
return jSmart.prototype.PHPJS('html_entity_decode','unescape').html_entity_decode(s, 1);
case 'url':
return jSmart.prototype.PHPJS('rawurldecode','unescape').rawurldecode(s);
};
@ -3176,13 +3197,13 @@
var res = '';
for (var i=0; i<s.length; ++i)
{
res += '%' + jSmart.prototype.PHPJS('bin2hex','escape').bin2hex(s.substr(i,1));
res += '%' + jSmart.prototype.PHPJS('bin2hex','escape').bin2hex(s.substr(i,1)).toLowerCase();
}
return res;
case 'hexentity':
var res = '';
for (var i=0; i<s.length; ++i) {
res += '&#x' + jSmart.prototype.PHPJS('bin2hex','escape').bin2hex(s.substr(i,1)).toLowerCase() + ';';
res += '&#x' + jSmart.prototype.PHPJS('bin2hex','escape').bin2hex(s.substr(i,1)) + ';';
}
return res;
case 'decentity':
@ -3218,6 +3239,7 @@
'indent',
function(s, repeat, indentWith)
{
s = new String(s);
repeat = repeat ? repeat : 4;
indentWith = indentWith ? indentWith : ' ';
@ -3237,7 +3259,7 @@
'lower',
function(s)
{
return s.toLowerCase();
return new String(s).toLowerCase();
}
);
@ -3246,7 +3268,7 @@
'nl2br',
function(s)
{
return s.replace(/\n/g,'<br />\n');
return new String(s).replace(/\n/g,'<br />\n');
}
);
@ -3297,7 +3319,7 @@
{
space = ' ';
}
return s.replace(/(\n|.)(?!$)/g,'$1'+space);
return (new String(s)).replace(/(\n|.)(?!$)/g,'$1'+space);
}
);
@ -3344,6 +3366,7 @@
'truncate',
function(s, length, etc, breakWords, middle)
{
s = new String(s);
length = length ? length : 80;
etc = (etc!=null) ? etc : '...';
@ -3373,7 +3396,7 @@
'upper',
function(s)
{
return s.toUpperCase();
return (new String(s)).toUpperCase();
}
);
@ -3385,7 +3408,7 @@
width = width || 80;
wrapWith = wrapWith || '\n';
var lines = s.split('\n');
var lines = (new String(s)).split('\n');
for (var i=0; i<lines.length; ++i)
{
var line = lines[i];