Sha256: 7a3847316296a3a4fe3bb15d27c372b9c853a9e89331d0d707db1d6a98513096
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module SapeHelper def sape_links_block options = { links: SapeLink.where(page: request.original_fullpath, link_type: "simple") } if SapeConfig.bot_ips.include?(request.remote_addr) options.merge!(check_code: SapeConfig.check_code) end render template: 'sape/links', locals: options rescue Exception => e "<!-- ERROR: #{e.message} -->".html_safe end def sape_links links = SapeLink.where(page: request.original_fullpath, link_type: "simple"). pluck(:raw_link). join(SapeConfig.delimiter) SapeConfig.bot_ips.include?(request.remote_addr) ? (links + SapeConfig.check_code) : links rescue Exception => e "<!-- ERROR: #{e.message} -->".html_safe end def sape_context_links(text) SapeLink.where(page: request.original_fullpath, link_type: "context").each do |link| text.gsub!(link.anchor, link.raw_link) end if SapeConfig.bot_ips.include?(request.remote_addr) "<sape_index>" + text + "</sape_index>" + SapeConfig.check_code else text end rescue Exception => e "<!-- ERROR: #{e.message} -->".html_safe end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sape-0.0.8 | lib/app/helpers/sape_helper.rb |
sape-0.0.5 | lib/app/helpers/sape_helper.rb |