http://www.phing.info/docs/guide/stable ... laceRegexp
http://www.phing.info/
Here are some example phing xml scripts:
The following script took 44 seconds to change all the CR/LF line endings to Linux format:
Code: Select all
<?xml version="1.0" ?>
<project name="changing MS-DOS CR/LF EOL to UNIX EOL chars" default="main" basedir=".">
<target name="main">
<echo msg="changing MS-DOS CR/LF EOL to UNIX EOL chars" />
<reflexive>
<fileset dir="./upload">
<include name="**" />
<exclude name="tmp-backups/**" />
<exclude name="**/*.xml" />
<exclude name="**/*.xml.bak" />
<exclude name="**/images/**" />
<exclude name="**/zip-file/**" />
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern='
' replace="
" />
</replaceregexp>
</filterchain>
</reflexive>
</target>
</project>
Code: Select all
[root@karsites opencart-1.5.5.1]# phing -f change-eol.xml
Buildfile: /downloads/Ecommerce/OpenCart/1.5.5.1/opencart-1.5.5.1/change-eol.xml
changing MS-DOS CR/LF EOL to UNIX EOL chars > main:
[echo] changing MS-DOS CR/LF EOL to UNIX EOL chars
[reflexive] Applying reflexive processing to 2440 files.
BUILD FINISHED
Total time: 44.4178 seconds
This phing script adds a custom stylesheet attribute to the php documentation downloads - (I don't like a plain white background - it gives me eye strain)
Code: Select all
<?xml version="1.0" ?>
<project name="adding stylesheet tag" default="main" basedir=".">
<target name="main">
<echo msg="adding stylesheet tag..." />
<reflexive>
<fileset dir=".">
<include name="*.html" />
<!--
<include name="**/*" />
<exclude name="tmp-backups/**" />
<exclude name="*.xml" />
<exclude name="*.xml.bak" />
<exclude name="**/*.xml" />
<exclude name="**/*.xml.bak" />
-->
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="<head>"
replace="<head> <link rel="stylesheet"
type="text/css" href="MY-style.css" />" />
</replaceregexp>
</filterchain>
</reflexive>
</target>
</project>
<head> <link rel="stylesheet" type="text/css" href="MY-style.css" />
Would it not be possible to do this for custom OC extensions, so at least the original tag attributes are remaining?