Merge pull request #1814 from wallabag/dev

Wallabag 1.9.2
This commit is contained in:
Nicolas Lœuillet 2016-04-18 20:01:56 +02:00
commit 143f550ba6
29 changed files with 129 additions and 41 deletions

View file

@ -569,7 +569,7 @@ class Zip {
if ($inline) { if ($inline) {
$cd .= "inline"; $cd .= "inline";
} else{ } else{
$cd .= "attached"; $cd .= "attachment";
} }
if ($fileName) { if ($fileName) {
$cd .= '; filename="' . $fileName . '"'; $cd .= '; filename="' . $fileName . '"';

View file

@ -0,0 +1,5 @@
body: //div[@class='panel-panel panel-main-3 content-column']
title: //div[@class='panel-pane pane-node-title']
date: //div[@class='updated-date']
test_url: https://www.aclu.org/blog/free-future/chinas-nightmarish-citizen-scores-are-warning-americans

View file

@ -0,0 +1,5 @@
body: //div[@class='text_art']
strip: //div[@class='cab_datos_opinion']
strip: //div[@class='sumario2_left']
test_url: http://www.bez.es/382758623/otros-fracasos-empresas.html

View file

@ -1,9 +1,10 @@
# Instapaper gets this back to front and only gets the blog title instead of the article title. # Instapaper gets this back to front and only gets the blog title instead of the article title.
title: substring-before(//title, '-') title: //div[@class='title']
author: //a[ contains(@href, '/people') ] author: //a[ contains(@href, '/people') ]
body: //div[ @class='post' ] body: //div[ @class='post-content' ]
# Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous. # Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous.
test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n
test_url: https://blog.cloudflare.com/sha-1-deprecation-no-browser-left-behind

View file

@ -0,0 +1,3 @@
body: //div[@class="pf-content"]
test_url: http://www.caffereggio.net/2016/01/16/115327/

View file

@ -1,17 +1,10 @@
title: //h1[contains(@class, "entry-title")] title: //h1[contains(@class, "entry-title")]
author: //p[contains(@class, "byline")] author: //p[contains(@class, "byline")]
# blog articles (chronicle.com/blogs/*)
body: //div[contains(@class, "abstract")]
date: //p[contains(@class, "time")]
# all (?) other articles # all (?) other articles
body: //div[@id="article-body"] body: //div[@class="content-item__story"]
date: //p[contains(@class, "dateline")] date: //p[contains(@class, "dateline")]
# remove sidebars containing images (I assume this is desired for Instapaper) # note that if you're not a Chronicle subscriber (personally or institutionally), you'll only see the first couple of paragraphs of the article, and Instapaper $
strip: //div[@id="related"]
strip: //div[contains(@class, "image")]
# note that if you're not a Chronicle subscriber (personally or institutionally), you'll only see the first couple of paragraphs of the article, and Instapaper will display that with some crap above and below. thank goodness for that bookmarklet
test_url: http://chronicle.com/article/In-a-Land-of-Second-Chances/128375/ test_url: http://chronicle.com/article/In-a-Land-of-Second-Chances/128375/
test_url: http://chronicle.com/blogs/wiredcampus/university-run-boot-camps-offer-students-marketable-skills-but-not-course-credit/57494

View file

@ -0,0 +1,4 @@
body: //div[@class='widget full_article']
strip: //div[@class='Herramientas']
test_url: http://www.deia.com/2015/10/03/politica/euskadi/el-envilecimiento-de-la-politica-y-de-los-medios-de-comunicacion

View file

@ -0,0 +1,4 @@
body: //div[@class='field__items']
title: //div[@class='art_titulo']
test_url: https://www.diagonalperiodico.net/global/27947-cuanto-mas-tiempo-nos-aferremos-este-sistema-peor-y-menores-seran-nuestras-opciones

View file

@ -0,0 +1,3 @@
body: //div[@class='blog-content']
test_url: http://www.esglobal.org/el-caos-en-el-este-los-socios-de-la-ue-necesitan-que-se-les-preste-atencion/

View file

@ -0,0 +1,4 @@
body: //div[@class='field-items']
title: //div[@class='title']
test_url: https://lawfareblog.com/limits-panopticon

View file

@ -0,0 +1,3 @@
single_page_link: concat(link[@rel="canonical"], "?page=full")
test_url: http://www.letraslibres.com/revista/dossier/quien-manda-en-europa

View file

@ -0,0 +1,4 @@
body: //div[contains(@class,'widget full_article')]
test_url: http://www.naiz.eus/eu/actualidad/noticia/20151002/adegi-afirma-que-los-jovenes-viven-una-vida-muy-comoda-y-no-tienen-hambre-para-emprender#
test_url: http://www.naiz.eus/eu/actualidad/noticia/20151012/podemos-euskadi-critica-que-otegi-y-sus-companeros-quieran-pasar-por-grandes-pacifistas

View file

@ -0,0 +1,3 @@
body: //div[@id='article']
test_url: http://www.pieria.co.uk/articles/need_a_fiscal_rule_george__try_get_the_economy_growing

View file

@ -0,0 +1,6 @@
title: //div[@class='entry-title']
author: //div[@class='entry-author']
date: //div[@class='entry-time']
body: //div[@class='entry-content']
test_url: https://popehat.com/2015/12/16/eric-posner-the-first-amendments-nemesis/

View file

@ -0,0 +1,6 @@
title: //div[@class='entry-title']
author: //div[@class='entry-author']
date: //div[@class='entry-time']
body: //div[@class='entry-content']
test_url: http://rasgolatente.es/estupidez-psicologia-estupidos/

View file

@ -0,0 +1,3 @@
body: //div[@class='entry-content']
test_url: http://www.thenews.coop/98221/news/co-operatives/jeremy-corbyn-needs-co-op-movement/

View file

@ -0,0 +1,3 @@
body: //div[@class="col-md-12 radix-layouts-contentheader panel-panel"]
strip: //div[@class="htmlContent subscribe_box"]
test_url: https://www.timeshighereducation.com/blog/jeremy-corbyn-serious-about-free-higher-education

View file

@ -0,0 +1,8 @@
title: //meta[@name='Title']/@content
author: //meta[@name='Author']/@content
date: //meta[@name='DisplayDate']/@content
body: //div[@class='article-content']
strip: //div[@class='article-sidebar']
test_url: https://www.wired.de/collection/latest/der-vw-skandal-zeigt-ohne-vertrauen-ist-software-nicht-mehr-als-bose-magie

View file

@ -190,7 +190,7 @@ class Poche
{ {
case 'add': case 'add':
$content = Tools::getPageContent($url); $content = Tools::getPageContent($url);
$title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : parse_url($url, PHP_URL_HOST);
$body = $content['rss']['channel']['item']['description']; $body = $content['rss']['channel']['item']['description'];
// clean content from prevent xss attack // clean content from prevent xss attack
@ -908,7 +908,7 @@ class Poche
$entries = $this->store->retrieveAllWithTags($this->user->getId()); $entries = $this->store->retrieveAllWithTags($this->user->getId());
if ($entries) { if ($entries) {
echo $this->tpl->render('export.twig', array( echo $this->tpl->render('export.twig', array(
'export' => Tools::renderJson($entries), 'export' => Tools::renderJson(Tools::utf8ize($entries)),
)); ));
Tools::logm('export view'); Tools::logm('export view');
} else { } else {

View file

@ -141,7 +141,7 @@ final class Tools
public static function getFile($url) public static function getFile($url)
{ {
$timeout = 15; $timeout = 15;
$useragent = "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; $useragent = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0";
if (in_array ('curl', get_loaded_extensions())) { if (in_array ('curl', get_loaded_extensions())) {
# Fetch feed from URL # Fetch feed from URL
@ -232,6 +232,27 @@ final class Tools
exit(); exit();
} }
/**
* UTF-8 encode array of string
*
* @param $data
*/
public static function utf8ize($data)
{
if (is_array($data))
{
foreach ($data as $k => $v)
{
$data[$k] = self::utf8ize($v);
}
}
else if (is_string ($data) && '' == mb_detect_encoding($data))
{
return utf8_encode($data);
}
return $data;
}
/** /**
* Create new line in log file * Create new line in log file
* *

View file

@ -704,7 +704,7 @@ php composer.phar install</code></pre>
<li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li> <li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li>
<li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4"> <li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4">
<div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3. <div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3.
Install will failed if you check this while using an older MySQL server.</div></li> Install will fail if you check this while using an older MySQL server.</div></li>
</ul> </ul>
<?php } else { ?> <?php } else { ?>
<div class="messages notice"> <div class="messages notice">

View file

@ -45,7 +45,6 @@
<script> <script>
var baseurl = "{{ poche_url }}"; var baseurl = "{{ poche_url }}";
console.log(baseurl);
var data = { var data = {
"name": "wallabag", "name": "wallabag",

View file

@ -1,3 +1,20 @@
.messages {
display: block;
clear: both;
width: 400px;
margin: 10px auto 10px;
padding: 10px 0;
-moz-border-radius: 4px;
border-radius: 4px;
}
.messages p {
margin: 3px 0 3px 10px !important;
padding: 0 10px 0 23px !important;
font-size: 14px;
line-height: 16px;
}
.messages.error.install { .messages.error.install {
border: 1px solid #c42608; border: 1px solid #c42608;
color: #c00 !important; color: #c00 !important;
@ -17,3 +34,9 @@
background: #e0fbcc !important; background: #e0fbcc !important;
text-align: left; text-align: left;
} }
.messages.information,
.messages.info {
border: 1px solid #82aee7;
background: #dfebfb;
}

View file

@ -47,7 +47,7 @@
{{ nb_results }} {% trans "articles" %} {{ nb_results }} {% trans "articles" %}
{% endif %} {% endif %}
{% if view == 'home' or view == 'fav' or view == 'archive' %} {% if view == 'home' or view == 'fav' or view == 'archive' %}
<a href="?action=random&amp;view={{ view }}" class="icon icon-random"><span> {% trans "random" %}</span></a>{% endif %} <a href="?action=random&amp;view={{ view }}" title="{% trans "random" %}" class="icon icon-random"><span> {% trans "random" %}</span></a>{% endif %}
</div> </div>
{{ page_links | raw }} {{ page_links | raw }}
</div> </div>

View file

@ -113,14 +113,5 @@
// use keyboard to do actions // use keyboard to do actions
actionArticle('{{ entry.id|e }}'); actionArticle('{{ entry.id|e }}');
// swipe to right or left on mobile to navigate
$('article').on("swiperight", function(){
goLeft('?view=view&id={{ navigate.nextid|e }}');
});
$('article').on("swipeleft", function(){
goRight('?view=view&id={{ navigate.previousid|e }}');
});
</script> </script>
{% endblock %} {% endblock %}

View file

@ -42,7 +42,6 @@
<script> <script>
var baseurl = "{{ poche_url }}"; var baseurl = "{{ poche_url }}";
console.log(baseurl);
var data = { var data = {
"name": "wallabag", "name": "wallabag",

View file

@ -1 +1,6 @@
{{ messages | raw }} {{ messages | raw }}
{% if view == 'home' %}
<div class="messages information">
<p><a href="http://doc.wallabag.org">wallabag v2 is out, please read the documentation to upgrade.</a></p>
</div>
{% endif %}

View file

@ -52,7 +52,7 @@
{{ nb_results }} {% trans "articles" %} {{ nb_results }} {% trans "articles" %}
{% endif %} {% endif %}
{% if view == 'home' or view == 'fav' or view == 'archive' %} {% if view == 'home' or view == 'fav' or view == 'archive' %}
<a href="?action=random&amp;view={{ view }}" class="icon icon-random"><span> {% trans "random" %}</span></a>{% endif %} <a href="?action=random&amp;view={{ view }}" title="{% trans "random" %}" class="icon icon-random"><span> {% trans "random" %}</span></a>{% endif %}
</div> </div>
{{ page_links | raw }} {{ page_links | raw }}
</div> </div>

View file

@ -129,13 +129,5 @@
// Use left and right arrow to navigate on with keyboard // Use left and right arrow to navigate on with keyboard
navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}'); navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}');
// swipe to right or left on mobile to navigate
$('article').on("swiperight", function(){
goLeft('?view=view&id={{ navigate.nextid|e }}');
});
$('article').on("swipeleft", function(){
goRight('?view=view&id={{ navigate.previousid|e }}');
});
</script> </script>
{% endblock %} {% endblock %}