/**
  * Display our modified plugins table above the regular plugin table.
  * Accomodates both WP 3.0 and 3.1+.
  *
  * @uses Network_Plugins_List_Table
  */
 function display()
 {
     global $wp_version, $s;
     if (current_user_can('manage_network_plugins')) {
         echo '<h3>' . __('Currently Active Network Plugins', 'bnp') . '</h3>';
         echo '<div id="network-plugins">';
         // WP 3.1+
         if (version_compare($wp_version, '3.1', '>=')) {
             $screen = get_current_screen();
             // display this on the network admin plugins page
             if ($screen->is_network) {
                 echo '<p>' . __('Plugins that appear in the list below are activated on all sites across this installation.', 'bnp') . '</p>';
                 // WP 3.1 introduces a new class to output plugins
                 // Network_Plugins_List_Table extends WP_Plugins_List_Table
                 $wp_list_table = new Network_Plugins_List_Table();
                 $wp_list_table->prepare_items();
                 $wp_list_table->display();
                 // display this on the site admin plugins page
             } else {
                 echo '<p>' . sprintf(__('You can <a href="%s">manage your network plugins here</a>.', 'bnp'), network_admin_url('plugins.php')) . '</p>';
                 echo '<h3>' . sprintf(__('Plugins on %s', 'bnp'), get_bloginfo('name')) . '</h3>';
             }
             // WP 3.0 branch
             // print_plugins_table() doesn't exist in WP 3.1+
         } else {
             echo '<p>' . __('Plugins that appear in the list below are activated on all sites across this installation.', 'bnp') . '</p>';
             print_plugins_table(ray_get_network_plugins_only());
             echo '<p>' . __('Plugins that are enabled on the entire network can only be disabled by a super administrator.', 'bnp') . '</p>';
         }
         echo '</div>';
         // if a search is being made, let's reposition the search heading here
         if ($s) {
             printf('<h4>' . __('Search results for &#8220;%s&#8221;', 'bnp') . '</h3>', esc_html($s));
         }
     }
 }
Exemplo n.º 2
0
</ul>

<div class="tablenav">
<?php 
if ($page_links) {
    echo '<div class="tablenav-pages">', $page_links_text, '</div>';
}
print_plugin_actions($status);
?>
</div>
<div class="clear"></div>
<?php 
if ($total_this_page > $plugins_per_page) {
    $plugins = array_slice($plugins, $start, $plugins_per_page);
}
print_plugins_table($plugins, $status);
?>
<div class="tablenav">
<?php 
if ($page_links) {
    echo "<div class='tablenav-pages'>{$page_links_text}</div>";
}
print_plugin_actions($status, "action2");
?>
</div>
</form>

<?php 
if (empty($all_plugins)) {
    ?>
<p><?php 
Exemplo n.º 3
0
<form method="post" action="<?php 
    echo admin_url('plugins.php');
    ?>
">
<?php 
    wp_nonce_field('bulk-manage-plugins');
    ?>

<div class="tablenav">
<?php 
    print_plugin_actions('inactive');
    ?>
</div>
<div class="clear"></div>
<?php 
    print_plugins_table($inactive_plugins, 'inactive');
    ?>
</form>
<?php 
}
?>

