Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/rss
File: xml-stylesheet.rb
# frozen_string_literal: false
[0] Fix | Delete
require_relative "utils"
[1] Fix | Delete
[2] Fix | Delete
module RSS
[3] Fix | Delete
[4] Fix | Delete
module XMLStyleSheetMixin
[5] Fix | Delete
attr_accessor :xml_stylesheets
[6] Fix | Delete
def initialize(*args)
[7] Fix | Delete
super
[8] Fix | Delete
@xml_stylesheets = []
[9] Fix | Delete
end
[10] Fix | Delete
[11] Fix | Delete
private
[12] Fix | Delete
def xml_stylesheet_pi
[13] Fix | Delete
xsss = @xml_stylesheets.collect do |xss|
[14] Fix | Delete
pi = xss.to_s
[15] Fix | Delete
pi = nil if /\A\s*\z/ =~ pi
[16] Fix | Delete
pi
[17] Fix | Delete
end.compact
[18] Fix | Delete
xsss.push("") unless xsss.empty?
[19] Fix | Delete
xsss.join("\n")
[20] Fix | Delete
end
[21] Fix | Delete
end
[22] Fix | Delete
[23] Fix | Delete
class XMLStyleSheet
[24] Fix | Delete
[25] Fix | Delete
include Utils
[26] Fix | Delete
[27] Fix | Delete
ATTRIBUTES = %w(href type title media charset alternate)
[28] Fix | Delete
[29] Fix | Delete
GUESS_TABLE = {
[30] Fix | Delete
"xsl" => "text/xsl",
[31] Fix | Delete
"css" => "text/css",
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
attr_accessor(*ATTRIBUTES)
[35] Fix | Delete
attr_accessor(:do_validate)
[36] Fix | Delete
def initialize(*attrs)
[37] Fix | Delete
if attrs.size == 1 and
[38] Fix | Delete
(attrs.first.is_a?(Hash) or attrs.first.is_a?(Array))
[39] Fix | Delete
attrs = attrs.first
[40] Fix | Delete
end
[41] Fix | Delete
@do_validate = true
[42] Fix | Delete
ATTRIBUTES.each do |attr|
[43] Fix | Delete
__send__("#{attr}=", nil)
[44] Fix | Delete
end
[45] Fix | Delete
vars = ATTRIBUTES.dup
[46] Fix | Delete
vars.unshift(:do_validate)
[47] Fix | Delete
attrs.each do |name, value|
[48] Fix | Delete
if vars.include?(name.to_s)
[49] Fix | Delete
__send__("#{name}=", value)
[50] Fix | Delete
end
[51] Fix | Delete
end
[52] Fix | Delete
end
[53] Fix | Delete
[54] Fix | Delete
def to_s
[55] Fix | Delete
rv = ""
[56] Fix | Delete
if @href
[57] Fix | Delete
rv << %Q[<?xml-stylesheet]
[58] Fix | Delete
ATTRIBUTES.each do |name|
[59] Fix | Delete
if __send__(name)
[60] Fix | Delete
rv << %Q[ #{name}="#{h __send__(name)}"]
[61] Fix | Delete
end
[62] Fix | Delete
end
[63] Fix | Delete
rv << %Q[?>]
[64] Fix | Delete
end
[65] Fix | Delete
rv
[66] Fix | Delete
end
[67] Fix | Delete
[68] Fix | Delete
remove_method(:href=)
[69] Fix | Delete
def href=(value)
[70] Fix | Delete
@href = value
[71] Fix | Delete
if @href and @type.nil?
[72] Fix | Delete
@type = guess_type(@href)
[73] Fix | Delete
end
[74] Fix | Delete
@href
[75] Fix | Delete
end
[76] Fix | Delete
[77] Fix | Delete
remove_method(:alternate=)
[78] Fix | Delete
def alternate=(value)
[79] Fix | Delete
if value.nil? or /\A(?:yes|no)\z/ =~ value
[80] Fix | Delete
@alternate = value
[81] Fix | Delete
else
[82] Fix | Delete
if @do_validate
[83] Fix | Delete
args = ["?xml-stylesheet?", %Q[alternate="#{value}"]]
[84] Fix | Delete
raise NotAvailableValueError.new(*args)
[85] Fix | Delete
end
[86] Fix | Delete
end
[87] Fix | Delete
@alternate
[88] Fix | Delete
end
[89] Fix | Delete
[90] Fix | Delete
def setup_maker(maker)
[91] Fix | Delete
xss = maker.xml_stylesheets.new_xml_stylesheet
[92] Fix | Delete
ATTRIBUTES.each do |attr|
[93] Fix | Delete
xss.__send__("#{attr}=", __send__(attr))
[94] Fix | Delete
end
[95] Fix | Delete
end
[96] Fix | Delete
[97] Fix | Delete
private
[98] Fix | Delete
def guess_type(filename)
[99] Fix | Delete
/\.([^.]+)$/ =~ filename
[100] Fix | Delete
GUESS_TABLE[$1]
[101] Fix | Delete
end
[102] Fix | Delete
[103] Fix | Delete
end
[104] Fix | Delete
end
[105] Fix | Delete
[106] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function