Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/rss
File: trackback.rb
# frozen_string_literal: false
[0] Fix | Delete
# This file contains the implementation of trackbacks. It is entirely internal
[1] Fix | Delete
# and not useful to outside developers.
[2] Fix | Delete
require 'rss/1.0'
[3] Fix | Delete
require 'rss/2.0'
[4] Fix | Delete
[5] Fix | Delete
module RSS # :nodoc: all
[6] Fix | Delete
[7] Fix | Delete
TRACKBACK_PREFIX = 'trackback'
[8] Fix | Delete
TRACKBACK_URI = 'http://madskills.com/public/xml/rss/module/trackback/'
[9] Fix | Delete
[10] Fix | Delete
RDF.install_ns(TRACKBACK_PREFIX, TRACKBACK_URI)
[11] Fix | Delete
Rss.install_ns(TRACKBACK_PREFIX, TRACKBACK_URI)
[12] Fix | Delete
[13] Fix | Delete
module TrackBackUtils
[14] Fix | Delete
private
[15] Fix | Delete
def trackback_validate(ignore_unknown_element, tags, uri)
[16] Fix | Delete
return if tags.nil?
[17] Fix | Delete
if tags.find {|tag| tag == "about"} and
[18] Fix | Delete
!tags.find {|tag| tag == "ping"}
[19] Fix | Delete
raise MissingTagError.new("#{TRACKBACK_PREFIX}:ping", tag_name)
[20] Fix | Delete
end
[21] Fix | Delete
end
[22] Fix | Delete
end
[23] Fix | Delete
[24] Fix | Delete
module BaseTrackBackModel
[25] Fix | Delete
[26] Fix | Delete
ELEMENTS = %w(ping about)
[27] Fix | Delete
[28] Fix | Delete
def append_features(klass)
[29] Fix | Delete
super
[30] Fix | Delete
[31] Fix | Delete
unless klass.class == Module
[32] Fix | Delete
klass.module_eval {include TrackBackUtils}
[33] Fix | Delete
[34] Fix | Delete
klass.install_must_call_validator(TRACKBACK_PREFIX, TRACKBACK_URI)
[35] Fix | Delete
%w(ping).each do |name|
[36] Fix | Delete
var_name = "#{TRACKBACK_PREFIX}_#{name}"
[37] Fix | Delete
klass_name = "TrackBack#{Utils.to_class_name(name)}"
[38] Fix | Delete
klass.install_have_child_element(name, TRACKBACK_URI, "?", var_name)
[39] Fix | Delete
klass.module_eval(<<-EOC, __FILE__, __LINE__)
[40] Fix | Delete
remove_method :#{var_name}
[41] Fix | Delete
def #{var_name}
[42] Fix | Delete
@#{var_name} and @#{var_name}.value
[43] Fix | Delete
end
[44] Fix | Delete
[45] Fix | Delete
remove_method :#{var_name}=
[46] Fix | Delete
def #{var_name}=(value)
[47] Fix | Delete
@#{var_name} = Utils.new_with_value_if_need(#{klass_name}, value)
[48] Fix | Delete
end
[49] Fix | Delete
EOC
[50] Fix | Delete
end
[51] Fix | Delete
[52] Fix | Delete
[%w(about s)].each do |name, postfix|
[53] Fix | Delete
var_name = "#{TRACKBACK_PREFIX}_#{name}"
[54] Fix | Delete
klass_name = "TrackBack#{Utils.to_class_name(name)}"
[55] Fix | Delete
klass.install_have_children_element(name, TRACKBACK_URI, "*",
[56] Fix | Delete
var_name)
[57] Fix | Delete
klass.module_eval(<<-EOC, __FILE__, __LINE__)
[58] Fix | Delete
remove_method :#{var_name}
[59] Fix | Delete
def #{var_name}(*args)
[60] Fix | Delete
if args.empty?
[61] Fix | Delete
@#{var_name}.first and @#{var_name}.first.value
[62] Fix | Delete
else
[63] Fix | Delete
ret = @#{var_name}.__send__("[]", *args)
[64] Fix | Delete
if ret.is_a?(Array)
[65] Fix | Delete
ret.collect {|x| x.value}
[66] Fix | Delete
else
[67] Fix | Delete
ret.value
[68] Fix | Delete
end
[69] Fix | Delete
end
[70] Fix | Delete
end
[71] Fix | Delete
[72] Fix | Delete
remove_method :#{var_name}=
[73] Fix | Delete
remove_method :set_#{var_name}
[74] Fix | Delete
def #{var_name}=(*args)
[75] Fix | Delete
if args.size == 1
[76] Fix | Delete
item = Utils.new_with_value_if_need(#{klass_name}, args[0])
[77] Fix | Delete
@#{var_name}.push(item)
[78] Fix | Delete
else
[79] Fix | Delete
new_val = args.last
[80] Fix | Delete
if new_val.is_a?(Array)
[81] Fix | Delete
new_val = new_value.collect do |val|
[82] Fix | Delete
Utils.new_with_value_if_need(#{klass_name}, val)
[83] Fix | Delete
end
[84] Fix | Delete
else
[85] Fix | Delete
new_val = Utils.new_with_value_if_need(#{klass_name}, new_val)
[86] Fix | Delete
end
[87] Fix | Delete
@#{var_name}.__send__("[]=", *(args[0..-2] + [new_val]))
[88] Fix | Delete
end
[89] Fix | Delete
end
[90] Fix | Delete
alias set_#{var_name} #{var_name}=
[91] Fix | Delete
EOC
[92] Fix | Delete
end
[93] Fix | Delete
end
[94] Fix | Delete
end
[95] Fix | Delete
end
[96] Fix | Delete
[97] Fix | Delete
module TrackBackModel10
[98] Fix | Delete
extend BaseModel
[99] Fix | Delete
extend BaseTrackBackModel
[100] Fix | Delete
[101] Fix | Delete
class TrackBackPing < Element
[102] Fix | Delete
include RSS10
[103] Fix | Delete
[104] Fix | Delete
class << self
[105] Fix | Delete
[106] Fix | Delete
def required_prefix
[107] Fix | Delete
TRACKBACK_PREFIX
[108] Fix | Delete
end
[109] Fix | Delete
[110] Fix | Delete
def required_uri
[111] Fix | Delete
TRACKBACK_URI
[112] Fix | Delete
end
[113] Fix | Delete
[114] Fix | Delete
end
[115] Fix | Delete
[116] Fix | Delete
@tag_name = "ping"
[117] Fix | Delete
[118] Fix | Delete
[
[119] Fix | Delete
["resource", ::RSS::RDF::URI, true]
[120] Fix | Delete
].each do |name, uri, required|
[121] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[122] Fix | Delete
"#{::RSS::RDF::PREFIX}:#{name}")
[123] Fix | Delete
end
[124] Fix | Delete
[125] Fix | Delete
alias_method(:value, :resource)
[126] Fix | Delete
alias_method(:value=, :resource=)
[127] Fix | Delete
def initialize(*args)
[128] Fix | Delete
if Utils.element_initialize_arguments?(args)
[129] Fix | Delete
super
[130] Fix | Delete
else
[131] Fix | Delete
super()
[132] Fix | Delete
self.resource = args[0]
[133] Fix | Delete
end
[134] Fix | Delete
end
[135] Fix | Delete
[136] Fix | Delete
def full_name
[137] Fix | Delete
tag_name_with_prefix(TRACKBACK_PREFIX)
[138] Fix | Delete
end
[139] Fix | Delete
end
[140] Fix | Delete
[141] Fix | Delete
class TrackBackAbout < Element
[142] Fix | Delete
include RSS10
[143] Fix | Delete
[144] Fix | Delete
class << self
[145] Fix | Delete
[146] Fix | Delete
def required_prefix
[147] Fix | Delete
TRACKBACK_PREFIX
[148] Fix | Delete
end
[149] Fix | Delete
[150] Fix | Delete
def required_uri
[151] Fix | Delete
TRACKBACK_URI
[152] Fix | Delete
end
[153] Fix | Delete
[154] Fix | Delete
end
[155] Fix | Delete
[156] Fix | Delete
@tag_name = "about"
[157] Fix | Delete
[158] Fix | Delete
[
[159] Fix | Delete
["resource", ::RSS::RDF::URI, true]
[160] Fix | Delete
].each do |name, uri, required|
[161] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[162] Fix | Delete
"#{::RSS::RDF::PREFIX}:#{name}")
[163] Fix | Delete
end
[164] Fix | Delete
[165] Fix | Delete
alias_method(:value, :resource)
[166] Fix | Delete
alias_method(:value=, :resource=)
[167] Fix | Delete
[168] Fix | Delete
def initialize(*args)
[169] Fix | Delete
if Utils.element_initialize_arguments?(args)
[170] Fix | Delete
super
[171] Fix | Delete
else
[172] Fix | Delete
super()
[173] Fix | Delete
self.resource = args[0]
[174] Fix | Delete
end
[175] Fix | Delete
end
[176] Fix | Delete
[177] Fix | Delete
def full_name
[178] Fix | Delete
tag_name_with_prefix(TRACKBACK_PREFIX)
[179] Fix | Delete
end
[180] Fix | Delete
[181] Fix | Delete
private
[182] Fix | Delete
def maker_target(abouts)
[183] Fix | Delete
abouts.new_about
[184] Fix | Delete
end
[185] Fix | Delete
[186] Fix | Delete
def setup_maker_attributes(about)
[187] Fix | Delete
about.resource = self.resource
[188] Fix | Delete
end
[189] Fix | Delete
[190] Fix | Delete
end
[191] Fix | Delete
end
[192] Fix | Delete
[193] Fix | Delete
module TrackBackModel20
[194] Fix | Delete
extend BaseModel
[195] Fix | Delete
extend BaseTrackBackModel
[196] Fix | Delete
[197] Fix | Delete
class TrackBackPing < Element
[198] Fix | Delete
include RSS09
[199] Fix | Delete
[200] Fix | Delete
@tag_name = "ping"
[201] Fix | Delete
[202] Fix | Delete
content_setup
[203] Fix | Delete
[204] Fix | Delete
class << self
[205] Fix | Delete
[206] Fix | Delete
def required_prefix
[207] Fix | Delete
TRACKBACK_PREFIX
[208] Fix | Delete
end
[209] Fix | Delete
[210] Fix | Delete
def required_uri
[211] Fix | Delete
TRACKBACK_URI
[212] Fix | Delete
end
[213] Fix | Delete
[214] Fix | Delete
end
[215] Fix | Delete
[216] Fix | Delete
alias_method(:value, :content)
[217] Fix | Delete
alias_method(:value=, :content=)
[218] Fix | Delete
[219] Fix | Delete
def initialize(*args)
[220] Fix | Delete
if Utils.element_initialize_arguments?(args)
[221] Fix | Delete
super
[222] Fix | Delete
else
[223] Fix | Delete
super()
[224] Fix | Delete
self.content = args[0]
[225] Fix | Delete
end
[226] Fix | Delete
end
[227] Fix | Delete
[228] Fix | Delete
def full_name
[229] Fix | Delete
tag_name_with_prefix(TRACKBACK_PREFIX)
[230] Fix | Delete
end
[231] Fix | Delete
[232] Fix | Delete
end
[233] Fix | Delete
[234] Fix | Delete
class TrackBackAbout < Element
[235] Fix | Delete
include RSS09
[236] Fix | Delete
[237] Fix | Delete
@tag_name = "about"
[238] Fix | Delete
[239] Fix | Delete
content_setup
[240] Fix | Delete
[241] Fix | Delete
class << self
[242] Fix | Delete
[243] Fix | Delete
def required_prefix
[244] Fix | Delete
TRACKBACK_PREFIX
[245] Fix | Delete
end
[246] Fix | Delete
[247] Fix | Delete
def required_uri
[248] Fix | Delete
TRACKBACK_URI
[249] Fix | Delete
end
[250] Fix | Delete
[251] Fix | Delete
end
[252] Fix | Delete
[253] Fix | Delete
alias_method(:value, :content)
[254] Fix | Delete
alias_method(:value=, :content=)
[255] Fix | Delete
[256] Fix | Delete
def initialize(*args)
[257] Fix | Delete
if Utils.element_initialize_arguments?(args)
[258] Fix | Delete
super
[259] Fix | Delete
else
[260] Fix | Delete
super()
[261] Fix | Delete
self.content = args[0]
[262] Fix | Delete
end
[263] Fix | Delete
end
[264] Fix | Delete
[265] Fix | Delete
def full_name
[266] Fix | Delete
tag_name_with_prefix(TRACKBACK_PREFIX)
[267] Fix | Delete
end
[268] Fix | Delete
[269] Fix | Delete
end
[270] Fix | Delete
end
[271] Fix | Delete
[272] Fix | Delete
class RDF
[273] Fix | Delete
class Item; include TrackBackModel10; end
[274] Fix | Delete
end
[275] Fix | Delete
[276] Fix | Delete
class Rss
[277] Fix | Delete
class Channel
[278] Fix | Delete
class Item; include TrackBackModel20; end
[279] Fix | Delete
end
[280] Fix | Delete
end
[281] Fix | Delete
[282] Fix | Delete
BaseTrackBackModel::ELEMENTS.each do |name|
[283] Fix | Delete
class_name = Utils.to_class_name(name)
[284] Fix | Delete
BaseListener.install_class_name(TRACKBACK_URI, name,
[285] Fix | Delete
"TrackBack#{class_name}")
[286] Fix | Delete
end
[287] Fix | Delete
[288] Fix | Delete
BaseTrackBackModel::ELEMENTS.collect! {|name| "#{TRACKBACK_PREFIX}_#{name}"}
[289] Fix | Delete
end
[290] Fix | Delete
[291] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function