core/model/modx/transport/modtranslator.class.php
- Package
- modx
- Subpackage
- transport
\modTranslator
Package: modx\transport
Abstracts the pre-097 site conversion utilities.
- Parent(s)
- \modTranslate095
Properties

array
$classes= ''
Can either be an array of array of classname => fields to translate, empty to skip classes or null to process all standard content fields for MODX (use processAllFields())
Details
- Type
- array

\modParser095
$parser= 'null'
inherited
The parsing engine for interpreting Evolution-style tags
Inherited from: \modTranslate095::$$parser
Default value
nullDetails- Type
- \modParser095
- Inherited_from
- \modTranslate095::$$parser

array
$paths= ''
Paths of files, according to the patterns, to be translated (recursive)
Details
- Type
- array

string
$patterns= ''
File patterns to limit the file types to be included for translation in the paths
Details
- Type
- string
Methods

__construct(
\xPDO $modx, bool $recursive
=
true
)
:
voidInitializes the class and sets up a translation map
Parameters
| Name | Type | Description |
|---|---|---|
| $modx | \xPDO | A reference to the xPDO|modX instance |
| $recursive | bool | Whether or not this translator will recurse |

getAllSubdirs(
string $path
)
:
voidRecursively adds all subdirs of a directory.
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | The path to recursively search in. |

processAllFields(
boolean $b
=
true
)
:
voidSets the translator to process all standard MODX fields.
Parameters
| Name | Type | Description |
|---|---|---|
| $b | boolean | If false, will revert to an empty array of classes. |

translateFiles(
boolean $save
=
false, array $files
=
array()
)
:
string
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $save | boolean | If true, will save the translation |
| $files | array | An array of files to translate |
| Type | Description |
|---|---|
| string |

translateSite(
boolean $save
=
false, boolean $toFile
=
false
)
:
voidTranslates the site.
Parameters
| Name | Type | Description |
|---|---|---|
| $save | boolean | Determines if translation is written to the database tables and/or files (changes are permanent if true) |
| $toFile | boolean | A path to a file where a log of the translation session is written |