Only output wordpress url if this item is hosted on wordpress

This commit is contained in:
Christian Mehlmauer
2013-01-19 21:17:06 +01:00
parent a8664a0fec
commit 47b4f47264
2 changed files with 18 additions and 4 deletions

View File

@@ -53,6 +53,20 @@ class WpItem < Vulnerable
end
end
# returns true if this theme or plugin is hosted on wordpress.org
def wp_org_item?
case @type
when "themes"
file = "#{DATA_DIR}/themes_full.txt"
when "plugins"
file = "#{DATA_DIR}/plugins_full.txt"
else
raise("Unknown type #@type")
end
f = File.readlines(file).grep(/^#{Regexp.escape(@name)}$/i)
f.empty? ? false : true
end
def get_sub_folder
case @type
when "themes"