Created by
mason.malone
last modified
Mason Malone
| `grep -Rl 'refresh' app`.split.each do |file_name|
print "Handling #{file_name}\n"
lines = File.readlines(file_name)
open(file_name, 'w') do |file|
lines.each do |line|
next if /^\s*<input[^>]*=["']?refresh.*>\s*$/i === line
file << line.gsub(/
(<
(?:
\{\$[^}]++\}
|<\?=[^?]++\?>
|[^<>{]++
|<\g<1>
)++
>)
/x) {
$&
.gsub(/\?refresh=[^&]*&/i, "?")
.gsub(/[?&]refresh=[^&"']*(.*>)$/i, '\1')
}
.gsub(/,\s*(['"])refresh\1\s*=>\s*\$[^)\],]*/i, '')
.gsub(/,\s*(array\(|\[)(['"])refresh\2\s*=>\s*[^)\]]*(\)|\])/i, '')
.gsub(/&refresh=(?:<\?=\s*)?\$refresh(?:_enc)?(?:\s*\?>)?/, '')
end
end
end
|