vendor/plugins/ambethia_recaptcha/lib/recaptcha.rb
# Your public API can be specified in the +options+ hash or preferably the environment
# variable +RECAPTCHA_PUBLIC_KEY+.
Your public API can be specified in the +options+ hash or preferably the environment
variable +RECAPTCHA_PUBLIC_KEY+.
Your public API can be specified in the + options + hash or preferably the environment variable + RECAPTCHA_PUBLIC_KEY + .
def recaptcha_tags(options = {})
        key   = options[:public_key] ||= ENV['RECAPTCHA_PUBLIC_KEY']
        error = options[:error] ||= session[:recaptcha_error]
        uri   = options[:ssl] ? RECAPTCHA_API_SECURE_SERVER : RECAPTCHA_API_SERVER
        xhtml = Builder::XmlMarkup.new :target => out=(''), :indent => 2 
        if options[:display]
          xhtml.script(:type => "text/javascript"){ |x| x << "var RecaptchaOptions = #{options[:display].to_json};\n"}
        end
        if options[:ajax]
         xhtml.div(:id => 'dynamic_recaptcha') {}
         xhtml.script(:type => "text/javascript", :src => "#{uri}/js/recaptcha_ajax.js") {}
         xhtml.script(:type => "text/javascript") do |x|
           x << "Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha') );"
         end
        else
          xhtml.script(:type => "text/javascript", :src => CGI::escapeHTML("#{uri}/challenge?k=#{key}&error=#{error}")) {}
          unless options[:noscript] == false
            xhtml.noscript do
              xhtml.iframe(:src    => "#{uri}/noscript?k=#{key}",
                           :height => options[:iframe_height] ||= 300,
                           :width  => options[:iframe_width]  ||= 500,
                           :frameborder => 0) {}; xhtml.br
              xhtml.textarea nil, :name => "recaptcha_challenge_field",
                                  :rows => options[:textarea_rows] ||= 3,
                                  :cols => options[:textarea_cols] ||= 40
              xhtml.input :name => "recaptcha_response_field",
                          :type => "hidden", :value => "manual_challenge"
            end
          end
        end
        raise ReCaptchaError, "No public key specified." unless key
        return out
      end
def recaptcha_tags ( options = { } ) key = options [ :public_key ] ||= ENV [ 'RECAPTCHA_PUBLIC_KEY' ] error = options [ :error ] ||= session [ :recaptcha_error ] uri = options [ :ssl ] ? RECAPTCHA_API_SECURE_SERVER : RECAPTCHA_API_SERVER xhtml = Builder :: XmlMarkup . new :target => out = ( '' ) , :indent => 2 if options [ :display ] xhtml . script ( :type => "text/javascript" ) { | x | x << "var RecaptchaOptions = #{options[:display].to_json};\n" } end if options [ :ajax ] xhtml . div ( :id => 'dynamic_recaptcha' ) { } xhtml . script ( :type => "text/javascript" , :src => "#{uri}/js/recaptcha_ajax.js" ) { } xhtml . script ( :type => "text/javascript" ) do | x | x << "Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha') );" end else xhtml . script ( :type => "text/javascript" , :src => CGI :: escapeHTML ( "#{uri}/challenge?k=#{key}&error=#{error}" ) ) { } unless options [ :noscript ] == false xhtml . noscript do xhtml . iframe ( :src => "#{uri}/noscript?k=#{key}" , :height => options [ :iframe_height ] ||= 300 , :width => options [ :iframe_width ] ||= 500 , :frameborder => 0 ) { } ; xhtml . br xhtml . textarea nil , :name => "recaptcha_challenge_field" , :rows => options [ :textarea_rows ] ||= 3 , :cols => options [ :textarea_cols ] ||= 40 xhtml . input :name => "recaptcha_response_field" , :type => "hidden" , :value => "manual_challenge" end end end raise ReCaptchaError , "No public key specified." unless key return out end
Your public API can be specified in the +options+ hash or preferably the environment
variable +RECAPTCHA_PUBLIC_KEY+.
Your public API can be specified in the + options + hash or preferably the environment variable + RECAPTCHA_PUBLIC_KEY + .
# Default options # Because I can.
options
<not_specific>