module PlataformaSocial module Helpers def plataforma_social_javascripts plataforma_social_script_tag + plataforma_social_config_script + signed_request_javascript end def plataforma_social_script_tag %Q{}.html_safe end def plataforma_social_config_script %Q{}.html_safe end def signed_request_javascript default_params = { :signed_request => params[:signed_request] || nil, :code => params[:code] || nil } %Q{ }.html_safe end def custom_redirect_to path, options = {} options.each_pair do |key, value| cookies[key] = value end render :text => %Q{ } end def link_to *args, &block args[2] ||= {} if args[2][:normal] === true super else unless block_given? if params[:controller].index(PlataformaSocial.admin_controller_name) == 0 || defined? request super else referer = request.referer facebook_domain = 'apps.facebook.com' server_domain = request.env['HTTP_HOST'] url = facebook_domain + '/' + PlataformaSocial.facebook_app_namespace if args[1].index(request.env['HTTP_HOST']) args[1].gsub! server_domain, url else args[1] = request.protocol + url + args[1] end args[2][:target] = '_top' end end super end end end end ActiveSupport.on_load(:action_view) do include PlataformaSocial::Helpers end class ActionController::Base include PlataformaSocial::Helpers end