Skip to content

Instantly share code, notes, and snippets.

@craigiswayne
Created June 8, 2017 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigiswayne/9ce1b3efeecd41e7ec26ef00246bba73 to your computer and use it in GitHub Desktop.
Save craigiswayne/9ce1b3efeecd41e7ec26ef00246bba73 to your computer and use it in GitHub Desktop.
WordPress Plugin Audit Snippet (Markdown)
var $ = jQuery;
var plugin_rows = $("table.wp-list-table.plugins tbody tr").not(".plugin-update-tr");
var plugins = [];
var markdown = "";
if( $(plugin_rows).length > 0 ){
markdown = "| Name | Version | Status |";
markdown += "\n";
markdown += "| --- | --- | --- |";
}
$(plugin_rows).each(function( i ){
//plugin name
var name = $(this).find(".plugin-title strong").text();
//get the version
var version = $(this).find(".plugin-version-author-uri").text();
version = version.substr(0, version.indexOf("|") - 1 );
version = version.replace("Version ","");
var status = $(this).hasClass("active") ? "active" : "**inactive**";
var plugin = {
"name" : name,
"version": version,
"status": status
};
console.log(plugin);
markdown += "\n";
markdown += "| " + name + " | " + version + " | " + status + " |";
});
console.info( "Plugins: " + plugin_rows.length );
console.info(markdown);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment