PHP 클래스 EditorPlugin, vanilla

상속: extends Gdn_Plugin
파일 보기 프로젝트 열기: vanilla/vanilla

공개 프로퍼티들

프로퍼티 타입 설명
$ForceWysiwyg integer | mixed

보호된 프로퍼티들

프로퍼티 타입 설명
$AssetPath Asset path for this plugin, set in Gdn_Form_BeforeBodyBox_Handler.
$Format Default format being used for current rendering. Can be one of the formats listed in $Formats.
$Formats List of possible formats the editor supports.
$canUpload boolean
$editorBaseUploadDestinationDir string
$editorFileInputName This is used as the input name for file uploads. It will be passed to JS as well. Note that it can be defined as an array, by adding square brackets, e.g., editorupload[], but that will make all the Vanilla upload classes incompatible because they are hardcoded to handle only single files at a time, not an array of files. Perhaps in future make core upload classes more flexible.
$mediaCache This will cache the discussion media results for the page request. Populated from either the db or memcached.
$mediaCacheExpire How long memcached holds data until it expires.
$pluginInfo Give class access to PluginInfo

공개 메소드들

메소드 설명
__construct ( ) Setup some variables for instance.
assetModel_styleCss_handler ( $Sender ) Load CSS into head for editor
base_render_before ( $Sender ) Placed these components everywhere due to some Web sites loading the editor in some areas where the values were not yet injected into HTML.
discussionController_afterCommentBody_handler ( $Sender, $Args )
discussionController_afterDiscussionBody_handler ( $Sender, $Args )
gdn_form_beforeBodyBox_handler ( Gdn_Form $Sender, $Args ) Attach editor anywhere 'BodyBox' is used.
getAbsoluteDestinationFilePath ( $tmpFilePath, $fileExtension, $uploadDestinationDir = '' ) Instead of using Gdn_Upload->GenerateTargetName, create one that depends on SHA1s, to reduce space for duplicates, and use smarter folder sorting based off the SHA1s.
getAllowedEditorActions ( ) : array Set the editor actions to true or false to enable or disable the action from displaying in the editor toolbar.
getBaseUploadDestinationDir ( $subdir = false ) Specific to editor upload paths
getFontFamilyOptions ( ) : array Generate list of font families. Remember to create corresponding CSS.
isEmbeddedComment ( Controller $Sender ) : boolean Check if comments are embedded.
mediaCache ( $Sender ) Get media list for inserting into discussion and comments.
messagesController_afterConversationMessageBody_handler ( $Sender, $Args )
messagesController_afterConversationSave_handler ( object $Sender, array $Args ) Attach files to a message during conversation save.
messagesController_afterMessageSave_handler ( object $Sender, array $Args ) Attach files to a message during save.
postController_afterCommentBody_handler ( $Sender, $Args )
postController_afterCommentSave_handler ( object $Sender, array $Args ) Attach files to a comment during save.
postController_afterDiscussionSave_handler ( object $Sender, array $Args ) Attach files to a discussion during save.
postController_discussionFormOptions_handler ( $Sender, $Args )
postController_editorUpload_create ( PostController $Sender, array $Args = [] )
preloadDiscussionMedia ( integer $discussionID, array $commentIDList, $type = 'discussion' ) : array Query the Media table for any media related to the current discussion, including all the comments. This will be cached per discussion.
saveUploads ( $id, $type ) Save uploads.
settingsController_addEditCategory_handler ( Gdn_Controller $Sender ) Add upload option checkbox to custom permissions for categories.
settingsController_editor_create ( SettingsController $Sender, array $Args )
setup ( ) When enabled, disable other known editors that may clash with this one.
sortWeightedOptions ( &$options ) Sort dropdown options by given weight.
structure ( )
utilityController_mediaThumbnail_create ( $sender, $media_id ) Create and display a thumbnail of an uploaded file.
validateUploadDestinationPath ( string $path ) Check if provided path is valid, creates it if it does not exist, and verifies that it is writable.

보호된 메소드들

메소드 설명
attachEditorUploads ( integer $FileID, integer $ForeignID, string $ForeignType ) : boolean Attach a file to a foreign table and ID.
attachUploadsToComment ( $Sender, string $Type = 'comment', array | object $row = null ) Attach image to each discussion or comment.
cacheAttachedMedia ( mixed $Sender ) Called to prepare data grab, and then cache the results on the software level for the request.
canUpload ( ) : boolean Checks whether the canUpload property is set and if not, calculates it value.
deleteEditorUploads ( $MediaID, type $ForeignID = '', type $ForeignType = '' ) : boolean Remove file from filesystem, and clear db entry.
getConversationMessageIDList ( $id ) : array
getEditorToolbar ( $attributes = [] ) : array This method will grab the permissions array from getAllowedEditorActions, build the "kitchen sink" editor toolbar, then filter out the allowed ones and return it.
getFontColorList ( ) : array To enable more colors in the dropdown, simply expand the array to include more human-readable font color names.
getFontFormatOptions ( ) : array Default formatting options available in the formatting dropdown.

