C.110 ZendGuardEncodeTask

The ZendGuardEncodeTask is a wrapper for ZendGuard zendenc executable. It pre-compiles the PHP code which improves speed and can prevent unauthorized code modification. Additionally it allows signing or licensing the code so it can only be used with a valid license.

For more information about ZendGuard encode parameters see the ZendGuard documentation.

Table C.143: Attributes

NameTypeDescriptionDefaultRequired
zendEncoderPathStringPath to zendenc or zendenc5 binary.n/aYes
deleteSourceBooleanWhether to delete the original file and replace with encoded.trueNo
renameSourceExtStringIf defined the original file will be copied to originalfile.renameSourceExt before encoding. This property overrides the deleteSource property.n/aNo
shortTagsBooleanTurns on/off support for PHP short tags (<?). True to enable support.trueNo
aspTagsBooleanTurns on/off support for ASP tags (<%). True to enable support.falseNo
noHeaderBooleanDisables the PHP-compatible header that is added to the top of every encoded file by default and is displayed if the Zend Optimizer is not properly installed.falseNo
useCryptoBooleanEnables cryptography support.falseNo
encodedOnlyBooleanIf enabled the encoded files will only work with other encoded files ( I.e. encoded and not-encoded files cannot be used together).falseNo
forceEncodeBooleanAllow encoding previously encoded files. Not recommended.falseNo
expiresStringMake an encoded file to expire on the given data. Date is in yyyy-mm-dd format.n/aNo
obfuscationLevelIntegerLevel of obfuscation. Defaults to 0 (no obfuscation). 0No
optMaskIntegerOptimization mask. Integer representing a bit mask.n/aNo
privateKeyPathStringPath to the company private key. This is required when either signProduct or licenseProduct is enabled.n/aNo
licenseProductBooleanEnabled product licensing. The encoded files won't work without a valid license. If enabled privateKeyPath property also needs to be defined.falseNo
signProductBooleanEnabled product signing. If signing is enabled the files will be encoded with license support. However valid license won't be required for the files to work. If enabled privatKeyPath property also needs to be defined.falseNo
productNameStringName of the product. This must match the product name in the license and is required when either licenseProduct or signProduct is enabled.n/aNo
prologFileStringPath to a file containing a text that will be prepended to each encoded file and displayed in case the Zend Optimizer is not installed.n/aNo

C.110.1 Example

<zendguardencode
 shortTags="false"
 productName="Phing"
 privateKeyPath="/var/data/phing.key"
 licenseProduct="true"
 zendEncoderPath="/usr/local/Zend/ZendGuard-5_0_1/bin/zendenc5"
 >

 <fileset dir="src">
   <include name="**/*.php" />
   <exclude name="cache/**" />
   <exclude name="plugins/**" />
 </fileset>

 <fileset dir="src">
   <include name="plugins/cs*/**/*.php" />
   <include name="plugins/cs*/*.php" />
 </fileset>
</zendguardencode>

Encode all php files in the current directory and subdirectories. Exlude everything in cache/ and plugins/ but include everything in plugins that starts with cs.

C.110.2 Supported Nested Tags