Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe LocalAdapter
+ Graphe d'héritage de LocalAdapter:

Fonctions membres publiques

 __construct (string $rootPath, string $filePath)
 
 getFile (string $path='/')
 
 getFiles (string $path='/')
 
 getResource (string $path)
 
 createFolder (string $name, string $path)
 
 createFile (string $name, string $path, $data)
 
 updateFile (string $name, string $path, $data)
 
 delete (string $path)
 
 copy (string $sourcePath, string $destinationPath, bool $force=false)
 
 move (string $sourcePath, string $destinationPath, bool $force=false)
 
 getUrl (string $path)
 
 getAdapterName ()
 
 search (string $path, string $needle, bool $recursive=false)
 

Fonctions membres privées

 getPathInformation (string $path)
 
 getDate ($date=null)
 
 copyFile (string $sourcePath, string $destinationPath, bool $force=false)
 
 copyFolder (string $sourcePath, string $destinationPath, bool $force=false)
 
 moveFile (string $sourcePath, string $destinationPath, bool $force=false)
 
 moveFolder (string $sourcePath, string $destinationPath, bool $force=false)
 
 rglob (string $pattern, int $flags=0)
 
 getEncodedPath (string $path)
 
 getSafeName (string $name)
 
 checkContent (string $localPath, string $mediaContent)
 
 getFileName (string $path)
 
 getLocalPath (string $path)
 

Attributs privés

 $rootPath = null
 
 $filePath = null
 

Description détaillée

Local file adapter.

Depuis
4.0.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( string  $rootPath,
string  $filePath 
)

The absolute root path in the local file system.

Paramètres
string$rootPathThe root path
string$filePathThe file path of media folder
Depuis
4.0.0

Références Path\clean().

Documentation des fonctions membres

◆ checkContent()

checkContent ( string  $localPath,
string  $mediaContent 
)
private

Performs various check if it is allowed to save the content with the given name.

Paramètres
string$localPathThe local path
string$mediaContentThe media content
Renvoie
void
Depuis
4.0.0
Exceptions

Références $helper, $name, Text\_(), Path\clean(), File\delete(), File\getExt(), et File\write().

◆ copy()

copy ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)

Copies a file or folder from source to destination.

It returns the new destination path. This allows the implementation classes to normalise the file name.

Paramètres
string$sourcePathThe source path
string$destinationPathThe destination path
bool$forceForce to overwrite
Renvoie
string
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $name, et Path\clean().

◆ copyFile()

copyFile ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)
private

Copies a file

Paramètres
string$sourcePathSource path of the file or directory
string$destinationPathDestination path of the file or directory
bool$forceSet true to overwrite files or directories
Renvoie
void
Depuis
4.0.0
Exceptions

Références File\copy().

◆ copyFolder()

copyFolder ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)
private

Copies a folder

Paramètres
string$sourcePathSource path of the file or directory
string$destinationPathDestination path of the file or directory
bool$forceSet true to overwrite files or directories
Renvoie
void
Depuis
4.0.0
Exceptions

Références Folder\copy(), et File\delete().

◆ createFile()

createFile ( string  $name,
string  $path,
  $data 
)

Creates a file with the given name in the given path with the data.

It returns the new file name. This allows the implementation classes to normalise the file name.

Paramètres
string$nameThe name
string$pathThe folder
string$dataThe data
Renvoie
string
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $data, $name, $path, et File\write().

◆ createFolder()

createFolder ( string  $name,
string  $path 
)

Creates a folder with the given name in the given path.

It returns the new folder name. This allows the implementation classes to normalise the file name.

Paramètres
string$nameThe name
string$pathThe folder
Renvoie
string
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $name, $path, et Folder\create().

◆ delete()

delete ( string  $path)

Deletes the folder or file of the given path.

Paramètres
string$pathThe path to the file or folder
Renvoie
void
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $path, File\delete(), Folder\delete(), Folder\exists(), et File\exists().

◆ getAdapterName()

getAdapterName ( )

Returns the name of this adapter.

Renvoie
string
Depuis
4.0.0

Implémente AdapterInterface.

◆ getDate()

getDate (   $date = null)
private

Returns a Date with the correct Joomla timezone for the given date.

Paramètres
string$dateThe date to create a Date from
Renvoie
Date
Depuis
4.0.0

Références $date, $user, Factory\getApplication(), Factory\getDate(), et Factory\getUser().

◆ getEncodedPath()

getEncodedPath ( string  $path)
private

Replace spaces on a path with %20

Paramètres
string$pathThe Path to be encoded
Renvoie
string
Depuis
4.0.0
Exceptions
FileNotFoundException

Références $path.

◆ getFile()

getFile ( string  $path = '/')

Returns the requested file or folder. The returned object has the following properties available:

  • type: The type can be file or dir
  • name: The name of the file
  • path: The relative path to the root
  • extension: The file extension
  • size: The size of the file
  • create_date: The date created
  • modified_date: The date modified
  • mime_type: The mime type
  • width: The width, when available
  • height: The height, when available

