#!/bin/sh
# Written by Marius van Witzenburg <info@mariusvw.com>
path="."
if [ ! -z "$1" ] && [ -d "$1" ]
then
path="$1"
elif [ ! -z "$1" ]
then
echo "Invalid path defined, using default."
fi
echo "Searching for php short open tags…"
echo "Starting path: $path"
find $path -name '*.php' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.php' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.php' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
echo 'Done!'
http://mariusvw.com/2010/03/03/easy-replace-php-short-open-tags-with-long-php-open-tags/
Recent Comments