메소드 상세

__construct() 공개 메소드

Setup some variables for instance.
public __construct ( )

assetModel_styleCss_handler() 공개 메소드

Load CSS into head for editor
public assetModel_styleCss_handler ( $Sender )

attachEditorUploads() 보호된 메소드

Attach a file to a foreign table and ID.
protected attachEditorUploads ( integer $FileID, integer $ForeignID, string $ForeignType ) : boolean
$FileID integer
$ForeignID integer
$ForeignType string Lowercase.
리턴 boolean Whether attach was successful.

attachUploadsToComment() 보호된 메소드

It will first perform a single request against the Media table, then filter out the ones that exist per discussion or comment.
protected attachUploadsToComment ( $Sender, string $Type = 'comment', array | object $row = null )
$Type string The type of row, either discussion or comment.
$row array | object The row of data being attached to.

base_render_before() 공개 메소드

Placed these components everywhere due to some Web sites loading the editor in some areas where the values were not yet injected into HTML.
public base_render_before ( $Sender )

cacheAttachedMedia() 보호된 메소드

This will call PreloadDiscussionMedia, which will either query the db, or query memcached.
protected cacheAttachedMedia ( mixed $Sender )
$Sender mixed

canUpload() 보호된 메소드

The calculation is based on config, user permissions, and category permissions.
protected canUpload ( ) : boolean
리턴 boolean Whether the session user is allowed to upload a file.

deleteEditorUploads() 보호된 메소드

Remove file from filesystem, and clear db entry.
protected deleteEditorUploads ( $MediaID, type $ForeignID = '', type $ForeignType = '' ) : boolean
$ForeignID type
$ForeignType type
리턴 boolean

discussionController_afterCommentBody_handler() 공개 메소드

discussionController_afterDiscussionBody_handler() 공개 메소드

gdn_form_beforeBodyBox_handler() 공개 메소드

It is not being used for editing a posted reply, so find another event to hook into.
public gdn_form_beforeBodyBox_handler ( Gdn_Form $Sender, $Args )
$Sender Gdn_Form

getAbsoluteDestinationFilePath() 공개 메소드

Instead of using Gdn_Upload->GenerateTargetName, create one that depends on SHA1s, to reduce space for duplicates, and use smarter folder sorting based off the SHA1s.
public getAbsoluteDestinationFilePath ( $tmpFilePath, $fileExtension, $uploadDestinationDir = '' )

getAllowedEditorActions() 공개 메소드

This will also let you toggle the separators from appearing between the loosely grouped actions.
public getAllowedEditorActions ( ) : array
리턴 array List of allowed editor actions

getBaseUploadDestinationDir() 공개 메소드

Specific to editor upload paths
public getBaseUploadDestinationDir ( $subdir = false )

getConversationMessageIDList() 보호된 메소드

protected getConversationMessageIDList ( $id ) : array
$id
리턴 array

getEditorToolbar() 보호된 메소드

This method will grab the permissions array from getAllowedEditorActions, build the "kitchen sink" editor toolbar, then filter out the allowed ones and return it.
protected getEditorToolbar ( $attributes = [] ) : array
리턴 array Returns the array of allowed editor toolbar actions

getFontColorList() 보호된 메소드

Note: in building the dropdown, each color is styled inline, but it will still be required to add the appropriate post-color-* CSS class selectors in the external stylesheet, so that when viewing a posted comment, the color will appear. In addition, the class names must be whitelisted in advanced.js. Not all colors in the CSS stylesheet are included here. Note: use these http://clrs.cc/ and purple: #7b11d0
protected getFontColorList ( ) : array
리턴 array Returns array of font colors to use in dropdown

getFontFamilyOptions() 공개 메소드

Generate list of font families. Remember to create corresponding CSS.
public getFontFamilyOptions ( ) : array
리턴 array

getFontFormatOptions() 보호된 메소드

