]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #651 from ArthurHoaro/plugin-isso2
authorArthur <arthur@hoa.ro>
Tue, 18 Oct 2016 06:14:09 +0000 (08:14 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2016 06:14:09 +0000 (08:14 +0200)
Isso comments plugin

application/FeedBuilder.php
tests/FeedBuilderTest.php
tpl/daily.html
tpl/dailyrss.html
tpl/export.bookmarks.html
tpl/feed.atom.html
tpl/feed.rss.html
tpl/linklist.html
tpl/page.header.html
tpl/picwall.html
tpl/tagcloud.html

index 58c6bb179a636688a648bab720e43930306d5f1a..c6657fbb483215074a4bd5ce5cb57adf6a4276ff 100644 (file)
@@ -124,7 +124,8 @@ class FeedBuilder
         $data['last_update'] = $this->getLatestDateFormatted();
         $data['show_dates'] = !$this->hideDates || $this->isLoggedIn;
         // Remove leading slash from REQUEST_URI.
-        $data['self_link'] = $pageaddr . escape(ltrim($this->serverInfo['REQUEST_URI'], '/'));
+        $data['self_link'] = escape(server_url($this->serverInfo))
+                           . escape($this->serverInfo['REQUEST_URI']);
         $data['index_url'] = $pageaddr;
         $data['usepermalinks'] = $this->usePermalinks === true;
         $data['links'] = $linkDisplayed;
index c9ff397d153e928c87ef1276f22307af62b63607..aa57f44e7c30c5b0dce249aeabb1bcdcdbe78b3d 100644 (file)
@@ -217,4 +217,37 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
         $this->assertEquals('http://pubsubhub.io', $data['pubsubhub_url']);
     }
+
+    /**
+     * Test buildData when Shaarli is served from a subdirectory
+     */
+    public function testBuildDataServerSubdir()
+    {
+        $serverInfo = array(
+            'HTTPS' => 'Off',
+            'SERVER_NAME' => 'host.tld',
+            'SERVER_PORT' => '8080',
+            'SCRIPT_NAME' => '/~user/shaarli/index.php',
+            'REQUEST_URI' => '/~user/shaarli/index.php?do=feed',
+        );
+        $feedBuilder = new FeedBuilder(
+            self::$linkDB,
+            FeedBuilder::$FEED_ATOM,
+            $serverInfo,
+            null,
+            false
+        );
+        $feedBuilder->setLocale(self::$LOCALE);
+        $data = $feedBuilder->buildData();
+
+        $this->assertEquals(
+            'http://host.tld:8080/~user/shaarli/index.php?do=feed',
+            $data['self_link']
+        );
+
+        // Test first link (note link)
+        $link = array_shift($data['links']);
+        $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']);
+        $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']);
+    }
 }
index dde1f376022b345212addcf5f9357c02da456401..b82ad4831fe50baf8c92aea3a3d1750a9da81544 100644 (file)
     <div class="clear"></div>
 
     {if="$linksToDisplay"}
-        {loop="cols"}
+        {loop="$cols"}
             {if="isset($value[0])"}
             <div id="daily_col{$counter+1}">
-                {loop="value"}
+                {loop="$value"}
                     {$link=$value}
                     <div class="dailyEntry">
                         <div class="dailyEntryPermalink">
@@ -60,7 +60,7 @@
                         {/if}
                         {if="$link.tags"}
                             <div class="dailyEntryTags">
-                                {loop="link.taglist"}
+                                {loop="$link.taglist"}
                                     {$value} -
                                 {/loop}
                             </div>
