diff options
Diffstat (limited to 'application/http')
-rw-r--r-- | application/http/HttpAccess.php | 6 | ||||
-rw-r--r-- | application/http/HttpUtils.php | 12 | ||||
-rw-r--r-- | application/http/MetadataRetriever.php | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/application/http/HttpAccess.php b/application/http/HttpAccess.php index 646a5264..e80e0c01 100644 --- a/application/http/HttpAccess.php +++ b/application/http/HttpAccess.php | |||
@@ -29,14 +29,16 @@ class HttpAccess | |||
29 | &$title, | 29 | &$title, |
30 | &$description, | 30 | &$description, |
31 | &$keywords, | 31 | &$keywords, |
32 | $retrieveDescription | 32 | $retrieveDescription, |
33 | $tagsSeparator | ||
33 | ) { | 34 | ) { |
34 | return get_curl_download_callback( | 35 | return get_curl_download_callback( |
35 | $charset, | 36 | $charset, |
36 | $title, | 37 | $title, |
37 | $description, | 38 | $description, |
38 | $keywords, | 39 | $keywords, |
39 | $retrieveDescription | 40 | $retrieveDescription, |
41 | $tagsSeparator | ||
40 | ); | 42 | ); |
41 | } | 43 | } |
42 | 44 | ||
diff --git a/application/http/HttpUtils.php b/application/http/HttpUtils.php index 28c12969..ed1002b0 100644 --- a/application/http/HttpUtils.php +++ b/application/http/HttpUtils.php | |||
@@ -550,7 +550,8 @@ function get_curl_download_callback( | |||
550 | &$title, | 550 | &$title, |
551 | &$description, | 551 | &$description, |
552 | &$keywords, | 552 | &$keywords, |
553 | $retrieveDescription | 553 | $retrieveDescription, |
554 | $tagsSeparator | ||
554 | ) { | 555 | ) { |
555 | $currentChunk = 0; | 556 | $currentChunk = 0; |
556 | $foundChunk = null; | 557 | $foundChunk = null; |
@@ -568,6 +569,7 @@ function get_curl_download_callback( | |||
568 | */ | 569 | */ |
569 | return function ($ch, $data) use ( | 570 | return function ($ch, $data) use ( |
570 | $retrieveDescription, | 571 | $retrieveDescription, |
572 | $tagsSeparator, | ||
571 | &$charset, | 573 | &$charset, |
572 | &$title, | 574 | &$title, |
573 | &$description, | 575 | &$description, |
@@ -598,10 +600,10 @@ function get_curl_download_callback( | |||
598 | if (! empty($keywords)) { | 600 | if (! empty($keywords)) { |
599 | $foundChunk = $currentChunk; | 601 | $foundChunk = $currentChunk; |
600 | // Keywords use the format tag1, tag2 multiple words, tag | 602 | // Keywords use the format tag1, tag2 multiple words, tag |
601 | // So we format them to match Shaarli's separator and glue multiple words with '-' | 603 | // So we split the result with `,`, then if a tag contains the separator we replace it by `-`. |
602 | $keywords = implode(' ', array_map(function($keyword) { | 604 | $keywords = tags_array2str(array_map(function(string $keyword) use ($tagsSeparator): string { |
603 | return implode('-', preg_split('/\s+/', trim($keyword))); | 605 | return tags_array2str(tags_str2array($keyword, $tagsSeparator), '-'); |
604 | }, explode(',', $keywords))); | 606 | }, tags_str2array($keywords, ',')), $tagsSeparator); |
605 | } | 607 | } |
606 | } | 608 | } |
607 | 609 | ||
diff --git a/application/http/MetadataRetriever.php b/application/http/MetadataRetriever.php index ba9bd40c..2e1401ec 100644 --- a/application/http/MetadataRetriever.php +++ b/application/http/MetadataRetriever.php | |||
@@ -38,7 +38,6 @@ class MetadataRetriever | |||
38 | $title = null; | 38 | $title = null; |
39 | $description = null; | 39 | $description = null; |
40 | $tags = null; | 40 | $tags = null; |
41 | $retrieveDescription = $this->conf->get('general.retrieve_description'); | ||
42 | 41 | ||
43 | // Short timeout to keep the application responsive | 42 | // Short timeout to keep the application responsive |
44 | // The callback will fill $charset and $title with data from the downloaded page. | 43 | // The callback will fill $charset and $title with data from the downloaded page. |
@@ -52,7 +51,8 @@ class MetadataRetriever | |||
52 | $title, | 51 | $title, |
53 | $description, | 52 | $description, |
54 | $tags, | 53 | $tags, |
55 | $retrieveDescription | 54 | $this->conf->get('general.retrieve_description'), |
55 | $this->conf->get('general.tags_separator', ' ') | ||
56 | ) | 56 | ) |
57 | ); | 57 | ); |
58 | 58 | ||