Created
June 8, 2017 10:58
-
-
Save craigiswayne/9ce1b3efeecd41e7ec26ef00246bba73 to your computer and use it in GitHub Desktop.
WordPress Plugin Audit Snippet (Markdown)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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