PHP Класс FileUploadPlugin, addons

Наследование: extends Gdn_Plugin
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_MediaCache array

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
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.

Описание методов

__construct() публичный Метод

Permission checks & property prep.
public __construct ( )

apcAvailable() публичный статический Метод

public static apcAvailable ( ) : boolean
Результат boolean

assetModel_styleCss_handler() публичный Метод

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

attachAllFiles() защищенный Метод

AttachAllFiles function.
protected attachAllFiles ( mixed $AttachedFilesData, mixed $AllFilesData, mixed $ForeignID, mixed $ForeignTable ) : void
$AttachedFilesData mixed
$AllFilesData mixed
$ForeignID mixed
$ForeignTable mixed
Результат void

attachFile() защищенный Метод

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.
Результат boolean Whether attach was successful.

attachUploadsToComment() защищенный Метод

protected attachUploadsToComment ( Gdn_Controller $Controller, string $Type = 'comment' ) : void
$Controller Gdn_Controller
$Type string
Результат void

base_transformDiscussionToComment_handler() публичный Метод

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() защищенный Метод

CacheAttachedMedia function.
protected cacheAttachedMedia ( mixed $Sender ) : void
$Sender mixed
Результат void

commentModel_deleteComment_handler() публичный Метод

public commentModel_deleteComment_handler ( CommentModel $Sender )
$Sender CommentModel

controller_delete() публичный Метод

public controller_delete ( $Sender )
$Sender

discussionController_afterCommentBody_handler() публичный Метод

public discussionController_afterCommentBody_handler ( DiscussionController $Sender, $Args ) : void
$Sender DiscussionController
Результат void

discussionController_afterDiscussionBody_handler() публичный Метод

public discussionController_afterDiscussionBody_handler ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_beforeFormButtons_handler() публичный Метод

public discussionController_beforeFormButtons_handler ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_download_create() публичный Метод

public discussionController_download_create ( DiscussionController $Sender )
$Sender DiscussionController

discussionController_render_before() публичный Метод

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

discussionModel_deleteDiscussion_handler() публичный Метод

public discussionModel_deleteDiscussion_handler ( DiscussionModel $Sender )
$Sender DiscussionModel

drawAttachFile() публичный Метод

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 findLocalMedia ( mixed $Media, $Absolute = false, $ReturnString = false ) : array
$Media mixed
Результат array

findLocalMediaFolder() публичный статический Метод

public static findLocalMediaFolder ( mixed $MediaID, mixed $UserID, $Absolute = false, $ReturnString = false ) : array
$MediaID mixed
$UserID mixed
Результат array

logModel_afterInsert_handler() публичный Метод

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() публичный Метод

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

mediaCache() публичный Метод

Get our cache.
public mediaCache ( ) : array | null
Результат array | null

mediaModel() публичный Метод

Get instance of MediaModel.
public mediaModel ( ) : MediaModel
Результат MediaModel MediaModel

placeMedia() защищенный Метод

protected placeMedia ( &$Media, mixed $UserID ) : boolean
$UserID mixed
Результат boolean

pluginController_fileUpload_create() публичный Метод

public pluginController_fileUpload_create ( PluginController $Sender )
$Sender PluginController

postController_afterBodyField_handler() публичный Метод

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

postController_afterCommentBody_handler() публичный Метод

public postController_afterCommentBody_handler ( PostController $Sender ) : void
$Sender PostController
Результат void

postController_afterCommentSave_handler() публичный Метод

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

postController_afterDiscussionFormOptions_handler() публичный Метод

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

postController_afterDiscussionSave_handler() публичный Метод

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

postController_checkUpload_create() публичный Метод

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() публичный Метод

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

postController_upload_create() публичный Метод

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

prepareController() защищенный Метод

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 settingsController_addEditCategory_handler ( SettingsController $Sender )
$Sender SettingsController

setup() публичный Метод

Run once on enable.
public setup ( )

structure() публичный Метод

Database update.
public structure ( )

trashFile() защищенный Метод

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

utilityController_thumbnail_create() публичный Метод

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

Описание свойств

$_MediaCache защищенное свойство

protected array $_MediaCache
Результат array