PHP Class FileUploadPlugin, addons

Inheritance: extends Gdn_Plugin
Afficher le fichier Open project: vanilla/addons Class Usage Examples

Protected Properties

Свойство Type Description
$_MediaCache array

Méthodes publiques

Méthode Description
__construct ( ) Permission checks & property prep.
apcAvailable ( ) : boolean
assetModel_styleCss_handler ( AssetModel $sender ) Add our CSS.
base_transformDiscussionToComment_handler ( object $sender, array $args ) Update Gdn_Media when a discussion is transformed into a comment due to a merge.
commentModel_deleteComment_handler ( CommentModel $Sender )
controller_delete ( $Sender )
discussionController_afterCommentBody_handler ( DiscussionController $Sender, $Args ) : void
discussionController_afterDiscussionBody_handler ( DiscussionController $Sender )
discussionController_beforeFormButtons_handler ( DiscussionController $Sender )
discussionController_download_create ( DiscussionController $Sender )
discussionController_render_before ( DiscussionController $Sender ) Calls FileUploadPlugin::PrepareController
discussionModel_deleteDiscussion_handler ( DiscussionModel $Sender )
drawAttachFile ( mixed $Sender ) DrawAttachFile function.
findLocalMedia ( mixed $Media, $Absolute = false, $ReturnString = false ) : array
findLocalMediaFolder ( mixed $MediaID, mixed $UserID, $Absolute = false, $ReturnString = false ) : array
logModel_afterInsert_handler ( object $Sender, array $Args ) Attach files to a log entry; used when new content is sent to moderation queue.
logModel_afterRestore_handler ( LogModel $Sender, array $Args ) Attach files to record created by restoring a log entry.
mediaCache ( ) : array | null Get our cache.
mediaModel ( ) : MediaModel Get instance of MediaModel.
pluginController_fileUpload_create ( PluginController $Sender )
postController_afterBodyField_handler ( $sender ) Add "Attach a file" to edit comment form.
postController_afterCommentBody_handler ( PostController $Sender ) : void
postController_afterCommentSave_handler ( PostController $Sender, array $Args ) Attach files to a comment during save.
postController_afterDiscussionFormOptions_handler ( PostController $Sender ) Calls FileUploadPlugin::DrawAttachFile
postController_afterDiscussionSave_handler ( PostController $Sender, array $Args ) Attach files to a discussion during save.
postController_checkUpload_create ( object $Sender ) Controller method that allows an AJAX call to check the progress of a file upload that is currently in progress.
postController_render_before ( PostController $Sender ) Calls FileUploadPlugin::PrepareController
postController_upload_create ( object $Sender ) Allows plugin to handle ajax file uploads.
settingsController_addEditCategory_handler ( SettingsController $Sender )
setup ( ) Run once on enable.
structure ( ) Database update.
utilityController_thumbnail_create ( UtilityController $Sender, array $Args = [] ) Create and display a thumbnail of an uploaded file.

Méthodes protégées

Méthode Description
attachAllFiles ( mixed $AttachedFilesData, mixed $AllFilesData, mixed $ForeignID, mixed $ForeignTable ) : void AttachAllFiles function.
attachFile ( integer $FileID, integer $ForeignID, string $ForeignType ) : boolean Attach a file to a foreign table and ID.
attachUploadsToComment ( Gdn_Controller $Controller, string $Type = 'comment' ) : void
cacheAttachedMedia ( mixed $Sender ) : void CacheAttachedMedia function.
placeMedia ( &$Media, mixed $UserID ) : boolean
prepareController ( mixed $Controller ) Adds CSS and JS includes to the header of the discussion or post.
trashFile ( integer $MediaID ) Delete an uploaded file & its media record.

Method Details

__construct() public méthode

Permission checks & property prep.
public __construct ( )

apcAvailable() public static méthode

public static apcAvailable ( ) : boolean
Résultat boolean

assetModel_styleCss_handler() public méthode

Add our CSS.
public assetModel_styleCss_handler ( AssetModel $sender )
$sender AssetModel

attachAllFiles() protected méthode

AttachAllFiles function.
protected attachAllFiles ( mixed $AttachedFilesData, mixed $AllFilesData, mixed $ForeignID, mixed $ForeignTable ) : void
$AttachedFilesData mixed
$AllFilesData mixed
$ForeignID mixed
$ForeignTable mixed
Résultat void

attachFile() protected méthode

Attach a file to a foreign table and ID.
protected attachFile ( integer $FileID, integer $ForeignID, string $ForeignType ) : boolean
$FileID integer
$ForeignID integer
$ForeignType string Lowercase.
Résultat boolean Whether attach was successful.

attachUploadsToComment() protected méthode

protected attachUploadsToComment ( Gdn_Controller $Controller, string $Type = 'comment' ) : void
$Controller Gdn_Controller
$Type string
Résultat void

base_transformDiscussionToComment_handler() public méthode

Update Gdn_Media when a discussion is transformed into a comment due to a merge.
public base_transformDiscussionToComment_handler ( object $sender, array $args )
$sender object Sending controller instance
$args array Event's arguments

