start on refactor of plugin/theme/widget info block parsing
This commit is contained in:
parent
7a9fe0907a
commit
36717e5f32
@ -313,7 +313,6 @@ function call_hooks($name, &$data = null) {
|
|||||||
* * Version: 1.2.3
|
* * Version: 1.2.3
|
||||||
* * Author: John <profile url>
|
* * Author: John <profile url>
|
||||||
* * Author: Jane <email>
|
* * Author: Jane <email>
|
||||||
* * Compat: Red [(version)], Friendica [(version)]
|
|
||||||
* *
|
* *
|
||||||
*\endcode
|
*\endcode
|
||||||
* @param string $plugin the name of the plugin
|
* @param string $plugin the name of the plugin
|
||||||
@ -325,8 +324,8 @@ function get_plugin_info($plugin){
|
|||||||
'name' => $plugin,
|
'name' => $plugin,
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'author' => array(),
|
'author' => array(),
|
||||||
'version' => '',
|
'maintainer' => array(),
|
||||||
'compat' => ''
|
'version' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!is_file("addon/$plugin/$plugin.php"))
|
if (!is_file("addon/$plugin/$plugin.php"))
|
||||||
@ -342,21 +341,22 @@ function get_plugin_info($plugin){
|
|||||||
if ($l != ""){
|
if ($l != ""){
|
||||||
list($k, $v) = array_map("trim", explode(":", $l, 2));
|
list($k, $v) = array_map("trim", explode(":", $l, 2));
|
||||||
$k = strtolower($k);
|
$k = strtolower($k);
|
||||||
if ($k == 'author'){
|
if ($k == 'author' || $k == 'maintainer'){
|
||||||
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
|
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$info['author'][] = array('name' => $m[1], 'link' => $m[2]);
|
$info[$k][] = array('name' => $m[1], 'link' => $m[2]);
|
||||||
} else {
|
} else {
|
||||||
$info['author'][] = array('name' => $v);
|
$info[$k][] = array('name' => $v);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists($k, $info)){
|
// if (array_key_exists($k, $info)){
|
||||||
$info[$k] = $v;
|
$info[$k] = $v;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2015-12-21.1253
|
2015-12-22.1254
|
||||||
|
@ -4,17 +4,18 @@
|
|||||||
<p><i class='toggleplugin {{if $status==on}}icon-check{{else}}icon-check-empty{{/if}} admin-icons'></i> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/?a=t&t={{$form_security_token}}">{{$action}}</a></p>
|
<p><i class='toggleplugin {{if $status==on}}icon-check{{else}}icon-check-empty{{/if}} admin-icons'></i> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/?a=t&t={{$form_security_token}}">{{$action}}</a></p>
|
||||||
<p>{{$info.description}}</p>
|
<p>{{$info.description}}</p>
|
||||||
|
|
||||||
<p class="author">{{$str_author}}
|
|
||||||
{{foreach $info.author as $a}}
|
{{foreach $info.author as $a}}
|
||||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
|
<p class="author">{{$str_author}}
|
||||||
{{/foreach}}
|
{{$a.name}}{{if $a.link}} {{$a.link}}{{/if}}
|
||||||
</p>
|
</p>
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
|
||||||
<p class="maintainer">{{$str_maintainer}}
|
|
||||||
{{foreach $info.maintainer as $a}}
|
{{foreach $info.maintainer as $a}}
|
||||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
|
<p class="maintainer">{{$str_maintainer}}
|
||||||
{{/foreach}}
|
{{$a.name}}{{if $a.link}} {{$a.link}}{{/if}}
|
||||||
</p>
|
</p>
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{if $screenshot}}
|
{{if $screenshot}}
|
||||||
<a href="{{$screenshot.0}}" class='screenshot'><img src="{{$screenshot.0}}" alt="{{$screenshot.1}}" /></a>
|
<a href="{{$screenshot.0}}" class='screenshot'><img src="{{$screenshot.0}}" alt="{{$screenshot.1}}" /></a>
|
||||||
|
Reference in New Issue
Block a user