Just run this:

grep --include={*.php,*.html,*.htm} -rnl './' -e "text" | xargs -i@ sed -i 's/text/new text/g' @
replacing the extensions you want to be included.

##