If the path doesn't exist a FileNotFoundException is thrown.

Paramètres
string$pathThe path to the file or folder
Renvoie
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $basePath, et $path.

◆ getFileName()

getFileName ( string  $path)
private

Returns the file name of the given path.

Paramètres
string$pathThe path
Renvoie
string
Depuis
4.0.0
Exceptions

Références $path, et Path\clean().

◆ getFiles()

getFiles ( string  $path = '/')

Returns the folders and files for the given path. The returned objects have the following properties available:

  • type: The type can be file or dir
  • name: The name of the file
  • path: The relative path to the root
  • extension: The file extension
  • size: The size of the file
  • create_date: The date created
  • modified_date: The date modified
  • mime_type: The mime type
  • width: The width, when available
  • height: The height, when available

If the path doesn't exist a FileNotFoundException is thrown.

Paramètres
string$pathThe folder
Renvoie
[]
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $basePath, $data, $folder, $path, Path\clean(), Folder\files(), et Folder\folders().

◆ getLocalPath()

getLocalPath ( string  $path)
private

Returns the local filesystem path for the given path.

Throws an InvalidPathException if the path is invalid.

Paramètres
string$pathThe path
Renvoie
string
Depuis
4.0.0
Exceptions
InvalidPathException

Références $path, et Path\check().

◆ getPathInformation()

getPathInformation ( string  $path)
private

Returns the folder or file information for the given path. The returned object has the following properties:

  • type: The type can be file or dir
  • name: The name of the file
  • path: The relative path to the root
  • extension: The file extension
  • size: The size of the file
  • create_date: The date created
  • modified_date: The date modified
  • mime_type: The mime type
  • width: The width, when available
  • height: The height, when available
  • thumb_path The thumbnail path of file, when available
Paramètres
string$pathThe folder
Renvoie
Depuis
4.0.0

Références $path, Text\_(), HTMLHelper\_(), Path\clean(), File\getExt(), Image\getImageFileProperties(), MediaHelper\getMimeType(), et MediaHelper\isImage().

◆ getResource()

getResource ( string  $path)

Returns a resource to download the path.

Paramètres
string$pathThe path to download
Renvoie
resource
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $path.

◆ getSafeName()

getSafeName ( string  $name)
private

Creates a safe file name for the given name.

Paramètres
string$nameThe filename
Renvoie
string
Depuis
4.0.0
Exceptions

Références $extension, $name, Text\_(), File\getExt(), File\makeSafe(), et PunycodeHelper\toPunycode().

◆ getUrl()

getUrl ( string  $path)

Returns a url which can be used to display an image from within the "images" directory.

Paramètres
string$pathPath of the file relative to adapter
Renvoie
string
Depuis
4.0.0

Implémente AdapterInterface.

Références $path, et Uri\root().

◆ move()

move ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)

Moves a file or folder from source to destination.

It returns the new destination path. This allows the implementation classes to normalise the file name.

Paramètres
string$sourcePathThe source path
string$destinationPathThe destination path
bool$forceForce to overwrite
Renvoie
string
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $name, Text\_(), et Path\clean().

◆ moveFile()

moveFile ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)
private

Moves a file

Paramètres
string$sourcePathAbsolute path of source
string$destinationPathAbsolute path of destination
bool$forceSet true to overwrite file if exists
Renvoie
void
Depuis
4.0.0
Exceptions

Références MediaHelper\checkFileExtension(), et File\move().

◆ moveFolder()

moveFolder ( string  $sourcePath,
string  $destinationPath,
bool  $force = false 
)
private

Moves a folder from source to destination

Paramètres
string$sourcePathSource path of the file or directory
string$destinationPathDestination path of the file or directory
bool$forceSet true to overwrite files or directories
Renvoie
void
Depuis
4.0.0
Exceptions

Références $value, Folder\copy(), File\delete(), Folder\delete(), et Folder\move().

◆ rglob()

rglob ( string  $pattern,
int  $flags = 0 
)
private

Do a recursive search on a given path

Paramètres
string$patternThe pattern for search
int$flagsFlags for search
Renvoie
array
Depuis
4.0.0

Références $dir.

◆ search()

search ( string  $path,
string  $needle,
bool  $recursive = false 
)

Search for a pattern in a given path

Paramètres
string$pathThe base path for the search
string$needleThe path to file
bool$recursiveDo a recursive search
Renvoie
[]
Depuis
4.0.0

Implémente AdapterInterface.

Références $path, $result, $results, et Path\clean().

◆ updateFile()

updateFile ( string  $name,
string  $path,
  $data 
)

Updates the file with the given name in the given path with the data.

Paramètres
string$nameThe name
string$pathThe folder
string$dataThe data
Renvoie
void
Depuis
4.0.0
Exceptions

Implémente AdapterInterface.

Références $data, $name, $path, File\exists(), et File\write().

Documentation des champs

◆ $filePath

$filePath = null
private

◆ $rootPath

$rootPath = null
private

La documentation de cette classe a été générée à partir du fichier suivant :