Merge pull request #4350 from MrPetovan/task/4116-move-twitteroauth-to-composer

Move TwitterOAuth to composer Part 1
This commit is contained in:
Michael Vogel 2018-01-28 19:19:21 +01:00 committed by GitHub
commit 946fc82c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 27 deletions

View file

@ -254,17 +254,17 @@ class Addon
* *
* like * like
* \code * \code
*...* Name: addon * * Name: addon
* * Description: An addon which plugs in * * Description: An addon which plugs in
* . * Version: 1.2.3 * . * Version: 1.2.3
* * Author: John <profile url> * * Author: John <profile url>
* * Author: Jane <email> * * Author: Jane <email>
* * Maintainer: Jess <email>
* * * *
* *\endcode * *\endcode
* @param string $addon the name of the addon * @param string $addon the name of the addon
* @return array with the addon information * @return array with the addon information
*/ */
public static function getInfo($addon) public static function getInfo($addon)
{ {
$a = get_app(); $a = get_app();
@ -273,6 +273,7 @@ class Addon
'name' => $addon, 'name' => $addon,
'description' => "", 'description' => "",
'author' => [], 'author' => [],
'maintainer' => [],
'version' => "", 'version' => "",
'status' => "" 'status' => ""
]; ];
@ -292,18 +293,18 @@ class Addon
foreach ($ll as $l) { foreach ($ll as $l) {
$l = trim($l, "\t\n\r */"); $l = trim($l, "\t\n\r */");
if ($l != "") { if ($l != "") {
list($k,$v) = array_map("trim", explode(":", $l, 2)); list($type, $v) = array_map("trim", explode(":", $l, 2));
$k= strtolower($k); $type = strtolower($type);
if ($k == "author") { if ($type == "author" || $type == "maintainer") {
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m); $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) { if ($r) {
$info['author'][] = ['name'=>$m[1], 'link'=>$m[2]]; $info[$type][] = ['name' => $m[1], 'link' => $m[2]];
} else { } else {
$info['author'][] = ['name'=>$v]; $info[$type][] = ['name' => $v];
} }
} else { } else {
if (array_key_exists($k, $info)) { if (array_key_exists($type, $info)) {
$info[$k]=$v; $info[$type] = $v;
} }
} }
} }

View file

@ -6,14 +6,14 @@
<p>{{$info.description}}</p> <p>{{$info.description}}</p>
<p class="author">{{$str_author}} <p class="author">{{$str_author}}
{{foreach $info.author as $a}} {{foreach $info.author as $a name=authors}}
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}, {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.authors.last}}{{else}}, {{/if}}
{{/foreach}} {{/foreach}}
</p> </p>
<p class="maintainer">{{$str_maintainer}} <p class="maintainer">{{$str_maintainer}}
{{foreach $info.maintainer as $a}} {{foreach $info.maintainer as $a name=maintainers}}
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}, {{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.maintainers.last}}{{else}}, {{/if}}
{{/foreach}} {{/foreach}}
</p> </p>