Skip to content

Commit

Permalink
Simplify code to list installed plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed Jun 2, 2014
1 parent c892b7f commit 44f6f69
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions manage_plugin_page.php
Expand Up @@ -64,7 +64,6 @@ function ( $p1, $p2 ) {

$t_plugins_installed = array();
$t_plugins_available = array();
$t_forced_plugins = config_get_global( 'plugins_force_installed' );

foreach( $t_plugins as $t_basename => $t_plugin ) {
if( plugin_is_registered( $t_basename ) ) {
Expand Down Expand Up @@ -113,7 +112,6 @@ function ( $p1, $p2 ) {
$t_url = $t_plugin->url;
$t_requires = $t_plugin->requires;
$t_depends = array();
$t_forced = isset( $t_forced_plugins[ $t_basename ] );
$t_priority = plugin_priority( $t_basename );
$t_protected = plugin_protected( $t_basename );

Expand All @@ -139,7 +137,6 @@ function ( $p1, $p2 ) {
}

$t_upgrade = plugin_needs_upgrade( $t_plugin );
$t_uninstall = ( 'MantisCore' != $t_basename && !$t_protected );

if ( is_array( $t_requires ) ) {
foreach( $t_requires as $t_plugin => $t_version ) {
Expand Down Expand Up @@ -170,16 +167,20 @@ function ( $p1, $p2 ) {
echo '<td class="small center">',$t_depends,'</td>';
if ( 'MantisCore' == $t_basename ) {
echo '<td>&#160;</td><td>&#160;</td>';
} else if ( $t_forced ) {
echo '<td class="center">','<select disabled="disabled">',print_plugin_priority_list( $t_priority ),'</select>','</td>';
echo '<td class="center">','<input type="checkbox" checked="checked" disabled="disabled"/>','</td>';
} else {
echo '<td class="center">','<select name="priority_',$t_basename,'">',print_plugin_priority_list( $t_priority ),'</select>','</td>';
echo '<td class="center">','<input type="checkbox" name="protected_',$t_basename,'" '.( $t_protected ? 'checked="checked" ' : '').'/>','</td>';
echo '<td class="center">',
'<select name="priority_' . $t_basename . '"',
check_disabled( $t_protected ), '>',
print_plugin_priority_list( $t_priority ),
'</select>','</td>';
echo '<td class="center">',
'<input type="checkbox" name="protected_' . $t_basename . '"',
check_disabled( $t_protected ), check_checked( $t_protected ), ' />',
'</select>','</td>';
}
echo '<td class="center">';
if ( $t_upgrade ) { print_bracket_link( 'manage_plugin_upgrade.php?name=' . $t_basename . form_security_param( 'manage_plugin_upgrade' ), lang_get( 'plugin_upgrade' ) ); }
if ( $t_uninstall ) { print_bracket_link( 'manage_plugin_uninstall.php?name=' . $t_basename . form_security_param( 'manage_plugin_uninstall' ), lang_get( 'plugin_uninstall' ) ); }
if ( !$t_protected ) { print_bracket_link( 'manage_plugin_uninstall.php?name=' . $t_basename . form_security_param( 'manage_plugin_uninstall' ), lang_get( 'plugin_uninstall' ) ); }
echo '</td></tr>';
} ?>
</tbody>
Expand Down

0 comments on commit 44f6f69

Please sign in to comment.