Revision 1297:0a574315af3e lib/plugins

View differences:

lib/plugins/rfpdf/README
10 10
==
11 11
==
12 12

  
13
If you are using HTML, it is recommended you install:
14

  
15
gem install -r htmlentities
16

  
17 13
TCPDF Documentation located at:
18 14

  
19 15
http://phpdocs.moodle.org/com-tecnick-tcpdf/TCPDF.html
......
42 38

  
43 39
  pdf = TCPDF.new
44 40

  
45
ENJOY!
41
ENJOY!
lib/plugins/rfpdf/init.rb
1
begin
2
  require('htmlentities') 
3
rescue LoadError
4
  # This gem is not required - just nice to have.
5
end
6 1
require('cgi')
7 2
require 'rfpdf'
8 3

  
lib/plugins/rfpdf/lib/tcpdf.rb
94 94
  cattr_accessor :k_path_url_cache
95 95
  @@k_path_url_cache = Rails.root.join('tmp')
96 96
  
97
  cattr_accessor :decoder
98
		
99 97
	attr_accessor :barcode
100 98
	
101 99
	attr_accessor :buffer
......
223 221
		#Some checks
224 222
		dochecks();
225 223
		
226
		begin	  
227
		  @@decoder = HTMLEntities.new 
228
		rescue
229
		  @@decoder = nil
230
		end
231
		
232 224
		#Initialization of properties
233 225
  	@barcode ||= false
234 226
		@buffer ||= ''
......
4002 3994
				@quote_page[@quote_count] = @page;
4003 3995
				@quote_count += 1
4004 3996
			when 'br'
3997
				if @tdbegin
3998
					@tdtext << "\n"
3999
					return
4000
				end
4005 4001
				Ln();
4006 4002

  
4007 4003
				if (@li_spacer.length > 0)
......
4340 4336
	# @return string converted
4341 4337
	#
4342 4338
	def unhtmlentities(string)
4343
	  if @@decoder.nil?
4344 4339
      CGI.unescapeHTML(string)
4345
    else
4346
  	  @@decoder.decode(string)
4347
    end
4348 4340
  end
4349 4341
  
4350 4342
end # END OF CLASS

Also available in: Unified diff