Visit https://github.com/xing/wysihtml5/wiki/Supported-Commands for a list of default commands and their allowed values. The array below has custom commands that must exist in the JavaScript, whitelist, and CSS to function. Formatting options can be ordered after the default list has been added. This is done by providing a sort weight to each editor action. If one weight is greater than another, it will be displayed higher than the other.
protected getFontFormatOptions ( ) : array
리턴 array

isEmbeddedComment() 공개 메소드

When editing embedded comments, the editor will still load its assets and render. This method will check whether content is embedded or not. This might not be the best way to do this, but there does not seem to be any easy way to determine whether content is embedded or not.
public isEmbeddedComment ( Controller $Sender ) : boolean
$Sender Controller
리턴 boolean

mediaCache() 공개 메소드

Get media list for inserting into discussion and comments.
public mediaCache ( $Sender )

messagesController_afterConversationMessageBody_handler() 공개 메소드

messagesController_afterConversationSave_handler() 공개 메소드

Attach files to a message during conversation save.

messagesController_afterMessageSave_handler() 공개 메소드

Attach files to a message during save.
public messagesController_afterMessageSave_handler ( object $Sender, array $Args )
$Sender object
$Args array

postController_afterCommentBody_handler() 공개 메소드

public postController_afterCommentBody_handler ( $Sender, $Args )

postController_afterCommentSave_handler() 공개 메소드

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

postController_afterDiscussionSave_handler() 공개 메소드

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

postController_discussionFormOptions_handler() 공개 메소드

postController_editorUpload_create() 공개 메소드

public postController_editorUpload_create ( PostController $Sender, array $Args = [] )
$Sender PostController
$Args array

preloadDiscussionMedia() 공개 메소드

Query the Media table for any media related to the current discussion, including all the comments. This will be cached per discussion.
public preloadDiscussionMedia ( integer $discussionID, array $commentIDList, $type = 'discussion' ) : array
$discussionID integer
$commentIDList array
리턴 array

saveUploads() 공개 메소드

Save uploads.
public saveUploads ( $id, $type )
$id
$type

settingsController_addEditCategory_handler() 공개 메소드

Add upload option checkbox to custom permissions for categories.
public settingsController_addEditCategory_handler ( Gdn_Controller $Sender )
$Sender Gdn_Controller

settingsController_editor_create() 공개 메소드

public settingsController_editor_create ( SettingsController $Sender, array $Args )
$Sender SettingsController
$Args array

setup() 공개 메소드

If editor is loaded, then the other editors loaded after, there are CSS rules that hide them. This way, the editor plugin always takes precedence.
public setup ( )

sortWeightedOptions() 공개 메소드

Currently this is only in use for the formatting options.
public sortWeightedOptions ( &$options )

structure() 공개 메소드

public structure ( )

utilityController_mediaThumbnail_create() 공개 메소드

Create and display a thumbnail of an uploaded file.
public utilityController_mediaThumbnail_create ( $sender, $media_id )

validateUploadDestinationPath() 공개 메소드

Check if provided path is valid, creates it if it does not exist, and verifies that it is writable.
public validateUploadDestinationPath ( string $path )
$path string Path to validate

프로퍼티 상세

$AssetPath 보호되어 있는 프로퍼티

Asset path for this plugin, set in Gdn_Form_BeforeBodyBox_Handler.
protected $AssetPath

$ForceWysiwyg 공개적으로 프로퍼티

public int|mixed $ForceWysiwyg
리턴 integer | mixed

$Format 보호되어 있는 프로퍼티

Default format being used for current rendering. Can be one of the formats listed in $Formats.
protected $Format

$Formats 보호되어 있는 프로퍼티

List of possible formats the editor supports.
protected $Formats

$canUpload 보호되어 있는 프로퍼티

protected bool $canUpload
리턴 boolean

$editorBaseUploadDestinationDir 보호되어 있는 프로퍼티

protected string $editorBaseUploadDestinationDir
리턴 string

$editorFileInputName 보호되어 있는 프로퍼티

This is used as the input name for file uploads. It will be passed to JS as well. Note that it can be defined as an array, by adding square brackets, e.g., editorupload[], but that will make all the Vanilla upload classes incompatible because they are hardcoded to handle only single files at a time, not an array of files. Perhaps in future make core upload classes more flexible.
protected $editorFileInputName

$mediaCache 보호되어 있는 프로퍼티

This will cache the discussion media results for the page request. Populated from either the db or memcached.
protected $mediaCache

$mediaCacheExpire 보호되어 있는 프로퍼티

How long memcached holds data until it expires.
protected $mediaCacheExpire

$pluginInfo 보호되어 있는 프로퍼티

Give class access to PluginInfo
protected $pluginInfo