Module: WpTimthumbs::Detectable
- Included in:
- WpTimthumbs
- Defined in:
- lib/common/collections/wp_timthumbs/detectable.rb
Instance Method Summary (collapse)
- - (WpTimthumb) create_item(wp_target, path = nil) protected
-
- (WpTimthumbs) passive_detection(wp_target, options = {})
No passive detection.
- - (Array<WpTimthumb>) targets_items(wp_target, options = {}) protected
- - (Array<WpTimthumb>) targets_items_from_file(file, wp_target) protected
- - (Array<WpTimthumb>) theme_timthumbs(theme_name, wp_target) protected
Instance Method Details
- (WpTimthumb) create_item(wp_target, path = nil) (protected)
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/common/collections/wp_timthumbs/detectable.rb', line 72 def create_item(wp_target, path = nil) = { wp_content_dir: wp_target.wp_content_dir, wp_plugins_dir: wp_target.wp_plugins_dir } .merge!(path: path) if path WpTimthumb.new(wp_target.uri, ) end |
- (WpTimthumbs) passive_detection(wp_target, options = {})
No passive detection
12 13 14 |
# File 'lib/common/collections/wp_timthumbs/detectable.rb', line 12 def passive_detection(wp_target, = {}) new end |
- (Array<WpTimthumb>) targets_items(wp_target, options = {}) (protected)
24 25 26 27 28 29 30 31 32 |
# File 'lib/common/collections/wp_timthumbs/detectable.rb', line 24 def targets_items(wp_target, = {}) targets = [:theme_name] ? theme_timthumbs([:theme_name], wp_target) : [] if [:file] targets += targets_items_from_file([:file], wp_target) end targets.uniq { |i| i.url } end |
- (Array<WpTimthumb>) targets_items_from_file(file, wp_target) (protected)
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/common/collections/wp_timthumbs/detectable.rb', line 57 def targets_items_from_file(file, wp_target) targets = [] File.open(file, 'r') do |f| f.readlines.collect do |path| targets << create_item(wp_target, path.strip) end end targets end |
- (Array<WpTimthumb>) theme_timthumbs(theme_name, wp_target) (protected)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/common/collections/wp_timthumbs/detectable.rb', line 38 def theme_timthumbs(theme_name, wp_target) targets = [] wp_timthumb = create_item(wp_target) %w{ timthumb.php lib/timthumb.php inc/timthumb.php includes/timthumb.php scripts/timthumb.php tools/timthumb.php functions/timthumb.php }.each do |path| wp_timthumb.path = "$wp-content$/themes/#{theme_name}/#{path}" targets << wp_timthumb.dup end targets end |