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
swipe-rails-0.0.5 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-shell-0.2.6 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
challah-1.0.0.beta3 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-shell-0.2.5 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
challah-1.0.0.beta2 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
challah-1.0.0.beta vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb