mirror of
https://github.com/e107inc/e107.git
synced 2025-08-12 01:25:01 +02:00
Fixes #4700 - linkwords inconsistencies.
This commit is contained in:
@@ -21,9 +21,10 @@
|
||||
try
|
||||
{
|
||||
$this->lw = $this->make('linkwords_parse');
|
||||
} catch(Exception $e)
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, "Couldn't load e_tohtml_linkwords object");
|
||||
$this->fail("Couldn't load e_tohtml_linkwords object");
|
||||
}
|
||||
|
||||
$words = array(
|
||||
@@ -31,11 +32,14 @@
|
||||
1 => array('word'=> 'contact form', 'link'=>'/contact.php', 'ext'=>'', 'tip'=>'Click here', 'limit'=> '5'),
|
||||
2 => array('word'=> 'fill out this form', 'link'=>'', 'ext'=>'', 'tip'=>'My Tip', 'limit'=>'5'),
|
||||
3 => array('word'=> '', 'link'=>'', 'ext'=>'', 'tip'=>'', 'limit'=>'3'),
|
||||
4 => array('word'=> "John's place", 'link'=>'/my-link', 'ext'=>'', 'tip'=>'', 'limit'=>'3'), // test single quote as encoded in
|
||||
5 => array('word'=> "link", 'link'=>'/page-link', 'ext'=>'', 'tip'=>'', 'limit'=>'3'), // test single quote as encoded in
|
||||
6 => array('word'=> "body only", 'link'=>'/body-link', 'ext'=>'', 'tip'=>'', 'limit'=>'3'), // test single quote as encoded in
|
||||
|
||||
);
|
||||
|
||||
$opts = array ('BODY' => '1', 'DESCRIPTION' => '1');
|
||||
|
||||
$this->lw->cache(false);
|
||||
$this->lw->enable();
|
||||
$this->lw->setWordData($words);
|
||||
$this->lw->setAreaOpts($opts);
|
||||
@@ -61,6 +65,23 @@
|
||||
'expected' => '<p>To know more <span class="lw-tip lw-1" title="My Tip" >fill out this form</span> right away.</p>',
|
||||
),
|
||||
|
||||
3 => array(
|
||||
'text' => "<p>Visit John's place.</p>",
|
||||
'expected' => "<p>Visit <a class=\"lw-link lw-1\" href=\"/my-link\" >John's place</a>.</p>",
|
||||
),
|
||||
|
||||
// avoid placing links within existing links.
|
||||
4 => array(
|
||||
'text' => "<a href=''>link</a>link",
|
||||
'expected' => "<a href=''>link</a><a class=\"lw-link lw-1\" href=\"/page-link\" >link</a>",
|
||||
),
|
||||
|
||||
// Titles should be ignored within a body context.
|
||||
5 => array(
|
||||
'text' => "<h3>Body only title</h3><p>body only text</p>",
|
||||
'expected' => "<h3>Body only title</h3><p><a class=\"lw-link lw-1\" href=\"/body-link\" >body only</a> text</p>",
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
foreach($tests as $val)
|
||||
|
Reference in New Issue
Block a user