classes/phing/filters/ReplaceTokensWithFile.php
\ReplaceTokensWithFile
Replaces tokens in the original input with the contents of a file.
The file to be used is controlled by the name of the token which corresponds to the basename of the file to be used together with the optional pre and postfix strings that is possible to set.
By default all HTML entities in the file is replaced by the corresponding HTML entities. This behaviour can be controlled by the "translatehtml" parameter.
Supported parameters are:
prefix string Text to be prefixed to token before using as filename postfix string Text to be prefixed to token before using as filename dir string The directory where the files should be read from translatehtml bool If we should translate all HTML entities in the file.
Example:
- Extends from
- \BaseParamFilterReader
- Implements
- \ChainableReader
- see
- \ReplaceTokensWithFile
- access
- public
- author
- johan persson, johanp@aditus.nu
- copyright
- © 2003 seasonfive. All rights reserved
- package
- phing.filters
- version
- $Id: ReplaceTokensWithFile.php 1084 2011-05-06 09:55:25Z mrook $
Constants
Properties

string
$_beginToken= 'ReplaceTokensWithFile'
Character marking the beginning of a token.
ReplaceTokensWithFileDetails- Type
- string

string
$_dir= './'
Directory where to look for the files. The default is to look in the current file.
./Details- Type
- string

string
$_endToken= 'ReplaceTokensWithFile'
Character marking the end of a token.
ReplaceTokensWithFileDetails- Type
- string

string
$_postfix= ''
File postfix to be inserted in front of the token to create the file name to be used.
- Type
- string

string
$_prefix= ''
File prefix to be inserted in front of the token to create the file name to be used.
- Type
- string

array
$_tokensources= 'array'
Array to hold the token sources that make tokens from different sources available
arrayDetails- Type
- array
Methods

_initialize(
)
:

chain(
object $reader
)
:
object| Name | Type | Description |
|---|---|---|
| $reader | object | A Reader object providing the underlying stream. Must not be |
| Type | Description |
|---|---|
| object |

getPostfix(
)
:

read(
$len
=
null
)
:
mixedIf a replacement value is not found for a token, the token is left in the stream.
| Name | Type | Description |
|---|---|---|
| $len |
| Type | Description |
|---|---|
| mixed |

replaceTokenCallback(
array $matches
)
:
string| Name | Type | Description |
|---|---|---|
| $matches | array | Array of 1 el containing key to search for. |
| Type | Description |
|---|---|
| string |
- access
- private

setBeginToken(
string $beginToken
)
:
| Name | Type | Description |
|---|---|---|
| $beginToken | string | the character used to denote the beginning of a token. |

setDir(
string $dir
)
:
| Name | Type | Description |
|---|---|---|
| $dir | string |

setEndToken(
string $endToken
)
:
| Name | Type | Description |
|---|---|---|
| $endToken | string | the character used to denote the end of a token |

setPostfix(
string $postfix
)
:
| Name | Type | Description |
|---|---|---|
| $postfix | string |

setPrefix(
string $prefix
)
:
| Name | Type | Description |
|---|---|---|
| $prefix | string |