PHP Class Xpressengine\Editor\AbstractEditor

Author: XE Developers ([email protected])
Inheritance: implements Xpressengine\Plugin\ComponentInterface, use trait Xpressengine\Plugin\ComponentTrait, use trait Xpressengine\Support\MobileSupportTrait
Show file Open project: xpressengine/xpressengine Class Usage Examples

Protected Properties

Property Type Description
$arguments array Given arguments for the editor
$config Xpressengine\Config\ConfigEntity | null ConfigEntity instance
$defaultArguments array Default editor arguments
$editors EditorHandler EditorHandler instance
$events Illuminate\Contracts\Events\Dispatcher Dispatcher instance
$fileClassName string The file class name
$fileIdentifierAttrName string The file identifier attribute name
$fileInputName string The file input name
$files array Used files
$frontend Xpressengine\Presenter\Html\FrontendHandler FrontendHandler instance
$gate Illuminate\Contracts\Auth\Access\Gate Gate instance
$imageClassName string The image class name
$imageIdentifierAttrName string The image identifier attribute name
$imageResolver callable The image resolver
$instanceId string Instance identifier
$mentionClassName string The mention class name
$mentionIdentifierAttrName string The mention identifier attribute name
$mentionInputName string The mention input name
$options null Options for the editor
$scriptOnly boolean Indicates if used only javascript.
$skins Xpressengine\Skin\SkinHandler SkinHandler instance
$tagClassName string The tag class name
$tagInputName string The tag input name
$tools AbstractTool[] The registered tools for the editor
$urls Illuminate\Contracts\Routing\UrlGenerator UrlGenerator instance

Public Methods

Method Description
__construct ( EditorHandler $editors, Illuminate\Contracts\Routing\UrlGenerator $urls, Illuminate\Contracts\Auth\Access\Gate $gate, Xpressengine\Skin\SkinHandler $skins, Illuminate\Contracts\Events\Dispatcher $events, FrontendHandler $frontend, string $instanceId ) AbstractEditor constructor.
compile ( string $content, boolean $htmlable = false ) : string Compile the raw content to be useful
getActivateToolIds ( ) : array Get activated tool's identifier for the editor
getArguments ( ) : array Get arguments for the editor
getConfig ( ) : null | ConfigEntity Get config for the editor
getCustomOptions ( ) : array Get options for some editor only
getFileClassName ( ) : string Get the file class name
getFileIdentifierAttrName ( ) : string Get the file identifier attribute name
getFileInputName ( ) : string Get the file input name
getImageClassName ( ) : string Get the image class name
getImageIdentifierAttrName ( ) : string Get the image identifier attribute name
getInstanceId ( ) : string Get instance id for the editor
getInstanceSettingURI ( string $instanceId ) : string | null Get uri for custom setting
getMentionClassName ( ) : string Get the mention class name
getMentionIdentifierAttrName ( ) : string Get the mention identifier attribute name
getMentionInputName ( ) : string Get the mention input name
getName ( ) : string Get a editor name
getOptions ( ) : array Get options
getTagClassName ( ) : string Get the tag class name
getTagInputName ( ) : string Get the tag input name
getTools ( ) : AbstractTool[] Get activated tools for the editor
htmlable ( ) : boolean Determine if a editor html usable.
render ( ) : string Get the evaluated contents of the object.
resolveImage ( array $ids = [] ) : array Resolve image instances
setArguments ( array $arguments = [] ) Set arguments for the editor
setConfig ( ConfigEntity $config ) Set config for the editor
setFiles ( array $files = [] ) : void Set files the editor used
setImageResolver ( callable $resolver ) : void Set the image resolver

Protected Methods

