BEdita API doc | 4-cactus
  • Class
  • Tree
  • Deprecated
  • Download

Classes

  • Addon
  • AddressbookController
  • AddressbookShell
  • AdminController
  • Alias
  • Annotation
  • ApiAuthComponent
  • ApiBaseController
  • ApiFormatterComponent
  • ApiUploadComponent
  • ApiValidatorComponent
  • AppController
  • AppError
  • AppHelper
  • Application
  • AppModel
  • Area
  • AreasController
  • Audio
  • AuthenticationsController
  • BannedIp
  • BEAppModel
  • BEAppObjectModel
  • BeAuthComponent
  • BeAuthFacebookComponent
  • BeAuthGoogleComponent
  • BeAuthTwitterComponent
  • BeCallbackManager
  • BeConfigure
  • BeCustomPropertyComponent
  • BeditaAnnotationModel
  • BeditaBaseShell
  • BeditaCollectionModel
  • BeditaContentModel
  • BeditaExportFilter
  • BeditaImportFilter
  • BeditaObjectModel
  • BeditaProductModel
  • BeditaShell
  • BeditaSimpleObjectModel
  • BeditaSimpleStreamModel
  • BeditaStreamModel
  • BeEmbedFlashHelper
  • BeEmbedHtml5Helper
  • BeEmbedMediaHelper
  • BeErrorCode
  • BeExceptionHandler
  • BEFile
  • BeFileHandlerComponent
  • BeFormHelper
  • BeFrontHelper
  • BeHashComponent
  • BeHtmlHelper
  • BeLangTextComponent
  • BeLib
  • BeMailComponent
  • BEObject
  • BeObjectCache
  • BePaginatorToolbarHelper
  • BeSchema
  • BeSecurityComponent
  • BeSystem
  • BeSystemComponent
  • BeThumb
  • BeTimeHelper
  • BeToolbarHelper
  • BeTreeComponent
  • BeTreeHelper
  • BeUploadToObjComponent
  • BeurlHelper
  • BeVimeoComponent
  • BeYoutubeComponent
  • BuildFilterBehavior
  • CacheableBehavior
  • CacheShell
  • CallbackBehavior
  • CaptchaComponent
  • Caption
  • CaptionsBehavior
  • Card
  • CardsImportFilter
  • Category
  • CleanupDataTask
  • CleanupTask
  • Comment
  • CommentsController
  • CompactResultBehavior
  • Content
  • CreateIndexFieldsBehavior
  • DataShell
  • DataTransfer
  • DateItem
  • DbadminShell
  • DeleteDependentObjectBehavior
  • DeleteObjectBehavior
  • DeployShell
  • Document
  • DocumentsController
  • DumpModel
  • EditorialContentsShell
  • EditorNote
  • Event
  • EventLog
  • EventsController
  • FilesController
  • ForeignDependenceSaveBehavior
  • FrontendController
  • FrontendShell
  • GalleriesController
  • Gallery
  • GeoTag
  • GettextShell
  • Git
  • GravatarHelper
  • Group
  • HashJob
  • History
  • HomeController
  • Image
  • ImageInfoHelper
  • JsonExportFilter
  • JsonImportFilter
  • JsonView
  • LangText
  • Link
  • MailGroup
  • MailGroupCard
  • MailJob
  • MailLog
  • MailMessage
  • MailShell
  • MailTemplate
  • Mask
  • MediaShell
  • MigrateDumpModel
  • MigrateShell
  • Migration
  • MigrationBase
  • MigrationDateItemsShell
  • Module
  • ModulesController
  • ModuleShell
  • MultimediaController
  • NewsController
  • NewsletterController
  • NewsletterShell
  • NotifyBehavior
  • ObjectEditor
  • ObjectProperty
  • ObjectRelation
  • ObjectType
  • ObjectUser
  • PagesController
  • Permission
  • PermissionModule
  • PermsHelper
  • Product
  • Property
  • PropertyOption
  • PublicationShell
  • RedisShell
  • RelationCheck
  • RelationRepair
  • RelationShell
  • RelationStats
  • RemoveDummyNameBehavior
  • ResponseHandlerComponent
  • RestClientModel
  • Revision
  • RevisionObjectBehavior
  • SearchText
  • SearchTextSaveBehavior
  • Section
  • SectionDummy
  • SessionFilterComponent
  • SessionFilterHelper
  • ShortNews
  • SmartyView
  • SoapClientModel
  • SplitterSql
  • StatisticsController
  • Stream
  • StreamLog
  • StreamsController
  • Svn
  • TagsController
  • ThemeSmartyView
  • ThumbnailHelper
  • ThumbShell
  • TransactionComponent
  • TransactionFS
  • TranslationsController
  • Tree
  • TrHelper
  • User
  • UserProperty
  • UsersController
  • Utility
  • Version
  • Video
  • VimeoHelper
  • WebmarksController
  • XmlExportFilter
  • XmlImportFilter
  • XmlJsonConverter
  • XmlView
  • YoutubeHelper

Interfaces

  • ApiAuthInterface
  • MediaProviderInterface
  • UploadableInterface

