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

Fonctions membres publiques

 execute ($task)
 
 getFiles ()
 
 deleteFiles ()
 
 postFiles ()
 
 putFiles ()
 
 getModel ($name='Api', $prefix='Administrator', $config=[])
 
- Fonctions membres publiques hérités de BaseController
 __construct ($config=array(), MVCFactoryInterface $factory=null, ?CMSApplication $app=null, ?Input $input=null)
 
 addViewPath ($path)
 
 execute ($task)
 
 getModel ($name='', $prefix='', $config=array())
 
 getName ()
 
 getTask ()
 
 getTasks ()
 
 getView ($name='', $type='', $prefix='', $config=array())
 
 redirect ()
 
 registerDefaultTask ($method)
 
 registerTask ($task, $method)
 
 unregisterTask ($task)
 
 setMessage ($text, $type='message')
 
 checkToken ($method='post', $redirect=true)
 
 setRedirect ($url, $msg=null, $type=null)
 
- Fonctions membres publiques hérités de DispatcherAwareInterface
 setDispatcher (DispatcherInterface $dispatcher)
 

Fonctions membres privées

 sendResponse ($data=null, int $responseCode=200)
 
 checkContent ()
 
 getAdapter ()
 
 getPath ()
 

Membres hérités additionnels

- Fonctions membres publiques statiques hérités de BaseController
static addModelPath ($path, $prefix='')
 
static createFileName ($type, $parts=array())
 
static getInstance ($prefix, $config=array())
 
- Fonctions membres protégées hérités de BaseController
 addPath ($type, $path)
 
 checkEditId ($context, $id)
 
 createModel ($name, $prefix='', $config=array())
 
 createView ($name, $prefix='', $type='', $config=array())
 
 holdEditId ($context, $id)
 
 releaseEditId ($context, $id)
 
 setPath ($type, $path)
 
- Attributs protégés hérités de BaseController
 $basePath
 
 $default_view
 
 $doTask
 
 $message
 
 $messageType
 
 $methods
 
 $name
 
 $model_prefix
 
 $paths
 
 $redirect
 
 $task
 
 $taskMap
 
 $input
 
 $factory
 
 $app
 
- Attributs protégés statiques hérités de BaseController
static $instance
 
static $views
 

Description détaillée

Api Media Controller

This is NO public api controller, it is internal for the com_media component only!

Depuis
4.0.0

Documentation des fonctions membres

◆ checkContent()

checkContent ( )
private

Performs various checks if it is allowed to save the content.

Renvoie
void
Depuis
4.0.0
Exceptions

Références $helper, $params, Text\_(), et ComponentHelper\getParams().

◆ deleteFiles()

deleteFiles ( )

Files delete Method

Examples:

  • DELETE an existing folder in a specific folder: index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test /api/files/sampledata/cassiopeia/test
  • DELETE an existing file in a specific folder: index.php?option=com_media&task=api.files&path=/sampledata/cassiopeia/test.jpg /api/files/sampledata/cassiopeia/test.jpg
Renvoie
null
Depuis
4.0.0
Exceptions

Références Text\_(), Joomla\Component\Media\Administrator\Provider\getAdapter(), et null.

◆ execute()

execute (   $task)

Execute a task by triggering a method in the derived class.

Paramètres
string$taskThe task to perform. If no matching task is found, the '__default' task is executed, if defined.
Renvoie
mixed The value returned by the called method.
Depuis
4.0.0
Exceptions

Implémente ControllerInterface.

Références $data, $method, $task, Text\_(), Session\checkToken(), method, et Text\sprintf().

◆ getAdapter()

getAdapter ( )
private

Get the Adapter.

Renvoie
string
Depuis
4.0.0

Références $parts, et null.

◆ getFiles()

getFiles ( )

Files Get Method

Examples:

  • GET a list of folders below the root: index.php?option=com_media&task=api.files /api/files
  • GET a list of files and subfolders of a given folder: index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia /api/files/sampledata/cassiopeia
  • GET a list of files and subfolders of a given folder for a given search term: use recursive=1 to search recursively in the working directory index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5 /api/files/sampledata/cassiopeia?search=nasa5 To look up in same working directory set flag recursive=0 index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5&recursive=0 /api/files/sampledata/cassiopeia?search=nasa5&recursive=0
  • GET file information for a specific file: index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg /api/files/sampledata/cassiopeia/test.jpg
  • GET a temporary URL to a given file index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1&temp=1 /api/files/sampledata/cassiopeia/test.jpg&url=1&temp=1
  • GET a temporary URL to a given file index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1 /api/files/sampledata/cassiopeia/test.jpg&url=1
Renvoie
array The data to send with the response
Depuis
4.0.0
Exceptions

Références $options, et Joomla\Component\Media\Administrator\Provider\getAdapter().

◆ getModel()

getModel (   $name = 'Api',
  $prefix = 'Administrator',
  $config = [] 
)

Method to get a model object, loading it if required.

Paramètres
string$nameThe model name. Optional.
string$prefixThe class prefix. Optional.
array$configConfiguration array for model. Optional.
Renvoie
BaseModel|boolean Model object on success; otherwise false on failure.
Depuis
4.0.0

Références $config, $name, et $prefix.

◆ getPath()

getPath ( )
private

Get the Path.

Renvoie
string
Depuis
4.0.0

Références $parts, et null.

◆ postFiles()

postFiles ( )

Files Post Method

Examples:

  • POST a new file or folder into a specific folder, the file or folder information is returned: index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia /api/files/sampledata/cassiopeia

    New file body: { "name": "test.jpg", "content":"base64 encoded image" } New folder body: { "name": "test", }

Renvoie
array The data to send with the response
Depuis
4.0.0
Exceptions

Références $content, $name, $options, $path, Text\_(), et Joomla\Component\Media\Administrator\Provider\getAdapter().

◆ putFiles()

putFiles ( )

Files Put method

Examples:

  • PUT a media file, the file or folder information is returned: index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg /api/files/sampledata/cassiopeia/test.jpg

    Update file body: { "content":"base64 encoded image" }

  • PUT move a file, folder to another one path : will be taken as the source index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg /api/files/sampledata/cassiopeia/test.jpg

    JSON body: { "newPath" : "/path/to/destination", "move" : "1" }

  • PUT copy a file, folder to another one path : will be taken as the source index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg /api/files/sampledata/cassiopeia/test.jpg

    JSON body: { "newPath" : "/path/to/destination", "move" : "0" }

Renvoie
array The data to send with the response
Depuis
4.0.0
Exceptions

Références $content, $name, $path, Text\_(), Joomla\Component\Media\Administrator\Provider\getAdapter(), et null.

◆ sendResponse()

sendResponse (   $data = null,
int  $responseCode = 200 
)
private

Send the given data as JSON response in the following format:

{"success":true,"message":"ok","messages":null,"data":[{"type":"dir","name":"banners","path":"//"}]}

Paramètres
mixed$dataThe data to send
integer$responseCodeThe response code
Renvoie
void
Depuis
4.0.0

Références $data.


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