Method Description
buildOptions ( ) : array Build options
compileBody ( string $content ) : string Compile content body
getContentDomHtmlOption ( array $domOptions ) : string Get attributes string for content html tag
getContentHtml ( ) : string Get a content html tag string
getDynamicOption ( ) : array Get dynamic option data for the editor
getEditorScript ( array $options ) : mixed Get script for running the editor
getStaticOption ( ) : array Get static option data for the editor
hashTag ( string $content ) : string Compile tags in content body
image ( string $content ) : string Compile images in content body
link ( string $content ) : string Compile links in content body
loadTools ( ) : void Load tools
mention ( string $content ) : string Compile mentions in content body

Private Methods

Method Description
createCrawler ( string $content ) : Crawler Create crawler instance
getData ( string $content, string $selector, array $attributes = [] ) : array Get html node data

Method Details

__construct() public method

AbstractEditor constructor.
public __construct ( EditorHandler $editors, Illuminate\Contracts\Routing\UrlGenerator $urls, Illuminate\Contracts\Auth\Access\Gate $gate, Xpressengine\Skin\SkinHandler $skins, Illuminate\Contracts\Events\Dispatcher $events, FrontendHandler $frontend, string $instanceId )
$editors EditorHandler EditorHandler instance
$urls Illuminate\Contracts\Routing\UrlGenerator UrlGenerator instance
$gate Illuminate\Contracts\Auth\Access\Gate Gate instance
$skins Xpressengine\Skin\SkinHandler SkinHandler instance
$events Illuminate\Contracts\Events\Dispatcher Dispatcher instance
$frontend Xpressengine\Presenter\Html\FrontendHandler FrontendHandler instance
$instanceId string Instance identifier

buildOptions() protected method

Build options
protected buildOptions ( ) : array
return array

compile() public method

Compile the raw content to be useful
public compile ( string $content, boolean $htmlable = false ) : string
$content string content
$htmlable boolean content is htmlable
return string

compileBody() abstract protected method

Compile content body
abstract protected compileBody ( string $content ) : string
$content string content
return string

getActivateToolIds() public method

Get activated tool's identifier for the editor
public getActivateToolIds ( ) : array
return array

getArguments() public method

Get arguments for the editor
public getArguments ( ) : array
return array

getConfig() public method

Get config for the editor
public getConfig ( ) : null | ConfigEntity
return null | Xpressengine\Config\ConfigEntity

getContentDomHtmlOption() protected method

Get attributes string for content html tag
protected getContentDomHtmlOption ( array $domOptions ) : string
$domOptions array dom options
return string

getContentHtml() protected method

Get a content html tag string
protected getContentHtml ( ) : string
return string

getCustomOptions() public method

Get options for some editor only
public getCustomOptions ( ) : array
return array

getDynamicOption() protected method

Get dynamic option data for the editor
protected getDynamicOption ( ) : array
return array

getEditorScript() protected method

Get script for running the editor
protected getEditorScript ( array $options ) : mixed
$options array options
return mixed

getFileClassName() public method

Get the file class name
public getFileClassName ( ) : string
return string

getFileIdentifierAttrName() public method

Get the file identifier attribute name

getFileInputName() public method

Get the file input name
public getFileInputName ( ) : string
return string

getImageClassName() public method

Get the image class name
public getImageClassName ( ) : string
return string

getImageIdentifierAttrName() public method

Get the image identifier attribute name

getInstanceId() public method

Get instance id for the editor
public getInstanceId ( ) : string
return string

getInstanceSettingURI() public static method

Get uri for custom setting
public static getInstanceSettingURI ( string $instanceId ) : string | null
$instanceId string instance identifier
return string | null

getMentionClassName() public method

Get the mention class name
public getMentionClassName ( ) : string
return string

getMentionIdentifierAttrName() public method

Get the mention identifier attribute name

getMentionInputName() public method

Get the mention input name
public getMentionInputName ( ) : string
return string

getName() abstract public method

Get a editor name
abstract public getName ( ) : string
return string

getOptions() public method

Get options
public getOptions ( ) : array
return array

getStaticOption() protected method

Get static option data for the editor
protected getStaticOption ( ) : array
return array

getTagClassName() public method

Get the tag class name
public getTagClassName ( ) : string
return string

getTagInputName() public method