index b14a38595c6038620317cea2d0d8157e1261658e..ddbd6c5ea49ba5a0d3b68238471a7c06d3f42e41 100644 (file)
@@ -4,7 +4,7 @@
     <link>{$absurl}</link>
     <pubDate>{$rssdate}</pubDate>
     <description><![CDATA[
-        {loop="links"}
+        {loop="$links"}
                <h3><a href="{$value.url}">{$value.title}</a></h3>
                <small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br>
                {$value.url}</small><br>
index da7332571d2c6c58bc9c30bdeeb344a211c06c15..127a5c209c1e1a9a1e6926ad83a7fc662686ea39 100644 (file)
@@ -5,6 +5,6 @@
      Do Not Edit! -->{ignore}The RainTPL loop is formatted to avoid generating extra newlines{/ignore}
 <TITLE>{$pagetitle}</TITLE>
 <H1>Shaarli export of {$selection} bookmarks on {$date}</H1>
-<DL><p>{loop="links"}
+<DL><p>{loop="$links"}
 <DT><A HREF="{$value.url}" ADD_DATE="{$value.timestamp}" PRIVATE="{$value.private}" TAGS="{$value.taglist}">{$value.title}</A>{if="$value.description"}{$eol}<DD>{$value.description}{/if}{/loop}
 </DL><p>
index 1932f507cf614178c605ab3ea6f236b3609e1037..40fd421a4244b93f25a4a2486cf30fbe012f3b91 100644 (file)
@@ -17,7 +17,7 @@
   </author>
   <id>{$index_url}</id>
   <generator>Shaarli</generator>
-  {loop="links"}
+  {loop="$links"}
     <entry>
       <title>{$value.title}</title>
       {if="$usepermalinks"}
index 4bfe4196c24abfdc6b4c94bda104adce5fe99824..e18dbf9bcea3f70f6ec4578ff12571e002a06cc8 100644 (file)
@@ -12,7 +12,7 @@
       <!-- PubSubHubbub Discovery -->
       <atom:link rel="hub" href="{$pubsubhub_url}" />
     {/if}
-    {loop="links"}
+    {loop="$links"}
       <item>
         <title>{$value.title}</title>
         <guid isPermaLink="{if="$usepermalinks"}true{else}false{/if}">{$value.guid}</guid>
index 9979f12ab3a357c8b9995b8004c25968a4d6f951..ddfd729ac9500dd3a534e8a3927af8243f38a329 100644 (file)
@@ -63,7 +63,7 @@
         </div>
     {/if}
     <ul>
-        {loop="links"}
+        {loop="$links"}
         <li{if="$value.class"} class="{$value.class}"{/if}>
             <a id="{$value.shorturl}"></a>
             <div class="thumbnail">{$value.url|thumbnail}</div>
                 <a href="{$value.real_url}"><span class="linkurl" title="Short link">{$value.url}</span></a><br>
                 {if="$value.tags"}
                     <div class="linktaglist">
-                    {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value}</a></span> {/loop}
+                    {loop="$value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value}</a></span> {/loop}
                     </div>
                 {/if}
 
index 0012c689f8aa1a872f18af7b14e4d46c9efd3804..eac2ed4aa5acc20ad55d626f0030d1cf85897038 100644 (file)
@@ -43,7 +43,7 @@
 
 {if="!empty($plugin_errors) && isLoggedIn()"}
     <ul class="errors">
-        {loop="plugin_errors"}
+        {loop="$plugin_errors"}
             <li>{$value}</li>
         {/loop}
     </ul>
index 230c948b783d9f1fc550bb594e4709b89b9ddf44..4e227e3744038cd440fed8e89e8d3564ce87e6db 100644 (file)
@@ -14,7 +14,7 @@
 
 <div class="center">
         <div id="picwall_container">
-            {loop="linksToDisplay"}
+            {loop="$linksToDisplay"}
             <div class="picwall_pictureframe">
                    {$value.thumbnail}<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
                 {loop="$value.picwall_plugin"}
index e449f2939fe095ca1138b4c4f02a6d64289ae83d..05e45273ffa284a61f5a71714bf1e6e93b18fad2 100644 (file)
@@ -11,7 +11,7 @@
     </div>
 
     <div id="cloudtag">
-        {loop="tags"}
+        {loop="$tags"}
             <span class="count">{$value.count}</span><a
                 href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a>
             {loop="$value.tag_plugin"}