Exceptions

  • BeditaAjaxException
  • BEditaAllowURLException
  • BeditaBadRequestException
  • BeditaConflictException
  • BEditaDeleteStreamObjException
  • BeditaException
  • BEditaFileExistException
  • BeditaForbiddenException
  • BeditaFrontAccessException
  • BeditaHashException
  • BEditaInfoException
  • BeditaInternalErrorException
  • BEditaIOException
  • BeditaLengthRequiredException
  • BeditaMailException
  • BEditaMediaProviderException
  • BeditaMethodNotAllowedException
  • BEditaMIMEException
  • BeditaNotFoundException
  • BeditaNotImplementedException
  • BeditaPublicationException
  • BeditaRuntimeException
  • BEditaSaveStreamObjException
  • BeditaServiceUnavailableException
  • BeditaUnauthorizedException
  • BEditaUploadPHPException
  • BEditaURLException

Class ApiUploadComponent

ApiUploadComponent class

Used to handle upload via REST API

Object
Extended by ApiUploadComponent
Located at controllers/components/api_upload.php

Methods summary

public
# initialize( Controller $controller, array $settings = array() )

Initialize component (called before Controller::beforeFilter())

Initialize component (called before Controller::beforeFilter())

Parameters

$controller
$settings
public array
# quota( array $quotaConf = array() )

Set quota configuration and return it. If it's called without parameter return the current quota configuration.

Set quota configuration and return it. If it's called without parameter return the current quota configuration.

Replace self::$quota conf with the new one in $quotaConf passed. If $quotaConf missing of some keys the related value already set are maintained

Parameters

$quotaConf
The quota configuration

Returns

array
public string
# upload( string $originalFileName, string $objectType )

Upload a file using local filesystem or delegating to Model::apiUpload() method if exists.

Upload a file using local filesystem or delegating to Model::apiUpload() method if exists.

After the file is moved to the right location a row in hash_jobs is added with status "pending" and the hash string is returned. That hash string must be used from client to associate a new object to the file uploaded

Parameters

$originalFileName
The target file name
$objectType
The object type to which the upload file refers

Returns

string

Throws

BeditaInternalErrorException
BeditaConflictException
When file already exists
public
# checkQuota( integer $fileSize )

Given the file size of file to upload it checks if the upload quota configuration is exceeded.

Given the file size of file to upload it checks if the upload quota configuration is exceeded.

Parameters

$fileSize
The file size of file to upload
public array|false
# quotaUsed( )

Return the upload quota occupied divided by object type.

Return the upload quota occupied divided by object type.

Event triggered:

  • Api.uploadQuota: pass to listener a list of objects uploadable and the authenticated user

    The listener should be calculate the size occupied (in bytes) from all files linked to a specific object type and the total number of files. It should be return an array with object types as keys and the above information. For example:

    array(
      'image' => array(
          'size' => 12345678,
          'number' => 256
       ),
       'video' => array(
          'size' => 123456789,
          'number' => 15
       ),
    )
    

    The listener should be merge its results with $event->result to avoid to delete other results calculated from another listener.

    If the listener returns false or stop the event propagation the method return false.

Returns

array|false
It returns false if the quota calculation fails
public File
# source( )

Read from php://input, put the content in a temporary file and return the File instance

Read from php://input, put the content in a temporary file and return the File instance

Returns

File

Throws

BeditaBadRequestException,
BeditaInternalErrorException, BeditaLengthRequiredException
public string
# put( File $source, string $targetName )

Copy the source file in a target path obtained starting from $targetName and returning the target path. Once the file is successfully copied it is removed.

Copy the source file in a target path obtained starting from $targetName and returning the target path. Once the file is successfully copied it is removed.

Parameters

$source
The source File instance
$targetName
The file target name

Returns

string

Throws

BeditaInternalErrorException
protected string
# generateToken( array $params = array() )

Save an upload token in hash_jobs table and return it.

Save an upload token in hash_jobs table and return it.

Parameters

$params
An array of parameters to save in hash_jobs.params

Returns

string

Throws

BeditaInternalErrorException
public array
# uploadedFileData( string $uploadToken, string $objectType )

Given an upload token it returns the related data

Given an upload token it returns the related data

Parameters

$uploadToken
The upload token
$objectType
The object type related to the upload operation

Returns

array
public array
# validateToken( string $uploadToken )

Validate an $uploadToken and return data related

Validate an $uploadToken and return data related

Parameters

$uploadToken
The upload token to validate

Returns

array

Throws

BeditaBadRequestException
When the token doesn't exists or is not valid anymore
public boolean
# removeToken( string $uploadToken )

Remove $uploadToken

Remove $uploadToken

Parameters

$uploadToken
The upload token to remove

Returns

boolean

Properties summary

public Controller $controller

Controller instance

Controller instance

# null
public array $components

List of components used

List of components used

# array('BeFileHandler')
protected array $quota

Upload quota configuration.

Upload quota configuration.

Options available:

  • maxFileSize: max single file size supported (default 50 MB)
  • maxSizeAvailable: max size available for each user (default 500 MB)
  • maxFilesAllowed: max number of files uploadable for each user (default 500)
# array( 'maxFileSize' => 52428800, // 50 * 1024^2 'maxSizeAvailable' => 524288000, // 500 * 1024^2 'maxFilesAllowed' => 500 )
BEdita API doc | 4-cactus API documentation generated by ApiGen