diff options
author | redmatrix <git@macgirvin.com> | 2016-02-24 15:19:28 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-02-24 15:19:28 -0800 |
commit | 7e6febe2a6609457eca1f1caf650375534780048 (patch) | |
tree | 96f1715d8e72f69db0c7c32c646cb0a54aafb565 | |
parent | b101a8f6fb3fd3ec0d5466ba1bb7bc9dc9480fba (diff) | |
download | volse-hubzilla-7e6febe2a6609457eca1f1caf650375534780048.tar.gz volse-hubzilla-7e6febe2a6609457eca1f1caf650375534780048.tar.bz2 volse-hubzilla-7e6febe2a6609457eca1f1caf650375534780048.zip |
add 'requires' field to plugin info to list other dependent plugins/addons and disable if dependencies are not installed/enabled
-rwxr-xr-x | include/plugin.php | 19 | ||||
-rw-r--r-- | mod/admin.php | 2 | ||||
-rw-r--r-- | mod/xrd.php | 4 | ||||
-rwxr-xr-x | view/tpl/admin_plugins_details.tpl | 3 |
4 files changed, 23 insertions, 5 deletions
diff --git a/include/plugin.php b/include/plugin.php index 5afded542..bd844442f 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -325,7 +325,8 @@ function get_plugin_info($plugin){ 'description' => '', 'author' => array(), 'maintainer' => array(), - 'version' => '' + 'version' => '', + 'requires' => '' ); if (!is_file("addon/$plugin/$plugin.php")) @@ -383,6 +384,22 @@ function check_plugin_versions($info) { } } + if(array_key_exists('requires',$info)) { + $arr = explode(',',$info['requires']); + $found = true; + if($arr) { + foreach($arr as $test) { + $test = trim($test); + if(! $test) + continue; + if(! in_array($test,get_app()->plugins)) + $found = false; + } + } + if(! $found) + return false; + } + return true; } diff --git a/mod/admin.php b/mod/admin.php index 5195db320..292a4e66a 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1275,7 +1275,7 @@ function admin_page_plugins(&$a){ '$str_minversion' => t('Minimum project version: '), '$str_maxversion' => t('Maximum project version: '), '$str_minphpversion' => t('Minimum PHP version: '), - + '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), '$admin_form' => $admin_form, diff --git a/mod/xrd.php b/mod/xrd.php index 34ed47149..da4ab51a4 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -35,8 +35,6 @@ function xrd_init(&$a) { header("Content-type: application/xrd+xml"); - $tpl = get_markup_template('view/xrd_person.tpl'); - $o = replace_macros(get_markup_template('xrd_person.tpl'), array( '$nick' => $r[0]['channel_address'], '$accturi' => $uri, @@ -51,7 +49,7 @@ function xrd_init(&$a) { // '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', -// '$bigkey' => salmon_key($r[0]['pubkey']) + '$bigkey' => salmon_key($r[0]['channel_pubkey']) )); diff --git a/view/tpl/admin_plugins_details.tpl b/view/tpl/admin_plugins_details.tpl index 721bd3573..5d9e233f9 100755 --- a/view/tpl/admin_plugins_details.tpl +++ b/view/tpl/admin_plugins_details.tpl @@ -24,6 +24,9 @@ {{if $info.minphpversion}} <p class="versionlimit">{{$str_minphpversion}}{{$info.minphpversion}}</p> {{/if}} + {{if $info.requires}} + <p class="versionlimit">{{$str_requires}}{{$info.requires}}</p> + {{/if}} {{foreach $info.maintainer as $a}} |