core/model/modx/import/modstaticimport.class.php
- Package
- modx
- Subpackage
- import
\modStaticImport
Package: modx\import
Provides common functions for importing content from static files.
- Parent(s)
- \modImport
Properties
\modX
$modx= 'null'
inheritedA reference to the modX instanceInherited from:
\modImport::$$modx
Default value
null
Details- Type
- \modX
- Inherited_from
- \modImport::$$modx
array
$properties= 'array ()'
inheritedA collection of properties that are being used in this importInherited from:
\modImport::$$properties
Default value
array ()
Details- Type
- array
- Inherited_from
- \modImport::$$properties
array
$results= 'array()'
inheritedA collection of results in an arrayInherited from:
\modImport::$$results
Default value
array()
Details- Type
- array
- Inherited_from
- \modImport::$$results
Methods
__construct(
\modX $modx
)
:
void
inherited
Inherited from:
\modImport::__construct()
Parameters
Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX instance |
getFileContent(
string $file
)
:
string
Parameters
Returns
Name | Type | Description |
---|---|---|
$file | string | An absolute path to the file |
Type | Description |
---|---|
string |
getFileContentType(
\$extension $extension
)
:
string
Parameters
Returns
Name | Type | Description |
---|---|---|
$extension | \$extension | The extension of the file |
Type | Description |
---|---|
string | The content-type of the file |
getFiles(
array $filesfound, string $directory, array $listing
=
array (), int $count
=
0
)
:
array
inherited
Inherited from:
\modImport::getFiles()
Parameters
Returns
Name | Type | Description |
---|---|---|
$filesfound | array | A reference to an array of file locations |
$directory | string | The directory to import from |
$listing | array | A listing of imported files |
$count | int | The current count iteration |
Type | Description |
---|---|
array |
getResourceAlias(
\modResource $resource, string $alias, integer $parent, string $context
=
'web'
)
:
string
Calculate a resource alias from the imported file
Parameters
Returns
Name | Type | Description |
---|---|---|
$resource | \modResource | A reference to the new modResource object |
$alias | string | A suggested alias |
$parent | integer | The parent ID of the Resource |
$context | string | The context of the Resource |
Type | Description |
---|---|
string | The formatted alias |
importFiles(
array $allowedfiles, integer $parent, string $filepath, array $files, string $context
=
'web', string $class
=
'modStaticResource', string $basefilepath
=
''
)
:
Import files into MODX
Parameters
Name | Type | Description |
---|---|---|
$allowedfiles | array | An array of allowed file types |
$parent | integer | The parent Resource to pull into |
$filepath | string | The path to the files to import |
$files | array | An array of imported files |
$context | string | The context to import into |
$class | string | The class of Resource to import as |
$basefilepath | string | The base file path for the import |