Get the tag input name
public getTagInputName ( ) : string
return string

getTools() public method

Get activated tools for the editor
public getTools ( ) : AbstractTool[]
return AbstractTool[]

hashTag() protected method

Compile tags in content body
protected hashTag ( string $content ) : string
$content string content
return string

htmlable() abstract public method

Determine if a editor html usable.
abstract public htmlable ( ) : boolean
return boolean

image() protected method

Compile images in content body
protected image ( string $content ) : string
$content string content
return string

loadTools() protected method

Load tools
protected loadTools ( ) : void
return void

mention() protected method

Compile mentions in content body
protected mention ( string $content ) : string
$content string content
return string

render() public method

Get the evaluated contents of the object.
public render ( ) : string
return string

resolveImage() public static method

Resolve image instances
public static resolveImage ( array $ids = [] ) : array
$ids array identifier list
return array

setArguments() public method

Set arguments for the editor
public setArguments ( array $arguments = [] )
$arguments array arguments

setConfig() public method

Set config for the editor
public setConfig ( ConfigEntity $config )
$config Xpressengine\Config\ConfigEntity config instance

setFiles() public method

Set files the editor used
public setFiles ( array $files = [] ) : void
$files array file instances
return void

setImageResolver() public static method

Set the image resolver
public static setImageResolver ( callable $resolver ) : void
$resolver callable resolver
return void

Property Details

$arguments protected property

Given arguments for the editor
protected array $arguments
return array

$config protected property

ConfigEntity instance
protected ConfigEntity,Xpressengine\Config|null $config
return Xpressengine\Config\ConfigEntity | null

$defaultArguments protected property

Default editor arguments
protected array $defaultArguments
return array

$editors protected property

EditorHandler instance
protected EditorHandler,Xpressengine\Editor $editors
return EditorHandler

$events protected property

Dispatcher instance
protected Dispatcher,Illuminate\Contracts\Events $events
return Illuminate\Contracts\Events\Dispatcher

$fileClassName protected property

The file class name
protected string $fileClassName
return string

$fileIdentifierAttrName protected property

The file identifier attribute name
protected string $fileIdentifierAttrName
return string

$fileInputName protected property

The file input name
protected string $fileInputName
return string

$files protected property

Used files
protected array $files
return array

$frontend protected property

FrontendHandler instance
protected FrontendHandler,Xpressengine\Presenter\Html $frontend
return Xpressengine\Presenter\Html\FrontendHandler

$gate protected property

Gate instance
protected Gate,Illuminate\Contracts\Auth\Access $gate
return Illuminate\Contracts\Auth\Access\Gate

$imageClassName protected property

The image class name
protected string $imageClassName
return string

$imageIdentifierAttrName protected property

The image identifier attribute name
protected string $imageIdentifierAttrName
return string

$imageResolver protected static property

The image resolver
protected static callable $imageResolver
return callable

$instanceId protected property

Instance identifier
protected string $instanceId
return string

$mentionClassName protected property

The mention class name
protected string $mentionClassName
return string

$mentionIdentifierAttrName protected property

The mention identifier attribute name
protected string $mentionIdentifierAttrName
return string

$mentionInputName protected property

The mention input name
protected string $mentionInputName
return string

$options protected property

Options for the editor
protected null $options
return null

$scriptOnly protected property

Indicates if used only javascript.
protected bool $scriptOnly
return boolean

$skins protected property

SkinHandler instance
protected SkinHandler,Xpressengine\Skin $skins
return Xpressengine\Skin\SkinHandler

$tagClassName protected property

The tag class name
protected string $tagClassName
return string

$tagInputName protected property

The tag input name
protected string $tagInputName
return string

$tools protected property

The registered tools for the editor
protected AbstractTool[],Xpressengine\Editor $tools
return AbstractTool[]

$urls protected property

UrlGenerator instance
protected UrlGenerator,Illuminate\Contracts\Routing $urls
return Illuminate\Contracts\Routing\UrlGenerator