// Remove private tags if the user is not logged in.
if (! $this->_loggedIn) {
- $link['tags'] = preg_replace('/(^|\s*)\.[^($| )]+\s*$/', '', $link['tags']);
+ $link['tags'] = preg_replace('/(^|\s+)\.[^($|\s)]+\s*/', ' ', $link['tags']);
}
// Do not use the redirector for internal links (Shaarli note URL starting with a '?').
'-exclude' => 1,
'.hidden' => 1,
'hashtag' => 2,
+ 'tag1' => 1,
+ 'tag2' => 1,
+ 'tag3' => 1,
+ 'tag4' => 1,
),
self::$privateLinkDB->allTags()
);
{
self::$publicLinkDB->filterHash('');
}
-
- /**
- * test whitespace handling in tags.
- * split on whitespace runs and don't allow empty tags.
- */
- public function testReadTagsWithWhitespace()
- {
- // test load contains "tags": " tag1 tag2 tag3 tag4 "
- $ds = '<?php /* ';
- $ds .= 'fY5BDoMwDAS/gvwB4hRKMY9BEaASNQKUuL1U/L22D721Odheez';
- $ds .= 'baQEjvQtgSeIdX12I/onfyYAjU6e1GkOL2mAMvMPxAC8mWIydD';
- $ds .= 'enHsU0jrXlj1heCZk5k7gpX5oLr+ErUdkGBeypTjwXHfdOUItD';
- $ds .= 'XycbgXHb24KxFYafWVtYvVRoQiQhw5vixrJDdY/LyENP5PcJ4f */ ?>';
- file_put_contents(self::$testDatastore, $ds);
- self::$publicLinkDB = new LinkDB(self::$testDatastore, false, false);
-
- $this->assertEquals(
- array(
- 'tag1' => 1,
- 'tag2' => 1,
- 'tag3' => 1,
- 'tag4' => 1
- ),
- self::$publicLinkDB->allTags()
- );
- }
}