Module Erubis::PhpGenerator
In: erubis/engine/ephp.rb

Methods

Included Modules

Generator

Public Instance methods

[Source]

# File erubis/engine/ephp.rb, line 46
    def add_expr_debug(src, code)
      code.strip!
      s = code.gsub(/\'/, "\\'")
      src << "<?php error_log('*** debug: #{s}='.(#{code}), 0); ?>"
    end

[Source]

# File erubis/engine/ephp.rb, line 42
    def add_expr_escaped(src, code)
      add_expr_literal(src, escaped_expr(code))
    end

[Source]

# File erubis/engine/ephp.rb, line 37
    def add_expr_literal(src, code)
      code.strip!
      src << "<?php echo #{code}; ?>"
    end

[Source]

# File erubis/engine/ephp.rb, line 63
    def add_postamble(src)
      # empty
    end

[Source]

# File erubis/engine/ephp.rb, line 25
    def add_preamble(src)
      # empty
    end

[Source]

# File erubis/engine/ephp.rb, line 52
    def add_stmt(src, code)
      src << "<?php"
      src << " " if code[0] != ?\ #
      if code[-1] == ?\n
        code.chomp!
        src << code << "?>\n"
      else
        src << code << "?>"
      end
    end

[Source]

# File erubis/engine/ephp.rb, line 33
    def add_text(src, text)
      src << escape_text(text)
    end

[Source]

# File erubis/engine/ephp.rb, line 29
    def escape_text(text)
      return text.gsub!(/<\?xml\b/, '<<?php ?>?xml') || text
    end

[Source]

# File erubis/engine/ephp.rb, line 20
    def init_generator(properties={})
      super
      @escapefunc ||= 'htmlspecialchars'
    end

[Validate]