<?php
// Restrict who can access this script.
$permitted_ips = array('0.0.0.0', );
if (in_array($_SERVER['REMOTE_ADDR'], $permitted_ips) == false) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
table.greyGridTable {
border: 2px solid #FFFFFF;
width: 100%;
text-align: center;
border-collapse: collapse;
}
table.greyGridTable td, table.greyGridTable th {
border: 1px solid #FFFFFF;
padding: 3px 4px;
}
table.greyGridTable tbody td {
font-size: 13px;
}
table.greyGridTable td:nth-child(even) {
background: #EBEBEB;
}
table.greyGridTable thead {
background: #FFFFFF;
border-bottom: 4px solid #333333;
}
table.greyGridTable thead th {
font-size: 15px;
font-weight: bold;
color: #333333;
text-align: center;
border-left: 2px solid #333333;
}
table.greyGridTable thead th:first-child {
border-left: none;
}
table.greyGridTable tfoot {
font-size: 14px;
font-weight: bold;
color: #333333;
border-top: 4px solid #333333;
}
table.greyGridTable tfoot td {
font-size: 14px;
}</style>
<meta charset="UTF-8" />
<title>List Active Plugins</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<h1>Active Wordpress Plugins</h1>
<?php
define('WP_USE_THEMES', false);
/** Loads the WordPress Environment and Template */
require( '/var/www/html/wp-load.php' );
// Check if get_plugins() function exists. This is required on the front end of the
// site, since it is in a file that is normally only loaded in the admin.
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$active_plugins = get_option('active_plugins');
$all_plugins = get_plugins();
//print_r( $all_plugins );
echo '<table class="greyGridTable" style="width=100%">';
echo "<colgroup>";
echo '<col span="1" style="width: 35%;">';
echo '<col span="1" style="width: 40%;">';
echo '<col span="1" style="width: 15%;">';
echo "</colgroup>";
echo "<tr>";
echo "<th>Plugin</th>";
echo "<th>filename</th>";
echo "<th>version</th>";
echo "<th>Author Details</th>";
echo "</tr>";
foreach($active_plugins as $key => $value) {
$string = explode('/',$value); // Folder name will be displayed
echo "<tr><td>".$string[0] ."</td>";
echo "<td>".$string[1]."</td>";
echo "<td>".$all_plugins[$value]['Version']."</td>";
echo "<td>".$all_plugins[$value]['AuthorName']." - ".$all_plugins[$value]['AuthorURI']."</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>