Sha256: f3d9e0a63e287804a0d36c40c4f8b82130fae808447ad2a2649b88cc11c01d61

Contents?: true

Size: 1.55 KB

Versions: 252

Compression:

Stored size: 1.55 KB

Contents

##
## $Release: 2.7.0 $
## copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
##

require 'erubis/engine'
require 'erubis/enhancer'


module Erubis


  module PhpGenerator
    include Generator

    def self.supported_properties()  # :nodoc:
      return []
    end

    def init_generator(properties={})
      super
      @escapefunc ||= 'htmlspecialchars'
    end

    def add_preamble(src)
      # empty
    end

    def escape_text(text)
      return text.gsub!(/<\?xml\b/, '<<?php ?>?xml') || text
    end

    def add_text(src, text)
      src << escape_text(text)
    end

    def add_expr_literal(src, code)
      code.strip!
      src << "<?php echo #{code}; ?>"
    end

    def add_expr_escaped(src, code)
      add_expr_literal(src, escaped_expr(code))
    end

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

    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

    def add_postamble(src)
      # empty
    end

  end


  ##
  ## engine for PHP
  ##
  class Ephp < Basic::Engine
    include PhpGenerator
  end


  class EscapedEphp < Ephp
    include EscapeEnhancer
  end


  #class XmlEphp < Ephp
  #  include EscapeEnhancer
  #end


  class PI::Ephp < PI::Engine
    include PhpGenerator

    def init_converter(properties={})
      @pi = 'php'
      super(properties)
    end

  end


end

Version data entries

252 entries across 212 versions & 42 rubygems

Version Path
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
erbse-0.0.1 lib/erbse/engine/ephp.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
nanumfont-rails-0.1 vendor/bundle/ruby/2.1.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
challah-1.0.0 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb