Fixed false positive theme detection
This commit is contained in:
@@ -15,9 +15,9 @@ class WpTheme < WpItem
|
||||
include WpTheme::Output
|
||||
include WpTheme::Childtheme
|
||||
|
||||
attr_writer :style_url
|
||||
attr_accessor :additional_url
|
||||
|
||||
def allowed_options; super << :style_url end
|
||||
def allowed_options; super << :additional_url end
|
||||
|
||||
def initialize(*args)
|
||||
super(*args)
|
||||
@@ -36,10 +36,7 @@ class WpTheme < WpItem
|
||||
|
||||
# @return [ String ] The url to the theme stylesheet
|
||||
def style_url
|
||||
unless @style_url
|
||||
@style_url = uri.merge('style.css').to_s
|
||||
end
|
||||
@style_url
|
||||
uri.merge('style.css').to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -30,13 +30,13 @@ class WpTheme < WpItem
|
||||
response = Browser.get_and_follow_location(target_uri.to_s)
|
||||
|
||||
# https + domain is optional because of relative links
|
||||
matches = %r{(?:https?://[^"']+)?/([^/]+)/themes/([^"']+)/style.css}i.match(response.body)
|
||||
matches = /(?:https?:\/\/[^"']+)?\/([^\/]+)\/themes\/([^"'\/]+)[^"']*\/style.css/i.match(response.body)
|
||||
if matches
|
||||
return new(
|
||||
target_uri,
|
||||
{
|
||||
name: matches[2],
|
||||
style_url: matches[0],
|
||||
additional_url: matches[0],
|
||||
wp_content_dir: matches[1]
|
||||
}
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ class WpTheme
|
||||
def additional_output(verbose = false)
|
||||
theme_desc = verbose ? @theme_description : truncate(@theme_description, 100)
|
||||
puts " | Style URL: #{style_url}"
|
||||
puts " | Additional URL: #{additional_url}" if additional_url
|
||||
puts " | Theme Name: #@theme_name" if @theme_name
|
||||
puts " | Theme URI: #@theme_uri" if @theme_uri
|
||||
puts " | Description: #{theme_desc}"
|
||||
|
||||
Reference in New Issue
Block a user