--- /dev/null
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Build documentation with MkDocs
+mkdocs:
+ configuration: mkdocs.yml
+
+# Optionally set the version of Python and requirements required to build your docs
+# https://github.com/rtfd/readthedocs.org/issues/5250
+python:
+ version: 3.5
\ No newline at end of file
- 687 ArthurHoaro <arthur@hoa.ro>
- 355 VirtualTam <virtualtam@flibidi.net>
- 195 nodiscc <nodiscc@gmail.com>
+ 734 ArthurHoaro <arthur@hoa.ro>
+ 400 VirtualTam <virtualtam@flibidi.net>
+ 215 nodiscc <nodiscc@gmail.com>
56 Sébastien Sauvage <sebsauvage@sebsauvage.net>
15 Florian Eula <eula.florian@gmail.com>
13 Emilien Klein <emilien@klein.st>
12 Nicolas Danelon <hi@nicolasmd.com.ar>
9 Willi Eggeling <thewilli@gmail.com>
8 Christophe HENRY <christophe.henry@sbgodin.fr>
+ 7 Luce Carević <lcarevic@access42.net>
6 B. van Berkum <dev@dotmpe.com>
+ 6 llune <llune@users.noreply.github.com>
5 Lucas Cimon <lucas.cimon@gmail.com>
5 Mark Schmitz <kramred@gmail.com>
5 kalvn <kalvnthereal@gmail.com>
4 David Sferruzza <david.sferruzza@gmail.com>
4 Immánuel Fodor <immanuelfactor+github@gmail.com>
3 Teromene <teromene@teromene.fr>
- 3 llune <llune@users.noreply.github.com>
+ 2 Alexandre G.-Raymond <alex@ndre.gr>
2 Chris Kuethe <chris.kuethe@gmail.com>
2 Felix Bartels <felix@host-consultants.de>
2 Knah Tsaeb <Knah-Tsaeb@knah-tsaeb.org>
2 julienCXX <software@chmodplusx.eu>
2 philipp-r <philipp-r@users.noreply.github.com>
2 pips <pips@e5150.fr>
+ 2 trailjeep <trailjeep@gmail.com>
1 Adrien Oliva <adrien.oliva@yapbreak.fr>
1 Adrien le Maire <adrien@alemaire.be>
- 1 Alexandre G.-Raymond <alex@ndre.gr>
1 Alexis J <alexis@effingo.be>
1 Angristan <angristan@users.noreply.github.com>
+ 1 Bish Erbas <42714627+bisherbas@users.noreply.github.com>
1 BoboTiG <bobotig@gmail.com>
1 Bronco <bronco@warriordudimanche.net>
1 Buster One <37770318+buster-one@users.noreply.github.com>
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+
+## [v0.10.4](https://github.com/shaarli/Shaarli/releases/tag/v0.10.4) - 2019-04-16
+### Fixed
+- Fix thumbnails disabling if PHP GD is not installed
+- Fix a warning if links sticky status isn't set
+
+## [v0.10.3](https://github.com/shaarli/Shaarli/releases/tag/v0.10.3) - 2019-02-23
+### Added
+- Add OpenGraph metadata tags on permalink page
+- Add CORS headers to REST API reponses
+- Add a button to toggle checkboxes of displayed links
+- Add an icon to the link list when the Isso plugin is enabled
+- Add noindex, nofollow to documentation pages
+- Document usage of robots.txt
+- Add a button to set links as sticky
+
+### Changed
+- Update French translation
+- Refactor the documentation homepage
+- Bump netscape-bookmark-parser
+- Update session_start condition
+- Improve accessibility
+- Cleanup and refactor lint tooling
+
+### Fixed
+- Fix input size for dropdown search form
+- Fix history for bulk link deletion
+- Fix thumbnail requests
+- Fix hashtag rendering when markdown escaping is enabled
+- Fix AJAX tag deletion
+- Fix lint errors and improve PSR-1 and PSR-2 compliance
+
+### Removed
+- Remove Firefox Share documentation
+
## [v0.10.2](https://github.com/shaarli/Shaarli/releases/tag/v0.10.2) - 2018-08-11
### Fixed
## [v0.10.1](https://github.com/shaarli/Shaarli/releases/tag/v0.10.1) - 2018-08-11
-### Changed
+### Changed
- Accessibility:
- Remove alt text on the logo
- Use Travis matrix and stages to run Javascript tests in a dedicated environment
- Add tag endpoint in the REST API
- Build the documentation in Travis builds
-- Provide a Docker Compose example
+- Provide a Docker Compose example
### Changed
- Use web-thumbnailer to retrieve thumbnails (see #687)
[![](https://img.shields.io/badge/stable-v0.9.7-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.9.7)
[![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli)
•
-[![](https://img.shields.io/badge/latest-v0.10.2-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.2)
+[![](https://img.shields.io/badge/latest-v0.10.4-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.4)
[![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli)
•
-[![](https://img.shields.io/badge/master-v0.10.x-blue.svg)](https://github.com/shaarli/Shaarli)
+[![](https://img.shields.io/badge/master-v0.11.x-blue.svg)](https://github.com/shaarli/Shaarli)
[![](https://img.shields.io/travis/shaarli/Shaarli.svg?label=master)](https://travis-ci.org/shaarli/Shaarli)
[![Join the chat at https://gitter.im/shaarli/Shaarli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shaarli/Shaarli)
$this->conf = $conf;
if (! $this->checkRequirements()) {
- $this->conf->set('thumbnails.enabled', false);
+ $this->conf->set('thumbnails.mode', Thumbnailer::MODE_NONE);
$this->conf->write(true);
// TODO: create a proper error handling system able to catch exceptions...
die(t(
$linkDb = new \Shaarli\Bookmark\LinkDB(
$conf->get('resource.datastore'),
true,
- $conf->get('privacy.hide_public_links'),
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
+ $conf->get('privacy.hide_public_links')
);
$this->container['db'] = $linkDb;
}
{
$out['id'] = $link['id'];
// Not an internal link
- if ($link['url'][0] != '?') {
+ if (! is_note($link['url'])) {
$out['url'] = $link['url'];
} else {
$out['url'] = $indexUrl . $link['url'];
* - private: Is this link private? 0=no, other value=yes
* - tags: tags attached to this entry (separated by spaces)
* - title Title of the link
- * - url URL of the link. Used for displayable links (no redirector, relative, etc.).
- * Can be absolute or relative.
- * Relative URLs are permalinks (e.g.'?m-ukcw')
- * - real_url Absolute processed URL.
+ * - url URL of the link. Used for displayable links.
+ * Can be absolute or relative in the database but the relative links
+ * will be converted to absolute ones in templates.
+ * - real_url Raw URL in stored in the DB (absolute or relative).
* - shorturl Permalink smallhash
*
* Implements 3 interfaces:
// Hide public links
private $hidePublicLinks;
- // link redirector set in user settings.
- private $redirector;
-
- /**
- * Set this to `true` to urlencode link behind redirector link, `false` to leave it untouched.
- *
- * Example:
- * anonym.to needs clean URL while dereferer.org needs urlencoded URL.
- *
- * @var boolean $redirectorEncode parameter: true or false
- */
- private $redirectorEncode;
-
/**
* Creates a new LinkDB
*
* @param string $datastore datastore file path.
* @param boolean $isLoggedIn is the user logged in?
* @param boolean $hidePublicLinks if true all links are private.
- * @param string $redirector link redirector set in user settings.
- * @param boolean $redirectorEncode Enable urlencode on redirected urls (default: true).
*/
public function __construct(
$datastore,
$isLoggedIn,
- $hidePublicLinks,
- $redirector = '',
- $redirectorEncode = true
+ $hidePublicLinks
) {
$this->datastore = $datastore;
$this->loggedIn = $isLoggedIn;
$this->hidePublicLinks = $hidePublicLinks;
- $this->redirector = $redirector;
- $this->redirectorEncode = $redirectorEncode === true;
$this->check();
$this->read();
}
),
'private' => 0,
'created' => new DateTime(),
- 'tags' => 'opensource software'
+ 'tags' => 'opensource software',
+ 'sticky' => false,
);
$link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[1] = $link;
'private' => 1,
'created' => new DateTime('1 minute ago'),
'tags' => 'secretstuff',
+ 'sticky' => false,
);
$link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[0] = $link;
$link['tags'] = preg_replace('/(^|\s+)\.[^($|\s)]+\s*/', ' ', $link['tags']);
}
- // Do not use the redirector for internal links (Shaarli note URL starting with a '?').
- if (!empty($this->redirector) && !startsWith($link['url'], '?')) {
- $link['real_url'] = $this->redirector;
- if ($this->redirectorEncode) {
- $link['real_url'] .= urlencode(unescape($link['url']));
- } else {
- $link['real_url'] .= $link['url'];
- }
- } else {
- $link['real_url'] = $link['url'];
- }
+ $link['real_url'] = $link['url'];
+
+ $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
// To be able to load links before running the update, and prepare the update
if (!isset($link['created'])) {
* In a string, converts URLs to clickable links.
*
* @param string $text input string.
- * @param string $redirector if a redirector is set, use it to gerenate links.
- * @param bool $urlEncode Use `urlencode()` on the URL after the redirector or not.
*
* @return string returns $text with all links converted to HTML links.
*
* @see Function inspired from http://www.php.net/manual/en/function.preg-replace.php#85722
*/
-function text2clickable($text, $redirector = '', $urlEncode = true)
+function text2clickable($text)
{
$regex = '!(((?:https?|ftp|file)://|apt:|magnet:)\S+[a-z0-9\(\)]/?)!si';
-
- if (empty($redirector)) {
- return preg_replace($regex, '<a href="$1">$1</a>', $text);
- }
- // Redirector is set, urlencode the final URL.
- return preg_replace_callback(
- $regex,
- function ($matches) use ($redirector, $urlEncode) {
- $url = $urlEncode ? urlencode($matches[1]) : $matches[1];
- return '<a href="' . $redirector . $url .'">'. $matches[1] .'</a>';
- },
- $text
- );
+ return preg_replace($regex, '<a href="$1">$1</a>', $text);
}
/**
* Format Shaarli's description
*
* @param string $description shaare's description.
- * @param string $redirector if a redirector is set, use it to gerenate links.
- * @param bool $urlEncode Use `urlencode()` on the URL after the redirector or not.
* @param string $indexUrl URL to Shaarli's index.
* @return string formatted description.
*/
-function format_description($description, $redirector = '', $urlEncode = true, $indexUrl = '')
+function format_description($description, $indexUrl = '')
{
- return nl2br(space2nbsp(hashtag_autolink(text2clickable($description, $redirector, $urlEncode), $indexUrl)));
+ return nl2br(space2nbsp(hashtag_autolink(text2clickable($description), $indexUrl)));
}
/**
{
return smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id);
}
+
+/**
+ * Returns whether or not the link is an internal note.
+ * Its URL starts by `?` because it's actually a permalink.
+ *
+ * @param string $linkUrl
+ *
+ * @return bool true if internal note, false otherwise.
+ */
+function is_note($linkUrl)
+{
+ return isset($linkUrl[0]) && $linkUrl[0] === '?';
+}
'general.title',
'general.header_link',
'privacy.default_private_links',
- 'redirector.url',
);
// Only logged in user can alter config.
// default state of the 'remember me' checkbox of the login form
$this->setEmpty('privacy.remember_user_default', true);
- $this->setEmpty('redirector.url', '');
- $this->setEmpty('redirector.encode_url', true);
-
$this->setEmpty('thumbnails.width', '125');
$this->setEmpty('thumbnails.height', '90');
protected function buildItem($link, $pageaddr)
{
$link['guid'] = $pageaddr . '?' . $link['shorturl'];
- // Check for both signs of a note: starting with ? and 7 chars long.
- if ($link['url'][0] === '?' && strlen($link['url']) === 7) {
+ // Prepend the root URL for notes
+ if (is_note($link['url'])) {
$link['url'] = $pageaddr . $link['url'];
}
if ($this->usePermalinks === true) {
} else {
$permalink = '<a href="' . $link['guid'] . '" title="' . t('Permalink') . '">' . t('Permalink') . '</a>';
}
- $link['description'] = format_description($link['description'], '', false, $pageaddr);
+ $link['description'] = format_description($link['description'], $pageaddr);
$link['description'] .= PHP_EOL . '<br>— ' . $permalink;
$pubDate = $link['created'];
$link['timestamp'] = $date->getTimestamp();
$link['taglist'] = str_replace(' ', ',', $link['tags']);
- if (startsWith($link['url'], '?') && $prependNoteUrl) {
+ if (is_note($link['url']) && $prependNoteUrl) {
$link['url'] = $indexUrl . $link['url'];
}
$this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
$this->tpl->assign('token', $this->token);
+ $this->tpl->assign('language', $this->conf->get('translation.language'));
+
if ($this->linkDB !== null) {
$this->tpl->assign('tags', $this->linkDB->linksCountPerTag());
}
try {
$this->conf->set('general.title', escape($this->conf->get('general.title')));
$this->conf->set('general.header_link', escape($this->conf->get('general.header_link')));
- $this->conf->set('redirector.url', escape($this->conf->get('redirector.url')));
$this->conf->write($this->isLoggedIn);
} catch (Exception $e) {
error_log($e->getMessage());
return true;
}
+
+ /**
+ * Remove redirector settings.
+ */
+ public function updateMethodRemoveRedirector()
+ {
+ $this->conf->remove('redirector');
+ $this->conf->write(true);
+ return true;
+ }
}
color: $dark-grey;
font-size: .9em;
+
a {
+ display: inline-block;
+ margin: 3px 0;
padding: 5px 8px;
text-decoration: none;
}
In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. Download our **shaarli-full** archive to include dependencies.
-The current latest released version is `v0.9.7`
+The current latest released version is `v0.10.4`
```bash
-$ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.7/shaarli-v0.9.7-full.zip
-$ unzip shaarli-v0.9.7-full.zip
+$ wget https://github.com/shaarli/Shaarli/releases/download/v0.10.4/shaarli-v0.10.4-full.zip
+$ unzip shaarli-v0.10.4-full.zip
$ mv Shaarli /path/to/shaarli/
```
:---:|:---:|:---:
7.2 | Supported | Yes
7.1 | Supported | Yes
-7.0 | Supported | Yes
+7.0 | EOL: 2018-12-03 | Yes (up to Shaarli 0.10.x)
5.6 | EOL: 2018-12-31 | Yes (up to Shaarli 0.10.x)
5.5 | EOL: 2016-07-10 | Yes
5.4 | EOL: 2015-09-14 | Yes (up to Shaarli 0.8.x)
Once your Shaarli instance is installed, the file `data/config.json.php` is generated:
* it contains all settings in JSON format, and can be edited to customize values
-* it defines which [plugins](Plugin-System) are enabled[](.html)
+* it defines which [plugins](Plugin-System) are enabled
* its values override those defined in `index.php`
* it is wrap in a PHP comment to prevent anyone accessing it, regardless of server configuration
- to give it access to Shaarli, either:
- unzip Shaarli in the default web server location (usually `/var/www/`) and set the web server user as the owner
- put users in the same group as the web server, and set the appropriate access rights
-- if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly[](.html)
+- if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly
## Configuration
In `data/config.json.php`.
-See also [Plugin System](Plugin-System.html).
+See also [Plugin System](Plugin-System).
### Credentials
- **enable_thumbnails**: Enable or disable thumbnail display.
- **enable_localcache**: Enable or disable local cache.
-### Redirector
-
-- **url**: Redirector URL, such as `anonym.to`.
-- **encode_url**: Enable this if the redirector needs encoded URL to work properly.
-
## Configuration file example
```json
"hide_public_links": false,
"hide_timestamps": false,
"open_shaarli": false,
- "redirector": "http://anonym.to/?",
- "redirector_encode_url": false
},
"general": {
"header_link": "?",
"enable_thumbnails": true,
"enable_localcache": true
},
- "redirector": {
- "url": "http://anonym.to/?",
- "encode_url": false
- },
"plugins": {
"WALLABAG_URL": "http://demo.wallabag.org",
"WALLABAG_VERSION": "1"
#~ msgid "Selection"
#~ msgstr "Choisir"
+#~ msgid "Select all"
+#~ msgstr "Tout sélectionner"
+
#~ msgid "Public"
#~ msgstr "Publics"
$LINKSDB = new LinkDB(
$conf->get('resource.datastore'),
$loginManager->isLoggedIn(),
- $conf->get('privacy.hide_public_links'),
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
+ $conf->get('privacy.hide_public_links')
);
/* Some Shaarlies may have very few links, so we need to look
// We pre-format some fields for proper output.
foreach ($links as &$link) {
- $link['formatedDescription'] = format_description(
- $link['description'],
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
- );
+ $link['formatedDescription'] = format_description($link['description']);
$link['timestamp'] = $link['created']->getTimestamp();
- if (startsWith($link['url'], '?')) {
+ if (is_note($link['url'])) {
$link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute
}
}
$taglist = explode(' ', $link['tags']);
uasort($taglist, 'strcasecmp');
$linksToDisplay[$key]['taglist']=$taglist;
- $linksToDisplay[$key]['formatedDescription'] = format_description(
- $link['description'],
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
- );
+ $linksToDisplay[$key]['formatedDescription'] = format_description($link['description']);
$linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
}
$PAGE->assign('api_enabled', $conf->get('api.enabled', true));
$PAGE->assign('api_secret', $conf->get('api.secret'));
$PAGE->assign('languages', Languages::getAvailableLanguages());
- $PAGE->assign('language', $conf->get('translation.language'));
$PAGE->assign('gd_enabled', extension_loaded('gd'));
$PAGE->assign('thumbnails_mode', $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE));
$PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli'));
$link['title'] = $link['url'];
}
- if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE) {
+ if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE
+ && ! is_note($link['url'])
+ ) {
$thumbnailer = new Thumbnailer($conf);
$link['thumbnail'] = $thumbnailer->get($url);
}
+ $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
+
$pluginManager->executeHooks('save_link', $link);
$LINKSDB[$id] = $link;
$ids = [];
foreach ($LINKSDB as $link) {
// A note or not HTTP(S)
- if ($link['url'][0] === '?' || ! startsWith(strtolower($link['url']), 'http')) {
+ if (is_note($link['url']) || ! startsWith(strtolower($link['url']), 'http')) {
continue;
}
$ids[] = $link['id'];
$linkDisp = array();
while ($i<$end && $i<count($keys)) {
$link = $linksToDisplay[$keys[$i]];
- $link['description'] = format_description(
- $link['description'],
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
- );
+ $link['description'] = format_description($link['description']);
$classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight';
$link['class'] = $link['private'] == 0 ? $classLi : 'private';
$link['timestamp'] = $link['created']->getTimestamp();
'search_term' => $searchterm,
'search_tags' => $searchtags,
'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '',
- 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
'links' => $linkDisp,
);
$linkDb = new LinkDB(
$conf->get('resource.datastore'),
$loginManager->isLoggedIn(),
- $conf->get('privacy.hide_public_links'),
- $conf->get('redirector.url'),
- $conf->get('redirector.encode_url')
+ $conf->get('privacy.hide_public_links')
);
$container = new \Slim\Container();
$this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag');
$this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag');
- $this->get('/history', '\Shaarli\Api\Controllers\History:getHistory')->setName('getHistory');
+ $this->get('/history', '\Shaarli\Api\Controllers\HistoryController:getHistory')->setName('getHistory');
})->add('\Shaarli\Api\ApiMiddleware');
$response = $app->run(true);
);
}
- /**
- * Test real_url without redirector.
- */
- public function testLinkRealUrlWithoutRedirector()
- {
- $db = new LinkDB(self::$testDatastore, false, false);
- foreach ($db as $link) {
- $this->assertEquals($link['url'], $link['real_url']);
- }
- }
-
- /**
- * Test real_url with redirector.
- */
- public function testLinkRealUrlWithRedirector()
- {
- $redirector = 'http://redirector.to?';
- $db = new LinkDB(self::$testDatastore, false, false, $redirector);
- foreach ($db as $link) {
- $this->assertStringStartsWith($redirector, $link['real_url']);
- $this->assertNotFalse(strpos($link['real_url'], urlencode('://')));
- }
-
- $db = new LinkDB(self::$testDatastore, false, false, $redirector, false);
- foreach ($db as $link) {
- $this->assertStringStartsWith($redirector, $link['real_url']);
- $this->assertFalse(strpos($link['real_url'], urlencode('://')));
- }
- }
-
/**
* Test filter with string.
*/
public function testRenameTagCaseSensitive()
{
self::$refDB->write(self::$testDatastore);
- $linkDB = new LinkDB(self::$testDatastore, true, false, '');
+ $linkDB = new LinkDB(self::$testDatastore, true, false);
$res = $linkDB->renameTag('sTuff', 'Taz');
$this->assertEquals(1, count($res));
}
/**
- * Test text2clickable without a redirector being set.
+ * Test text2clickable.
*/
- public function testText2clickableWithoutRedirector()
+ public function testText2clickable()
{
$text = 'stuff http://hello.there/is=someone#here otherstuff';
$expectedText = 'stuff <a href="http://hello.there/is=someone#here">'
. 'http://hello.there/is=someone#here</a> otherstuff';
- $processedText = text2clickable($text, '');
+ $processedText = text2clickable($text);
$this->assertEquals($expectedText, $processedText);
$text = 'stuff http://hello.there/is=someone#here(please) otherstuff';
$expectedText = 'stuff <a href="http://hello.there/is=someone#here(please)">'
. 'http://hello.there/is=someone#here(please)</a> otherstuff';
- $processedText = text2clickable($text, '');
+ $processedText = text2clickable($text);
$this->assertEquals($expectedText, $processedText);
+ $text = 'stuff http://hello.there/is=someone#here(please)&no otherstuff';
$text = 'stuff http://hello.there/is=someone#here(please)&no otherstuff';
$expectedText = 'stuff <a href="http://hello.there/is=someone#here(please)&no">'
. 'http://hello.there/is=someone#here(please)&no</a> otherstuff';
- $processedText = text2clickable($text, '');
- $this->assertEquals($expectedText, $processedText);
- }
-
- /**
- * Test text2clickable with a redirector set.
- */
- public function testText2clickableWithRedirector()
- {
- $text = 'stuff http://hello.there/is=someone#here otherstuff';
- $redirector = 'http://redirector.to';
- $expectedText = 'stuff <a href="' .
- $redirector .
- urlencode('http://hello.there/is=someone#here') .
- '">http://hello.there/is=someone#here</a> otherstuff';
- $processedText = text2clickable($text, $redirector);
- $this->assertEquals($expectedText, $processedText);
- }
-
- /**
- * Test text2clickable a redirector set and without URL encode.
- */
- public function testText2clickableWithRedirectorDontEncode()
- {
- $text = 'stuff http://hello.there/?is=someone&or=something#here otherstuff';
- $redirector = 'http://redirector.to';
- $expectedText = 'stuff <a href="' .
- $redirector .
- 'http://hello.there/?is=someone&or=something#here' .
- '">http://hello.there/?is=someone&or=something#here</a> otherstuff';
- $processedText = text2clickable($text, $redirector, false);
+ $processedText = text2clickable($text);
$this->assertEquals($expectedText, $processedText);
}
$this->assertNotContains('>#nothashtag', $autolinkedDescription);
}
+ /**
+ * Test is_note with note URLs.
+ */
+ public function testIsNote()
+ {
+ $this->assertTrue(is_note('?'));
+ $this->assertTrue(is_note('?abcDEf'));
+ $this->assertTrue(is_note('?_abcDEf#123'));
+ }
+
+ /**
+ * Test is_note with non note URLs.
+ */
+ public function testIsNotNote()
+ {
+ $this->assertFalse(is_note(''));
+ $this->assertFalse(is_note('nope'));
+ $this->assertFalse(is_note('https://github.com/shaarli/Shaarli/?hi'));
+ }
+
/**
* Util function to build an hashtag link.
*
public function testReverseText2clickable()
{
$text = 'stuff http://hello.there/is=someone#here otherstuff';
- $clickableText = text2clickable($text, '');
+ $clickableText = text2clickable($text);
$reversedText = reverse_text2clickable($clickableText);
$this->assertEquals($text, $reversedText);
}
$this->conf = new ConfigManager($sandbox);
$title = '<script>alert("title");</script>';
$headerLink = '<script>alert("header_link");</script>';
- $redirectorUrl = '<script>alert("redirector");</script>';
$this->conf->set('general.title', $title);
$this->conf->set('general.header_link', $headerLink);
- $this->conf->set('redirector.url', $redirectorUrl);
$updater = new Updater(array(), array(), $this->conf, true);
$done = $updater->updateMethodEscapeUnescapedConfig();
$this->assertTrue($done);
$this->conf->reload();
$this->assertEquals(escape($title), $this->conf->get('general.title'));
$this->assertEquals(escape($headerLink), $this->conf->get('general.header_link'));
- $this->assertEquals(escape($redirectorUrl), $this->conf->get('redirector.url'));
unlink($sandbox . '.json.php');
}
}
/**
-<<<<<<< HEAD
* Test updateMethodWebThumbnailer with thumbnails enabled.
*/
public function testUpdateMethodWebThumbnailerEnabled()
$linkDB = new LinkDB(self::$testDatastore, true, false);
$this->assertTrue($linkDB[1]['sticky']);
}
+
+ /**
+ * Test updateMethodRemoveRedirector().
+ */
+ public function testUpdateRemoveRedirector()
+ {
+ $sandboxConf = 'sandbox/config';
+ copy(self::$configFile . '.json.php', $sandboxConf . '.json.php');
+ $this->conf = new ConfigManager($sandboxConf);
+ $updater = new Updater([], null, $this->conf, true);
+ $this->assertTrue($updater->updateMethodRemoveRedirector());
+ $this->assertFalse($this->conf->exists('redirector'));
+ $this->conf = new ConfigManager($sandboxConf);
+ $this->assertFalse($this->conf->exists('redirector'));
+ }
}
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
{'tagged'|t}
{loop="$exploded_tags"}
<span class="label label-tag" title="{'Remove tag'|t}">
- <a href="?removetag={function="urlencode($value)"}">{$value}<span class="remove"><i class="fa fa-times"></i></span></a>
+ <a href="?removetag={function="urlencode($value)"}">{$value}<span class="remove"><i class="fa fa-times" aria-hidden="true"></i></span></a>
</span>
{/loop}
{/if}
<input type="checkbox" class="link-checkbox" value="{$value.id}">
</span>
<span class="linklist-item-infos-controls-item ctrl-edit">
- <a href="?edit_link={$value.id}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link"></i></a>
+ <a href="?edit_link={$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
</span>
<span class="linklist-item-infos-controls-item ctrl-delete">
- <a href="?delete_link&lf_linkdate={$value.id}&token={$token}"
+ <a href="?delete_link&lf_linkdate={$value.id}&token={$token}" aria-label="{$strDelete}"
title="{$strDelete}" class="delete-link pure-u-0 pure-u-lg-visible confirm-delete">
- <i class="fa fa-trash"></i>
+ <i class="fa fa-trash" aria-hidden="true"></i>
</a>
</span>
<span class="linklist-item-infos-controls-item ctrl-pin">
<a href="?do=pin&id={$value.id}&token={$token}"
- title="{$strToggleSticky}" class="pin-link {if="$value.sticky"}pinned-link{/if} pure-u-0 pure-u-lg-visible">
- <i class="fa fa-thumb-tack"></i>
+ title="{$strToggleSticky}" aria-label="{$strToggleSticky}" class="pin-link {if="$value.sticky"}pinned-link{/if} pure-u-0 pure-u-lg-visible">
+ <i class="fa fa-thumb-tack" aria-hidden="true"></i>
</a>
</span>
</div>
{ignore}do not add space or line break between these div - Firefox issue{/ignore}
class="linklist-item-infos-url pure-u-lg-5-12 pure-u-1">
<a href="{$value.real_url}" title="{$value.title}">
- <i class="fa fa-link"></i> {$value.url}
+ <i class="fa fa-link" aria-hidden="true"></i> {$value.url}
</a>
<div class="linklist-item-buttons pure-u-0 pure-u-lg-visible">
- <a href="#" title="{$strFold}" class="fold-button"><i class="fa fa-chevron-up"></i></a>
+ <a href="#" aria-label="{$strFold}" title="{$strFold}" class="fold-button"><i class="fa fa-chevron-up" aria-hidden="true"></i></a>
</div>
</div>
<div class="mobile-buttons pure-u-1 pure-u-lg-0">
{/if}
{if="$is_logged_in"}
·
- <a href="?delete_link&lf_linkdate={$value.id}&token={$token}"
+ <a href="?delete_link&lf_linkdate={$value.id}&token={$token}" aria-label="{$strDelete}"
title="{$strDelete}" class="delete-link confirm-delete">
- <i class="fa fa-trash"></i>
+ <i class="fa fa-trash" aria-hidden="true"></i>
</a>
·
- <a href="?edit_link={$value.id}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link"></i></a>
+ <a href="?edit_link={$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
{/if}
</div>
</div>
{'Filters'|t}
</span>
{if="$is_logged_in"}
- <a href="?visibility=private" title="{'Only display private links'|t}"
+ <a href="?visibility=private" aria-label="{'Only display private links'|t}" title="{'Only display private links'|t}"
class="{if="$visibility==='private'"}filter-on{else}filter-off{/if}"
- ><i class="fa fa-user-secret"></i></a>
- <a href="?visibility=public" title="{'Only display public links'|t}"
+ ><i class="fa fa-user-secret" aria-hidden="true"></i></a>
+ <a href="?visibility=public" aria-label="{'Only display public links'|t}" title="{'Only display public links'|t}"
class="{if="$visibility==='public'"}filter-on{else}filter-off{/if}"
- ><i class="fa fa-globe"></i></a>
+ ><i class="fa fa-globe" aria-hidden="true"></i></a>
{/if}
- <a href="?untaggedonly" title="{'Filter untagged links'|t}"
+ <a href="?untaggedonly" aria-label="{'Filter untagged links'|t}" title="{'Filter untagged links'|t}"
class={if="$untaggedonly"}"filter-on"{else}"filter-off"{/if}
- ><i class="fa fa-tag"></i></a>
- <a href="#" title="{'Select all'|t}"
+ ><i class="fa fa-tag" aria-hidden="true"></i></a>
+ <a href="#" aria-label="{'Select all'|t}" title="{'Select all'|t}"
class="filter-off select-all-button"
- ><i class="fa fa-check-square-o"></i></a>
- <a href="#" class="filter-off fold-all pure-u-lg-0" title="{'Fold all'|t}">
- <i class="fa fa-chevron-up"></i>
+ ><i class="fa fa-check-square-o" aria-hidden="true"></i></a>
+ <a href="#" class="filter-off fold-all pure-u-lg-0" aria-label="{'Fold all'|t}" title="{'Fold all'|t}">
+ <i class="fa fa-chevron-up" aria-hidden="true"></i>
</a>
{loop="$action_plugin"}
{$value.attr.class=isset($value.attr.class) ? $value.attr.class : ''}
<form method="GET" class="pure-u-0 pure-u-lg-visible">
<input type="text" name="linksperpage" placeholder="133">
</form>
- <a href="#" class="filter-off fold-all pure-u-0 pure-u-lg-visible" title="{'Fold all'|t}">
- <i class="fa fa-chevron-up"></i>
+ <a href="#" class="filter-off fold-all pure-u-0 pure-u-lg-visible" aria-label="{'Fold all'|t}" title="{'Fold all'|t}">
+ <i class="fa fa-chevron-up" aria-hidden="true"></i>
</a>
</div>
</div>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<div class="pure-g">
<div class="pure-u-2-24"></div>
- <div id="footer" class="pure-u-20-24 footer-container">
+ <footer id="footer" class="pure-u-20-24 footer-container" role="contentinfo">
<strong><a href="https://github.com/shaarli/Shaarli">Shaarli</a></strong>
{if="$is_logged_in===true"}
{$version}
{loop="$plugins_footer.text"}
{$value}
{/loop}
- </div>
+ </footer>
<div class="pure-u-2-24"></div>
</div>
{if="$is_logged_in || $openshaarli"}
<li class="pure-menu-item">
<a href="?do=addlink" class="pure-menu-link" id="shaarli-menu-shaare">
- <i class="fa fa-plus" ></i> {'Shaare'|t}
+ <i class="fa fa-plus" aria-hidden="true"></i> {'Shaare'|t}
</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-tools">
<li class="pure-menu-item" id="shaarli-menu-desktop-search">
<a href="#" class="pure-menu-link subheader-opener"
data-open-id="search"
- id="search-button" title="{'Search'|t}">
- <i class="fa fa-search"></i>
+ id="search-button" aria-label="{'Search'|t}" title="{'Search'|t}">
+ <i class="fa fa-search" aria-hidden="true"></i>
</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-desktop-rss">
- <a href="?do={$feed_type}{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}">
- <i class="fa fa-rss"></i>
+ <a href="?do={$feed_type}{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}" aria-label="{'RSS Feed'|t}">
+ <i class="fa fa-rss" aria-hidden="true"></i>
</a>
</li>
{if="!$is_logged_in"}
<li class="pure-menu-item" id="shaarli-menu-desktop-login">
<a href="?do=login" class="pure-menu-link"
data-open-id="header-login-form"
- id="login-button" title="{'Login'|t}">
- <i class="fa fa-user"></i>
+ id="login-button" aria-label="{'Login'|t}" title="{'Login'|t}">
+ <i class="fa fa-user" aria-hidden="true"></i>
</a>
</li>
{else}
<li class="pure-menu-item" id="shaarli-menu-desktop-logout">
- <a href="?do=logout" class="pure-menu-link" title="{'Logout'|t}">
- <i class="fa fa-sign-out"></i>
+ <a href="?do=logout" class="pure-menu-link" aria-label="{'Logout'|t}" title="{'Logout'|t}">
+ <i class="fa fa-sign-out" aria-hidden="true"></i>
</a>
</li>
{/if}
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<div class="pure-g">
<div class="pure-u-1 pure-alert pure-alert-success tag-sort">
{'Sort by:'|t}
- <a href="?do=tagcloud" title="cloud">{'Cloud'|t}</a> ·
- <a href="?do=taglist&sort=usage" title="cloud">{'Most used'|t}</a> ·
- <a href="?do=taglist&sort=alpha" title="cloud">{'Alphabetical'|t}</a>
+ <a href="?do=tagcloud">{'Cloud'|t}</a> ·
+ <a href="?do=taglist&sort=usage">{'Most used'|t}</a> ·
+ <a href="?do=taglist&sort=alpha">{'Alphabetical'|t}</a>
</div>
</div>
\ No newline at end of file
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>
<!DOCTYPE html>
-<html>
+<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
<head>
{include="includes"}
</head>