diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | application/LinkDB.php | 11 | ||||
-rw-r--r-- | application/Url.php | 1 | ||||
-rw-r--r-- | composer.json | 12 | ||||
-rw-r--r-- | plugins/markdown/markdown.php | 19 | ||||
-rw-r--r-- | tests/FeedBuilderTest.php | 2 | ||||
-rw-r--r-- | tests/LinkDBTest.php | 6 | ||||
-rw-r--r-- | tests/Url/UrlTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginMarkdownTest.php | 6 | ||||
-rw-r--r-- | tests/utils/ReferenceLinkDB.php | 2 | ||||
-rw-r--r-- | tpl/tools.html | 2 |
11 files changed, 48 insertions, 15 deletions
@@ -26,6 +26,7 @@ Login: `demo`; Password: `demo` | |||
26 | 26 | ||
27 | ### Installation & upgrade | 27 | ### Installation & upgrade |
28 | - [Download](https://github.com/shaarli/Shaarli/wiki/Download) | 28 | - [Download](https://github.com/shaarli/Shaarli/wiki/Download) |
29 | - [Upgrade and migration](https://github.com/shaarli/Shaarli/wiki/Upgrade-and-migration) | ||
29 | - [Server requirements](https://github.com/shaarli/Shaarli/wiki/Server-requirements) | 30 | - [Server requirements](https://github.com/shaarli/Shaarli/wiki/Server-requirements) |
30 | - [Server configuration](https://github.com/shaarli/Shaarli/wiki/Server-configuration) | 31 | - [Server configuration](https://github.com/shaarli/Shaarli/wiki/Server-configuration) |
31 | - [Shaarli configuration](https://github.com/shaarli/Shaarli/wiki/Shaarli-configuration) | 32 | - [Shaarli configuration](https://github.com/shaarli/Shaarli/wiki/Shaarli-configuration) |
diff --git a/application/LinkDB.php b/application/LinkDB.php index 1cb70de0..b1072e07 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -440,11 +440,18 @@ You use the community supported version of the original Shaarli project, by Seba | |||
440 | public function allTags() | 440 | public function allTags() |
441 | { | 441 | { |
442 | $tags = array(); | 442 | $tags = array(); |
443 | $caseMapping = array(); | ||
443 | foreach ($this->_links as $link) { | 444 | foreach ($this->_links as $link) { |
444 | foreach (explode(' ', $link['tags']) as $tag) { | 445 | foreach (explode(' ', $link['tags']) as $tag) { |
445 | if (!empty($tag)) { | 446 | if (empty($tag)) { |
446 | $tags[$tag] = (empty($tags[$tag]) ? 1 : $tags[$tag] + 1); | 447 | continue; |
447 | } | 448 | } |
449 | // The first case found will be displayed. | ||
450 | if (!isset($caseMapping[strtolower($tag)])) { | ||
451 | $caseMapping[strtolower($tag)] = $tag; | ||
452 | $tags[$caseMapping[strtolower($tag)]] = 0; | ||
453 | } | ||
454 | $tags[$caseMapping[strtolower($tag)]]++; | ||
448 | } | 455 | } |
449 | } | 456 | } |
450 | // Sort tags by usage (most used tag first) | 457 | // Sort tags by usage (most used tag first) |
diff --git a/application/Url.php b/application/Url.php index 77447c8d..c166ff6e 100644 --- a/application/Url.php +++ b/application/Url.php | |||
@@ -99,6 +99,7 @@ class Url | |||
99 | 'action_type_map=', | 99 | 'action_type_map=', |
100 | 'fb_', | 100 | 'fb_', |
101 | 'fb=', | 101 | 'fb=', |
102 | 'PHPSESSID=', | ||
102 | 103 | ||
103 | // Scoop.it | 104 | // Scoop.it |
104 | '__scoop', | 105 | '__scoop', |
diff --git a/composer.json b/composer.json index 2ded0920..e419dc11 100644 --- a/composer.json +++ b/composer.json | |||
@@ -1,11 +1,17 @@ | |||
1 | { | 1 | { |
2 | "name": "shaarli/shaarli", | 2 | "name": "shaarli/shaarli", |
3 | "description": "The personal, minimalist, super-fast, no-database delicious clone", | 3 | "description": "The personal, minimalist, super-fast, database-free bookmarking service", |
4 | "type": "project", | ||
4 | "license": "MIT", | 5 | "license": "MIT", |
6 | "homepage": "https://github.com/shaarli/Shaarli", | ||
5 | "support": { | 7 | "support": { |
6 | "issues": "https://github.com/shaarli/Shaarli/issues" | 8 | "issues": "https://github.com/shaarli/Shaarli/issues", |
9 | "wiki": "https://github.com/shaarli/Shaarli/wiki" | ||
10 | }, | ||
11 | "keywords": ["bookmark", "link", "share", "web"], | ||
12 | "require": { | ||
13 | "php": ">=5.3.4" | ||
7 | }, | 14 | }, |
8 | "require": {}, | ||
9 | "require-dev": { | 15 | "require-dev": { |
10 | "phpmd/phpmd" : "@stable", | 16 | "phpmd/phpmd" : "@stable", |
11 | "phpunit/phpunit": "4.8.*", | 17 | "phpunit/phpunit": "4.8.*", |
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 57fcce32..5f56ecc2 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -10,9 +10,8 @@ require_once 'Parsedown.php'; | |||
10 | 10 | ||
11 | /* | 11 | /* |
12 | * If this tag is used on a shaare, the description won't be processed by Parsedown. | 12 | * If this tag is used on a shaare, the description won't be processed by Parsedown. |
13 | * Using a private tag so it won't appear for visitors. | ||
14 | */ | 13 | */ |
15 | define('NO_MD_TAG', '.nomarkdown'); | 14 | define('NO_MD_TAG', 'nomarkdown'); |
16 | 15 | ||
17 | /** | 16 | /** |
18 | * Parse linklist descriptions. | 17 | * Parse linklist descriptions. |
@@ -25,11 +24,11 @@ function hook_markdown_render_linklist($data) | |||
25 | { | 24 | { |
26 | foreach ($data['links'] as &$value) { | 25 | foreach ($data['links'] as &$value) { |
27 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 26 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
27 | $value['taglist'] = stripNoMarkdownTag($value['taglist']); | ||
28 | continue; | 28 | continue; |
29 | } | 29 | } |
30 | $value['description'] = process_markdown($value['description']); | 30 | $value['description'] = process_markdown($value['description']); |
31 | } | 31 | } |
32 | |||
33 | return $data; | 32 | return $data; |
34 | } | 33 | } |
35 | 34 | ||
@@ -44,6 +43,7 @@ function hook_markdown_render_feed($data) | |||
44 | { | 43 | { |
45 | foreach ($data['links'] as &$value) { | 44 | foreach ($data['links'] as &$value) { |
46 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 45 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
46 | $value['tags'] = stripNoMarkdownTag($value['tags']); | ||
47 | continue; | 47 | continue; |
48 | } | 48 | } |
49 | $value['description'] = process_markdown($value['description']); | 49 | $value['description'] = process_markdown($value['description']); |
@@ -87,6 +87,19 @@ function noMarkdownTag($tags) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Remove the no-markdown meta tag so it won't be displayed. | ||
91 | * | ||
92 | * @param string $tags Tag list. | ||
93 | * | ||
94 | * @return string tag list without no markdown tag. | ||
95 | */ | ||
96 | function stripNoMarkdownTag($tags) | ||
97 | { | ||
98 | unset($tags[array_search(NO_MD_TAG, $tags)]); | ||
99 | return array_values($tags); | ||
100 | } | ||
101 | |||
102 | /** | ||
90 | * When link list is displayed, include markdown CSS. | 103 | * When link list is displayed, include markdown CSS. |
91 | * | 104 | * |
92 | * @param array $data includes data. | 105 | * @param array $data includes data. |
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index a4d6960c..460fb0c5 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php | |||
@@ -93,7 +93,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
93 | $this->assertContains('Permalink', $link['description']); | 93 | $this->assertContains('Permalink', $link['description']); |
94 | $this->assertContains('http://host.tld/?WDWyig', $link['description']); | 94 | $this->assertContains('http://host.tld/?WDWyig', $link['description']); |
95 | $this->assertEquals(1, count($link['taglist'])); | 95 | $this->assertEquals(1, count($link['taglist'])); |
96 | $this->assertEquals('stuff', $link['taglist'][0]); | 96 | $this->assertEquals('sTuff', $link['taglist'][0]); |
97 | 97 | ||
98 | // Test URL with external link. | 98 | // Test URL with external link. |
99 | $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $data['links']['20150310_114633']['url']); | 99 | $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $data['links']['20150310_114633']['url']); |
diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 956be3b4..9c64188f 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php | |||
@@ -290,7 +290,9 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
290 | 'stallman' => 1, | 290 | 'stallman' => 1, |
291 | 'free' => 1, | 291 | 'free' => 1, |
292 | '-exclude' => 1, | 292 | '-exclude' => 1, |
293 | 'stuff' => 2, | 293 | // The DB contains a link with `sTuff` and another one with `stuff` tag. |
294 | // They need to be grouped with the first case found (`sTuff`). | ||
295 | 'sTuff' => 2, | ||
294 | ), | 296 | ), |
295 | self::$publicLinkDB->allTags() | 297 | self::$publicLinkDB->allTags() |
296 | ); | 298 | ); |
@@ -310,7 +312,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
310 | 'w3c' => 1, | 312 | 'w3c' => 1, |
311 | 'css' => 1, | 313 | 'css' => 1, |
312 | 'Mercurial' => 1, | 314 | 'Mercurial' => 1, |
313 | 'stuff' => 2, | 315 | 'sTuff' => 2, |
314 | '-exclude' => 1, | 316 | '-exclude' => 1, |
315 | '.hidden' => 1, | 317 | '.hidden' => 1, |
316 | ), | 318 | ), |
diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index ce82265e..4bf53b2d 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php | |||
@@ -85,6 +85,7 @@ class UrlTest extends PHPUnit_Framework_TestCase | |||
85 | $this->assertUrlIsCleaned('?utm_term=1n4l'); | 85 | $this->assertUrlIsCleaned('?utm_term=1n4l'); |
86 | 86 | ||
87 | $this->assertUrlIsCleaned('?xtor=some-url'); | 87 | $this->assertUrlIsCleaned('?xtor=some-url'); |
88 | $this->assertUrlIsCleaned('?PHPSESSID=012345678910111213'); | ||
88 | } | 89 | } |
89 | 90 | ||
90 | /** | 91 | /** |
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index fa7e1d52..3593a556 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php | |||
@@ -125,7 +125,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase | |||
125 | $data = array( | 125 | $data = array( |
126 | 'links' => array(array( | 126 | 'links' => array(array( |
127 | 'description' => $str, | 127 | 'description' => $str, |
128 | 'tags' => NO_MD_TAG | 128 | 'tags' => NO_MD_TAG, |
129 | 'taglist' => array(NO_MD_TAG), | ||
129 | )) | 130 | )) |
130 | ); | 131 | ); |
131 | 132 | ||
@@ -140,7 +141,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase | |||
140 | // nth link | 141 | // nth link |
141 | 0 => array( | 142 | 0 => array( |
142 | 'formatedDescription' => $str, | 143 | 'formatedDescription' => $str, |
143 | 'tags' => NO_MD_TAG | 144 | 'tags' => NO_MD_TAG, |
145 | 'taglist' => array(), | ||
144 | ), | 146 | ), |
145 | ), | 147 | ), |
146 | ), | 148 | ), |
diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php index dc4f5dfa..46165b4d 100644 --- a/tests/utils/ReferenceLinkDB.php +++ b/tests/utils/ReferenceLinkDB.php | |||
@@ -21,7 +21,7 @@ class ReferenceLinkDB | |||
21 | 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this.', | 21 | 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this.', |
22 | 0, | 22 | 0, |
23 | '20150310_114651', | 23 | '20150310_114651', |
24 | 'stuff' | 24 | 'sTuff' |
25 | ); | 25 | ); |
26 | 26 | ||
27 | $this->addLink( | 27 | $this->addLink( |
diff --git a/tpl/tools.html b/tpl/tools.html index 29ade725..9e45caad 100644 --- a/tpl/tools.html +++ b/tpl/tools.html | |||
@@ -79,7 +79,7 @@ | |||
79 | icon32URL: baseURL + "/images/favicon.ico", | 79 | icon32URL: baseURL + "/images/favicon.ico", |
80 | icon64URL: baseURL + "/images/favicon.ico", | 80 | icon64URL: baseURL + "/images/favicon.ico", |
81 | 81 | ||
82 | shareURL: baseURL + "{noparse}?post=%{url}&title=%{title}&description=%{description}&source=firefoxsocialapi{/noparse}", | 82 | shareURL: baseURL + "{noparse}?post=%{url}&title=%{title}&description=%{text}&source=firefoxsocialapi{/noparse}", |
83 | homepageURL: baseURL | 83 | homepageURL: baseURL |
84 | }; | 84 | }; |
85 | node.setAttribute("data-service", JSON.stringify(data)); | 85 | node.setAttribute("data-service", JSON.stringify(data)); |