Module: Erubis::PhpGenerator

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

### Methods

add_expr_debug add_expr_escaped add_expr_literal add_postamble add_preamble add_stmt add_text escape_text init_generator

### Included Modules

Generator

### Public Instance methods

add_expr_debug(src, code)

[Source]

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

add_expr_escaped(src, code)

[Source]

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

add_expr_literal(src, code)

[Source]

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

add_postamble(src)

[Source]

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

add_preamble(src)

[Source]

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

add_stmt(src, code)

[Source]

    # File erubis/engine/ephp.rb, line 53
        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

add_text(src, text)

[Source]

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

escape_text(text)

[Source]

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

init_generator(properties={})

[Source]

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

[Validate]