diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index ab2ed9ee0..1317c6e61 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -1506,7 +1506,6 @@ class e_parse
break;
case 'table' : // strip
from inside of
-
$convertNL = false;
// break;
@@ -2665,7 +2664,7 @@ class e_parse
* @return string
* @see e107.htaccess
*/
- private function thumbUrlSEF($url = '', $options = array())
+ public function thumbUrlSEF($url = '', $options = array())
{
if(!empty($options['full']))
@@ -2713,6 +2712,14 @@ class e_parse
// Build URL for ReWriteRule ^media\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)?$ thumb.php?src=e_MEDIA_IMAGE/$5&$1w=$2&$3h=$4
$sefUrl = $base . $sefPath;
+ if(!empty($options['scale']))
+ {
+ $multiInt = (int) $options['scale'];
+ $options['w'] = $options['w'] * $multiInt;
+ $options['h'] = $options['h'] * $multiInt;
+ }
+
+
if(!empty($options['aw']) || !empty($options['ah']))
{
$sefUrl .= 'a' . intval($options['aw']) . 'xa' . intval($options['ah']);
@@ -4493,10 +4500,13 @@ class e_parse
$autoplay = !empty($parm['autoplay']) ? 'autoplay ' : '';
$controls = !empty($parm['controls']) ? 'controls' : '';
- $text = '';
+ $text = '';
return $text;
diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php
index 949d48f82..b79d51d6b 100644
--- a/e107_tests/tests/unit/e_parseTest.php
+++ b/e107_tests/tests/unit/e_parseTest.php
@@ -353,6 +353,10 @@ while($row = $sql->fetch())
'text' => '[php] "",
),
+ 3 => array(
+ 'text' => "[table][tr]\n[td]cell[/td]\n[/tr][/table]",
+ 'expected' => "",
+ ),
);
@@ -521,9 +525,26 @@ while($row = $sql->fetch())
}
-/*
+
public function testToNumber()
{
+ $result = $this->tp->toNumber('v2a');
+ $this->assertEquals('2', $result);
+
+ $result = $this->tp->toNumber('v1.5');
+ $this->assertEquals('1.5', $result);
+
+
+ $result = $this->tp->toNumber('v3.5');
+ $this->assertEquals('3.5', $result);
+ }
+/*
+ public function testthumbUrlSEF()
+ {
+ // $this->tp->thumbUrlSEF($url);
+
+
+
}
*/
@@ -959,6 +980,9 @@ while($row = $sql->fetch())
$this->assertTrue($valid);
}
+
+
+
}
private function isValidXML($xmlContent)
@@ -1031,6 +1055,52 @@ while($row = $sql->fetch())
}
+ }
+
+ public function testThumbUrlSEF()
+ {
+ $urls = array(
+ 0 => array(
+ 'path' => '{e_MEDIA_IMAGE}butterfly.jpg',
+ 'options' => array('w'=>300, 'h'=>200),
+ 'expected' =>'/media/img/300x200/butterfly.jpg'
+ ),
+ 1 => array(
+ 'path' => '{e_THEME}dummy/Freesample.svg',
+ 'options' => array('w'=>300, 'h'=>200),
+ 'expected' =>'/theme/img/300x200/dummy/Freesample.svg'
+ ),
+ 2 => array(
+ 'path' => '{e_AVATAR}avatar.jpg',
+ 'options' => array('w'=>100, 'h'=>100),
+ 'expected' =>'/media/avatar/100x100/avatar.jpg'
+ ),
+
+ /*2 => array(
+ 'path' => '{e_MEDIA_IMAGE}gallery/images/butterfly.jpg',
+ 'options' => array('w'=>300, 'h'=>200, 'type'=>'webp'),
+ 'expected' =>'/media/img/300x200/gallery/images/butterfly.webp'
+ ),*/
+ 3 => array(
+ 'path' => '{e_MEDIA_IMAGE}gallery/images/butterfly.jpg',
+ 'options' => array('w'=>300, 'h'=>200, 'scale'=>'2x'),
+ 'expected' =>'/media/img/600x400/gallery/images/butterfly.jpg'
+ ),
+
+ );
+
+ foreach($urls as $val)
+ {
+ $actual = $this->tp->thumbUrlSEF($val['path'],$val['options']);
+ $this->assertStringContainsString($val['expected'], $actual);
+ //echo $$actual."\n\n";
+ }
+
+
+
+
+
+
}
/*
public function testParseBBCodes()
@@ -2101,12 +2171,26 @@ while($row = $sql->fetch())
{
}
-
+*/
public function testIsImage()
{
+ $this->assertTrue($this->tp->isImage('/path-to-file/myfile.jpg'));
+ $this->assertFalse($this->tp->isImage('/path-to-file/myfile.mov'));
}
+ public function testtoAudio()
+ {
+ $expected = '';
+
+ $result = $this->tp->toAudio('{e_MEDIA}myfile.mp3');
+ $this->assertEquals($expected, $result);
+
+ }
+/*
public function testToVideo()
{