Merged r11399 from trunk to 2.2-stable (#13138)

not use htmlentities gem in rfpdf plugin.

Contributed by Jun NAITOH.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.2-stable@11400 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2013-02-15 14:32:45 +00:00
parent cbd3b057e0
commit 252df8dfc0
3 changed files with 1 additions and 22 deletions

View File

@ -10,10 +10,6 @@ A template plugin allowing the inclusion of ERB-enabled RFPDF template files.
== ==
== ==
If you are using HTML, it is recommended you install:
gem install -r htmlentities
TCPDF Documentation located at: TCPDF Documentation located at:
http://phpdocs.moodle.org/com-tecnick-tcpdf/TCPDF.html http://phpdocs.moodle.org/com-tecnick-tcpdf/TCPDF.html
@ -42,4 +38,4 @@ to:
pdf = TCPDF.new pdf = TCPDF.new
ENJOY! ENJOY!

View File

@ -1,8 +1,3 @@
begin
require('htmlentities')
rescue LoadError
# This gem is not required - just nice to have.
end
require('cgi') require('cgi')
require 'rfpdf' require 'rfpdf'

View File

@ -94,8 +94,6 @@ class TCPDF
cattr_accessor :k_path_url_cache cattr_accessor :k_path_url_cache
@@k_path_url_cache = Rails.root.join('tmp') @@k_path_url_cache = Rails.root.join('tmp')
cattr_accessor :decoder
attr_accessor :barcode attr_accessor :barcode
attr_accessor :buffer attr_accessor :buffer
@ -223,12 +221,6 @@ class TCPDF
#Some checks #Some checks
dochecks(); dochecks();
begin
@@decoder = HTMLEntities.new
rescue
@@decoder = nil
end
#Initialization of properties #Initialization of properties
@barcode ||= false @barcode ||= false
@buffer ||= '' @buffer ||= ''
@ -4344,11 +4336,7 @@ class TCPDF
# @return string converted # @return string converted
# #
def unhtmlentities(string) def unhtmlentities(string)
if @@decoder.nil?
CGI.unescapeHTML(string) CGI.unescapeHTML(string)
else
@@decoder.decode(string)
end
end end
end # END OF CLASS end # END OF CLASS