]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
#100: welcome to you, instapaper users
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Mon, 5 Aug 2013 07:43:33 +0000 (09:43 +0200)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Mon, 5 Aug 2013 07:43:33 +0000 (09:43 +0200)
inc/poche/Poche.class.php
inc/poche/config.inc.php
index.php
tpl/config.twig
tpl/login.twig
tpl/view.twig

index 5c3eda8065b27f75c6b9e535cfea54ff9e45c0fa..0d37e3c2cd62f83c3108d7c1dcc483fec332bce2 100644 (file)
@@ -212,6 +212,28 @@ class Poche
 
     private function importFromInstapaper()
     {
+        $html = new simple_html_dom();
+        $html->load_file('./instapaper-export.html');
+
+        $read = 0;
+        $errors = array();
+        foreach($html->find('ol') as $ul)
+        {
+            foreach($ul->find('li') as $li)
+            {
+                $a = $li->find('a');
+                $url = new Url(base64_encode($a[0]->href));
+                $this->action('add', $url);
+                if ($read == '1') {
+                    $last_id = $this->store->getLastId();
+                    $this->store->archiveById($last_id);
+                }
+            }
+            # Instapaper génère un fichier HTML avec deux <ol>
+            # Le premier concerne les éléments non lus
+            # Le second concerne les éléments archivés
+            $read = 1;
+        }
         Tools::logm('import from instapaper completed');
         Tools::redirect();
     }
index 67d0c8879368193a25536fb43d89919240996f62..a16098d16cdd90b97a60005499dc66adde5d4d10 100644 (file)
@@ -8,12 +8,13 @@
  * @license    http://www.wtfpl.net/ see COPYING file
  */
 
-define ('POCHE_VERSION', '0.4');
-define ('MODE_DEMO', FALSE);
+define ('POCHE_VERSION', '1.0-alpha');
+define ('MODE_DEMO', TRUE);
 define ('DEBUG_POCHE', FALSE);
 define ('CONVERT_LINKS_FOOTNOTES', FALSE);
 define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
 define ('DOWNLOAD_PICTURES', FALSE);
+define ('SHARE_TWITTER', TRUE);
 define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
 define ('ABS_PATH', 'assets/');
 define ('TPL', './tpl');
index 94c72a275114510b0c7b352405646622fdb786d0..294620d1ebcc4136bc0f3c10d860a200a3bd283d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -49,7 +49,6 @@ $tpl_vars = array(
     'referer' => $referer,
     'view' => $view,
     'poche_url' => Tools::getPocheUrl(),
-    'demo' => MODE_DEMO,
     'title' => _('poche, a read it later open source system'),
     'token' => Session::getToken(),
 );
index c18806bc6765c572db5c9a857947c16f3637bb28..dc49ee39359aff091e8e04f5a31449097659f41e 100644 (file)
@@ -42,6 +42,7 @@
                 <p><ul>
                 <li><a href="./?import&from=pocket">{% trans "import from Pocket" %}</a> (you must have a "ril_export.html" file on your server)</li>
                 <li><a href="./?import&from=readability">{% trans "import from Readability" %}</a>  (you must have a "readability" file on your server)</li>
+                <li><a href="./?import&from=instapaper">{% trans "import from Instapaper" %}</a>  (you must have a "instapaper-export.html" file on your server)</li>
                 </ul></p>
 
                 <h2>{% trans "Export your poche datas" %}</h2>
index c3028795b0f12a5742fc9507d18b5a7d8bf5dd2b..b24674e2be493e0295b16679084e4dfa07dfa7cd 100644 (file)
@@ -5,15 +5,15 @@
             <form method="post" action="?login" name="loginform">
                 <fieldset class="w500p center">
                     <h2 class="mbs txtcenter">{% trans "login to your poche" %}</h2>
-                    {% if demo == 1 %}<p>{% trans "you are in demo mode, some features may be disabled." %}</p>{% endif %}
+                    {% if constant('MODE_DEMO') == 1 %}<p>{% trans "you are in demo mode, some features may be disabled." %}</p>{% endif %}
                                        <div class="row">
                                                <label class="col w150p" for="login">{% trans "Login" %}</label>
-                                               <input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus {% if demo == 1 %}value="poche"{% endif %} />
+                                               <input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
                                        </div>
 
                                        <div class="row">
                                                <label class="col w150p" for="password">{% trans "Password" %}</label>
-                                               <input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2" {% if demo == 1 %}value="poche"{% endif %} />
+                                               <input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2" {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
                                        </div>
                                        <div class="row">
                                                <label class="col w150p" for="longlastingsession">{% trans "Stay signed in" %}</label>
index 8ef5cd9c2f2f7c8942e6af0fd1ea3cb9abc6d28d..bf9a9af916e3504cf2bf2ec9b754bc41209dcc34 100644 (file)
@@ -8,6 +8,7 @@
                </div>
             <div class="tools">
                 <ul>
+                    {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title}}%20{{ entry.url|e }}%20via%20@getpoche" target="_blank" class="tool twitter"><span></span></a></li>{% endif %}
                     <li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" onclick="toggle_archive(this, {{ entry.id|e }})"><span></span></a></li>
                     <li><a href="#" id="themeswitch">{% trans "dark" %}</a></li>
                     <li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" onclick="toggle_favorite(this, {{ entry.id|e }})"><span></span></a></li>