cacheAttachedMedia() protected méthode

CacheAttachedMedia function.
protected cacheAttachedMedia ( mixed $Sender ) : void
$Sender mixed
Résultat void

commentModel_deleteComment_handler() public méthode

public commentModel_deleteComment_handler ( CommentModel $Sender )
$Sender CommentModel

controller_delete() public méthode

public controller_delete ( $Sender )
$Sender

discussionController_afterCommentBody_handler() public méthode

public discussionController_afterCommentBody_handler ( DiscussionController $Sender, $Args ) : void
$Sender DiscussionController
Résultat void

discussionController_afterDiscussionBody_handler() public méthode

public discussionController_afterDiscussionBody_handler ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_beforeFormButtons_handler() public méthode

public discussionController_beforeFormButtons_handler ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_download_create() public méthode

public discussionController_download_create ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_render_before() public méthode

Calls FileUploadPlugin::PrepareController
public discussionController_render_before ( DiscussionController $Sender )
$Sender DiscussionController The hooked controller

discussionModel_deleteDiscussion_handler() public méthode

public discussionModel_deleteDiscussion_handler ( DiscussionModel $Sender )
$Sender DiscussionModel

drawAttachFile() public méthode

Helper method that allows the plugin to insert the file uploader UI into the Post Discussion and Post Comment forms.
public drawAttachFile ( mixed $Sender )
$Sender mixed

findLocalMedia() public static méthode

public static findLocalMedia ( mixed $Media, $Absolute = false, $ReturnString = false ) : array
$Media mixed
Résultat array

findLocalMediaFolder() public static méthode

public static findLocalMediaFolder ( mixed $MediaID, mixed $UserID, $Absolute = false, $ReturnString = false ) : array
$MediaID mixed
$UserID mixed
Résultat array

logModel_afterInsert_handler() public méthode

Attach files to a log entry; used when new content is sent to moderation queue.
public logModel_afterInsert_handler ( object $Sender, array $Args )
$Sender object
$Args array

logModel_afterRestore_handler() public méthode

This happens when a discussion or comment is approved.
public logModel_afterRestore_handler ( LogModel $Sender, array $Args )
$Sender LogModel
$Args array

mediaCache() public méthode

Get our cache.
public mediaCache ( ) : array | null
Résultat array | null

mediaModel() public méthode

Get instance of MediaModel.
public mediaModel ( ) : MediaModel
Résultat MediaModel MediaModel

placeMedia() protected méthode

protected placeMedia ( &$Media, mixed $UserID ) : boolean
$UserID mixed
Résultat boolean

pluginController_fileUpload_create() public méthode

public pluginController_fileUpload_create ( PluginController $Sender )
$Sender PluginController

postController_afterBodyField_handler() public méthode

Add "Attach a file" to edit comment form.
public postController_afterBodyField_handler ( $sender )
$sender

postController_afterCommentBody_handler() public méthode

public postController_afterCommentBody_handler ( PostController $Sender ) : void
$Sender PostController
Résultat void

postController_afterCommentSave_handler() public méthode

Attach files to a comment during save.
public postController_afterCommentSave_handler ( PostController $Sender, array $Args )
$Sender PostController
$Args array

postController_afterDiscussionFormOptions_handler() public méthode

Calls FileUploadPlugin::DrawAttachFile
public postController_afterDiscussionFormOptions_handler ( PostController $Sender )
$Sender PostController

postController_afterDiscussionSave_handler() public méthode

Attach files to a discussion during save.
public postController_afterDiscussionSave_handler ( PostController $Sender, array $Args )
$Sender PostController
$Args array

postController_checkUpload_create() public méthode

Controller method that allows an AJAX call to check the progress of a file upload that is currently in progress.
public postController_checkUpload_create ( object $Sender )
$Sender object

postController_render_before() public méthode

Calls FileUploadPlugin::PrepareController
public postController_render_before ( PostController $Sender )
$Sender PostController The hooked controller

postController_upload_create() public méthode

Allows plugin to handle ajax file uploads.
public postController_upload_create ( object $Sender )
$Sender object

prepareController() protected méthode

Adds CSS and JS includes to the header of the discussion or post.
protected prepareController ( mixed $Controller )
$Controller mixed The hooked controller

settingsController_addEditCategory_handler() public méthode

public settingsController_addEditCategory_handler ( SettingsController $Sender )
$Sender SettingsController

setup() public méthode

Run once on enable.
public setup ( )

structure() public méthode

Database update.
public structure ( )

trashFile() protected méthode

Delete an uploaded file & its media record.
protected trashFile ( integer $MediaID )
$MediaID integer Unique ID on Media table.

utilityController_thumbnail_create() public méthode

Create and display a thumbnail of an uploaded file.
public utilityController_thumbnail_create ( UtilityController $Sender, array $Args = [] )
$Sender UtilityController
$Args array

Property Details

$_MediaCache protected_oe property

protected array $_MediaCache
Résultat array