]> git.mxchange.org Git - friendica.git/commitdiff
Improve addon readme display
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 28 Jan 2018 05:05:28 +0000 (00:05 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 28 Jan 2018 05:10:22 +0000 (00:10 -0500)
- Add maintainer display support
- Remove extra comma after author/maintainer lists

src/Core/Addon.php
view/templates/admin/plugins_details.tpl

index b1f401d28b42aaac2bdb19ce9c7ffa70318b777a..af1d71ac4ec3445ca8e0b9098c00b0394b6d9634 100644 (file)
@@ -254,25 +254,26 @@ class Addon
         *\r
         * like\r
         * \code\r
-        *...* Name: addon\r
-       *   * Description: An addon which plugs in\r
-       * . * Version: 1.2.3\r
-       *   * Author: John <profile url>\r
-       *   * Author: Jane <email>\r
-       *   *\r
-       *  *\endcode\r
-       * @param string $addon the name of the addon\r
-       * @return array with the addon information\r
-       */\r
-\r
+        *   * Name: addon\r
+        *   * Description: An addon which plugs in\r
+        * . * Version: 1.2.3\r
+        *   * Author: John <profile url>\r
+        *   * Author: Jane <email>\r
+        *   * Maintainer: Jess <email>\r
+        *   *\r
+        *   *\endcode\r
+        * @param string $addon the name of the addon\r
+        * @return array with the addon information\r
+        */\r
        public static function getInfo($addon)\r
        {\r
                $a = get_app();\r
 \r
-               $info=[\r
+               $info = [\r
                        'name' => $addon,\r
                        'description' => "",\r
                        'author' => [],\r
+                       'maintainer' => [],\r
                        'version' => "",\r
                        'status' => ""\r
                ];\r
@@ -292,18 +293,18 @@ class Addon
                        foreach ($ll as $l) {\r
                                $l = trim($l, "\t\n\r */");\r
                                if ($l != "") {\r
-                                       list($k,$v) = array_map("trim", explode(":", $l, 2));\r
-                                       $k= strtolower($k);\r
-                                       if ($k == "author") {\r
-                                               $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);\r
+                                       list($type, $v) = array_map("trim", explode(":", $l, 2));\r
+                                       $type = strtolower($type);\r
+                                       if ($type == "author" || $type == "maintainer") {\r
+                                               $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);\r
                                                if ($r) {\r
-                                                       $info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];\r
+                                                       $info[$type][] = ['name' => $m[1], 'link' => $m[2]];\r
                                                } else {\r
-                                                       $info['author'][] = ['name'=>$v];\r
+                                                       $info[$type][] = ['name' => $v];\r
                                                }\r
                                        } else {\r
-                                               if (array_key_exists($k, $info)) {\r
-                                                       $info[$k]=$v;\r
+                                               if (array_key_exists($type, $info)) {\r
+                                                       $info[$type] = $v;\r
                                                }\r
                                        }\r
                                }\r
index cbeb4171e871193b1c57bab02b5d5d73a8c7424b..05e3e8aa05bbc2135c46fadfcda35243962c9aaa 100644 (file)
@@ -1,22 +1,22 @@
 
 <div id='adminpage'>
        <h1>{{$title}} - {{$page}}</h1>
-       
+
        <p><span class='toggleplugin icon {{$status}}'></span> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$addon}}/?a=t&amp;t={{$form_security_token}}">{{$action}}</a></p>
        <p>{{$info.description}}</p>
-       
+
        <p class="author">{{$str_author}}
-       {{foreach $info.author as $a}}
-               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
+       {{foreach $info.author as $a name=authors}}
+               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.authors.last}}{{else}}, {{/if}}
        {{/foreach}}
        </p>
 
        <p class="maintainer">{{$str_maintainer}}
-       {{foreach $info.maintainer as $a}}
-               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
+       {{foreach $info.maintainer as $a name=maintainers}}
+               {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.maintainers.last}}{{else}}, {{/if}}
        {{/foreach}}
        </p>
-       
+
        {{if $screenshot}}
        <a href="{{$screenshot.0}}" class='screenshot'><img src="{{$screenshot.0}}" alt="{{$screenshot.1}}" /></a>
        {{/if}}