mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
This commit is contained in:
@@ -763,14 +763,13 @@ class e_bbcode
|
||||
|
||||
if(strpos($qr['src'],'http')!==0 && empty($qr['w']) && empty($qr['aw']))
|
||||
{
|
||||
$qr['w'] = $img['width'];
|
||||
$qr['h'] = $img['height'];
|
||||
$qr['w'] = varset($img['width']);
|
||||
$qr['h'] = varset($img['height']);
|
||||
}
|
||||
|
||||
$qr['ebase'] = true;
|
||||
|
||||
|
||||
|
||||
if(!empty($img['class']))
|
||||
{
|
||||
$tmp = explode(" ",$img['class']);
|
||||
@@ -797,7 +796,7 @@ class e_bbcode
|
||||
|
||||
}
|
||||
|
||||
if($this->resizeWidth() === (int) $img['width'])
|
||||
if($this->resizeWidth() === (int) varset($img['width']))
|
||||
{
|
||||
unset($img['width']);
|
||||
}
|
||||
|
@@ -183,10 +183,12 @@ TEMPL;
|
||||
exit;
|
||||
}
|
||||
|
||||
$content = html_entity_decode($content);
|
||||
$text = !empty($content) ? "[html]".$content."[/html]" : ''; // Add the tags before saving to DB.
|
||||
}
|
||||
else // User doesn't have HTML access - bbcode Mode.
|
||||
{
|
||||
$content = html_entity_decode($content);
|
||||
$text = e107::getBB()->htmltoBBcode($content); // not reliable enough yet.
|
||||
}
|
||||
|
||||
|
@@ -202,8 +202,12 @@
|
||||
_e107_html2bbcode : function(s, url) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
// return s;
|
||||
|
||||
if(s === '')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
// console.log('html2bbcode '+ s);
|
||||
|
||||
var p = $.ajax({
|
||||
type: "POST",
|
||||
url: url + "/parser.php",
|
||||
@@ -228,9 +232,13 @@
|
||||
_e107_bbcode2html : function(s, url) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
// FIXME mod-security might block the ajax call below with Rules: 942230, 949110, 980130 - reason yet unknown.
|
||||
if(s === '')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// return s;
|
||||
// FIXME mod-security might block the ajax call below with Rules: 942230, 949110, 980130 - reason yet unknown.
|
||||
// console.log('bbcode2html '+ s);
|
||||
|
||||
var p = $.ajax({
|
||||
type: "POST",
|
||||
|
@@ -79,12 +79,35 @@
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
public function testImgToBBcode()
|
||||
{
|
||||
|
||||
}
|
||||
$tests = [
|
||||
0 => [
|
||||
'html' => '<p><img class="img-rounded rounded bbcode bbcode-img" src="/e107v2/thumb.php?src=e_MEDIA_IMAGE%2F2021-10%2Ftest.jpg&w=0&h=0" alt="test" title="test"></p>',
|
||||
'expected' =>'<p>[img title=test]{e_MEDIA_IMAGE}2021-10/test.jpg[/img]</p>'
|
||||
],
|
||||
|
||||
/* 1 => [
|
||||
'html' => '<p><img class="img-rounded rounded bbcode bbcode-img" src="/e107v2/thumb.php?src=e_MEDIA_IMAGE%2F2021-10%2Ftest.jpg&w=0&h=0" alt="test" title="test"></p>',
|
||||
'expected' =>'<p>[img title=test]{e_MEDIA_IMAGE}2021-10/test.jpg[/img]</p>'
|
||||
],*/
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
foreach($tests as $count => $t)
|
||||
{
|
||||
$actual = $this->bb->imgToBBcode($t['html']);
|
||||
$this->assertSame($t['expected'], $actual, 'Test '.$count.' failed');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
public function testResizeHeight()
|
||||
{
|
||||
|
||||
|
@@ -120,8 +120,15 @@ Plain text paragraph 3<br />';
|
||||
$this->assertEquals($expected_2, $actual_2);
|
||||
|
||||
|
||||
$test_3 = "<p>Nikdy nehovor, že niečo nejde, pretože sa vždy nájde blbec, čo to urobí.</p>";
|
||||
$actual_3 = $this->tm->toDB($test_3);
|
||||
$expected_3 = "[html]<p>Nikdy nehovor, že niečo nejde, pretože sa vždy nájde blbec, čo to urobí.</p>[/html]";
|
||||
$this->assertEquals($expected_3, $actual_3);
|
||||
|
||||
|
||||
$result3 = $this->tm->toHTML($actual_3);
|
||||
$this->assertEquals($test_3, $result3);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,14 +220,14 @@ Plain text paragraph 3<br />';
|
||||
{ORDER_DATA: cust_firstname} {ORDER_DATA: cust_lastname}<br />
|
||||
{ORDER_DATA: cust_company}<br />
|
||||
{ORDER_DATA: cust_address}<br />
|
||||
{ORDER_DATA: cust_city} {ORDER_DATA: cust_state} {ORDER_DATA: cust_zip}<br />
|
||||
{ORDER_DATA: cust_city} {ORDER_DATA: cust_state} {ORDER_DATA: cust_zip}<br />
|
||||
{ORDER_DATA: cust_country}
|
||||
<br />
|
||||
<h4>Shipping address</h4>
|
||||
{ORDER_DATA: ship_firstname} {ORDER_DATA: ship_lastname}<br />
|
||||
{ORDER_DATA: ship_company}<br />
|
||||
{ORDER_DATA: ship_address}<br />
|
||||
{ORDER_DATA: ship_city} {ORDER_DATA: ship_state} {ORDER_DATA: ship_zip}<br />
|
||||
{ORDER_DATA: ship_city} {ORDER_DATA: ship_state} {ORDER_DATA: ship_zip}<br />
|
||||
{ORDER_DATA: ship_country}
|
||||
</td>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user