<?php 
if (empty($all_plugins)) {
    ?>
<p><?php 
    _e('You do not appear to have any plugins available at this time.');
    ?>
</p>
<?php 
}
Exemplo n.º 4
0
function exclude_plugins_options()
{
    if (!is_super_admin()) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    if (isset($_REQUEST['exclude_plugins_ex'])) {
        check_admin_referer('exclude_plugins_save_options');
        if ($_REQUEST['checked']) {
            if (exclude_plugins_get_option('exclude_new')) {
                exclude_plugins_update_db('included_plugins', array_diff((array) exclude_plugins_get_option('included_plugins'), $_REQUEST['checked']));
            } else {
                exclude_plugins_update_db('excluded_plugins', array_merge((array) exclude_plugins_get_option('excluded_plugins'), $_REQUEST['checked']));
            }
        }
    } elseif (isset($_REQUEST['exclude_plugins_in'])) {
        check_admin_referer('exclude_plugins_save_options');
        if ($_REQUEST['checked']) {
            if (exclude_plugins_get_option('exclude_new')) {
                exclude_plugins_update_db('included_plugins', array_merge((array) exclude_plugins_get_option('included_plugins'), $_REQUEST['checked']));
            } else {
                exclude_plugins_update_db('excluded_plugins', array_diff((array) exclude_plugins_get_option('excluded_plugins'), $_REQUEST['checked']));
            }
        }
    } elseif (isset($_REQUEST['exclude_plugins_save'])) {
        check_admin_referer('exclude_plugins_save_options');
        $force_deactivate = $_REQUEST['force_deactivate'] ? 1 : 0;
        exclude_plugins_update_db('force_deactivate', $force_deactivate);
        //check if switching between
        if (exclude_plugins_get_option('exclude_new') != $_REQUEST['exclude_new']) {
            if ($_REQUEST['exclude_new']) {
                //switch to exclude new
                exclude_plugins_update_db('included_plugins', exclude_plugins_switch(exclude_plugins_get_option('excluded_plugins')));
                exclude_plugins_update_db('excluded_plugins', '');
                exclude_plugins_update_db('exclude_new', 1);
            } else {
                exclude_plugins_update_db('excluded_plugins', exclude_plugins_switch(exclude_plugins_get_option('included_plugins')));
                exclude_plugins_update_db('included_plugins', '');
                exclude_plugins_update_db('exclude_new', 0);
            }
        }
    }
    $menu_perms = get_site_option('menu_items', array());
    if (empty($menu_perms['plugins'])) {
        $message = sprintf(__('These settings is useless if plugins menu not activated because all plugins are excluded by default. %s'), '<a href="' . esc_url(admin_url('ms-options.php#menu')) . '">' . __('Activate') . '</a>');
        echo "<div class='error'><p>{$message}</p></div>";
    }
    $plugins = exclude_plugins_no_network();
    if (exclude_plugins_get_option('exclude_new')) {
        $included_plugins = exclude_plugins_included($plugins);
        $excluded_plugins = array_diff_assoc($plugins, $included_plugins);
    } else {
        $excluded_plugins = exclude_plugins_excluded($plugins);
        $included_plugins = array_diff_assoc($plugins, $excluded_plugins);
    }
    if (exclude_plugins_get_option('force_deactivate')) {
        $fd_checked = 'checked="checked"';
    }
    if (exclude_plugins_get_option('exclude_new')) {
        $en_checked = 'checked="checked"';
    }
    ?>
<form method="post" action="">
	<?php 
    wp_nonce_field('exclude_plugins_save_options');
    ?>
	<hr />
	<h3>Included Plugins</h3>
	<p>Plugins in the list below are available for <strong>all sites</strong>.</p>
	<p><input class="button-secondary" type="submit" value="Exclude Checked"
			  name="exclude_plugins_ex" id="exclude_plugins_ex" /></p>
	<div id="included-plugins">
		<?php 
    print_plugins_table($included_plugins);
    ?>
	</div>
	<p><input class="button-secondary" type="submit" value="Exclude Checked"
			  name="exclude_plugins_ex" id="exclude_plugins_ex" /></p>
	<hr />
	<h3>Excluded Plugins</h3>
	<p>Plugins in the list below are available only for <strong>Super Admin</strong>.</p>
	<p><input class="button-secondary" type="submit"	value="Include Checked"
			  name="exclude_plugins_in" id="exclude_plugins_in" /></p>
	<div id="excluded-plugins">
		<?php 
    print_plugins_table($excluded_plugins);
    ?>
	</div>
	<p><input class="button-secondary" type="submit"	value="Include Checked"
			  name="exclude_plugins_in" id="exclude_plugins_in" /></p>
	<hr />
	<table class="form-table">
	<tr><th>Exclude Newly Installed Plugins</th><td>
	<input type="checkbox" name="exclude_new" <?php 
    echo $en_checked;
    ?>
> Treat as excluded (only visible by Super Admins).
	<p>This option allow you to treat newly installed/added plugins as excluded (if checked) or included (if unchecked).</p>
	</td></tr>
	<tr><th>Force Deactivate</th><td>
	<input type="checkbox" name="force_deactivate" <?php 
    echo $fd_checked;
    ?>
> Force Deactivate
	<p>This will force deactivating of all plugins that is excluded for normal user.</p>
	<p>If you don't exclude plugins from normal user, they can activate the plugins.
		Then if you exclude the plugins they still active although they can't deactivate it anymore because the plugins is not in the list.
		If you force deactivate, the active plugins that is excluded from plugin list become deactivated once the admin enter admin interface.</p>
	</td></tr>
	</table>
	<p><input class="button-primary" type="submit" value="Save Options"
			  name="exclude_plugins_save" id="exclude_plugins_save" /></p>
	<hr />
</form>
<?php 
}