From: Nicolas Lœuillet Date: Sun, 25 Aug 2013 05:44:09 +0000 (-0700) Subject: Merge pull request #169 from NumEricR/entries-height X-Git-Tag: 1.0-beta4~11 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=e6a8dd60af37ec2a32d8587c47ba54101a56ad87;hp=6a7d7790247fdf7fdb2992638de700f6ba7da366;p=github%2Fwallabag%2Fwallabag.git Merge pull request #169 from NumEricR/entries-height Entries height with short description --- diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d6ba132..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: php - -php: - - 5.4 - -branches: - only: - - dev - -before_script: - - composer install - -notifications: - email: - - nicolas.loeuillet@gmail.com \ No newline at end of file diff --git a/COPYING b/COPYING.md similarity index 100% rename from COPYING rename to COPYING.md diff --git a/CREDITS b/CREDITS.md similarity index 100% rename from CREDITS rename to CREDITS.md diff --git a/TODO.md b/TODO.md index ac3c0e98..fdba2a51 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,9 @@ # TODO -pouvoir annuler la suppression -conventions codage ? phing ? vérifier error_log qui trainent -phpDocumentor -minifier css -revoir tous les css -barre fixe d'admin sur la page d'un billet ? -revoir export (export vers pocket &cie ? ) -raccourcis clavier -date d'ajout d'un lien \ No newline at end of file +* pouvoir annuler la suppression +* conventions codage ? phing ? vérifier error_log qui trainent +* phpDocumentor +* minifier css +* barre fixe d'admin sur la page d'un billet ? +* revoir export (export vers pocket &cie ? ) +* raccourcis clavier \ No newline at end of file diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4832f816..cb338766 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -364,13 +364,14 @@ class Poche /** * import from Instapaper. poche needs a ./instapaper-export.html file * @todo add the return value + * @param string $targetFile the file used for importing * @return boolean */ - private function importFromInstapaper() + private function importFromInstapaper($targetFile) { # TODO gestion des articles favs $html = new simple_html_dom(); - $html->load_file('./instapaper-export.html'); + $html->load_file($targetFile); Tools::logm('starting import from instapaper'); $read = 0; @@ -403,13 +404,14 @@ class Poche /** * import from Pocket. poche needs a ./ril_export.html file * @todo add the return value + * @param string $targetFile the file used for importing * @return boolean */ - private function importFromPocket() + private function importFromPocket($targetFile) { # TODO gestion des articles favs $html = new simple_html_dom(); - $html->load_file('./ril_export.html'); + $html->load_file($targetFile); Tools::logm('starting import from pocket'); $read = 0; @@ -442,12 +444,13 @@ class Poche /** * import from Readability. poche needs a ./readability file * @todo add the return value + * @param string $targetFile the file used for importing * @return boolean */ - private function importFromReadability() + private function importFromReadability($targetFile) { # TODO gestion des articles lus / favs - $str_data = file_get_contents("./readability"); + $str_data = file_get_contents($targetFile); $data = json_decode($str_data,true); Tools::logm('starting import from Readability'); $count = 0; @@ -499,15 +502,31 @@ class Poche */ public function import($from) { - if ($from == 'pocket') { - return $this->importFromPocket(); + $providers = array( + 'pocket' => 'importFromPocket', + 'readability' => 'importFromReadability', + 'instapaper' => 'importFromInstapaper' + ); + + if (! isset($providers[$from])) { + $this->messages->add('e', _('Unknown import provider.')); + Tools::redirect(); } - else if ($from == 'readability') { - return $this->importFromReadability(); + + $targetDefinition = 'IMPORT_' . strtoupper($from) . '_FILE'; + $targetFile = constant($targetDefinition); + + if (! defined($targetDefinition)) { + $this->messages->add('e', _('Incomplete inc/poche/define.inc.php file, please define "' . $targetDefinition . '".')); + Tools::redirect(); } - else if ($from == 'instapaper') { - return $this->importFromInstapaper(); + + if (! file_exists($targetFile)) { + $this->messages->add('e', _('Could not find required "' . $targetFile . '" import file.')); + Tools::redirect(); } + + $this->$providers[$from]($targetFile); } /** diff --git a/inc/poche/Url.class.php b/inc/poche/Url.class.php index 3c74fb43..d7ee911f 100644 --- a/inc/poche/Url.class.php +++ b/inc/poche/Url.class.php @@ -27,9 +27,7 @@ class Url public function isCorrect() { - $pattern = '|^(.*:)//([a-z\-.]+)(:[0-9]+)?(.*)$|i'; - - return preg_match($pattern, $this->url); + return filter_var($this->url, FILTER_VALIDATE_URL) !== FALSE; } public function clean() @@ -73,7 +71,7 @@ class Url if (preg_replace('/\s+/', '', $body->value) !== "") { $html = $tidy->value; } - } + } $parameters = array(); if (isset($html) and strlen($html) > 0) diff --git a/inc/poche/define.inc.php b/inc/poche/define.inc.php index 2154ce88..2d0a39ec 100644 --- a/inc/poche/define.inc.php +++ b/inc/poche/define.inc.php @@ -29,4 +29,8 @@ define ('TPL', __DIR__ . '/../../tpl'); define ('LOCALE', __DIR__ . '/../../locale'); define ('CACHE', __DIR__ . '/../../cache'); define ('PAGINATION', '10'); -define ('THEME', 'light'); \ No newline at end of file +define ('THEME', 'light'); + +define ('IMPORT_POCKET_FILE', './ril_export.html'); +define ('IMPORT_READABILITY_FILE', './readability'); +define ('IMPORT_INSTAPAPER_FILE', './instapaper-export.html'); \ No newline at end of file diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo index c0d4a9d6..ec72b830 100644 Binary files a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo and b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo differ diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po index 7f8cf784..a643f6e3 100644 --- a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po +++ b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po @@ -2,14 +2,14 @@ msgid "" msgstr "" "Project-Id-Version: poche\n" "POT-Creation-Date: 2013-08-06 08:35+0100\n" -"PO-Revision-Date: 2013-08-06 08:35+0100\n" -"Last-Translator: Nicolas Lœuillet \n" +"PO-Revision-Date: 2013-08-24 10:25+0100\n" +"Last-Translator: Eric R (NumEricR)\n" "Language-Team: poche \n" "Language: Français\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.5.4\n" +"X-Generator: Poedit 1.5.7\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" "X-Poedit-Basepath: /\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" @@ -303,7 +303,7 @@ msgstr "(à ne pas cocher sur un ordinateur public)" #: /var/www/poche-i18n/cache/ae/26/05eb67771213c16bd8c9aaf2d2c4.php:93 msgid "Sign in" -msgstr "" +msgstr "Se connecter" #: /var/www/poche-i18n/cache/dd/a8/530129765655dcde0a70a31a78b6.php:55 #: /var/www/poche-i18n/cache/dd/a8/530129765655dcde0a70a31a78b6.php:57 diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index e69de29b..00000000 diff --git a/tpl/config.twig b/tpl/config.twig index 8851c3dc..89d5bf84 100644 --- a/tpl/config.twig +++ b/tpl/config.twig @@ -11,24 +11,21 @@ {% endblock %} {% block content %} -

{% trans "Poching a link" %}

You can poche a link by several methods: (?)

-

-

-

+ +

{% trans "Updating poche" %}

-