Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe JavascriptRenderer
+ Graphe d'héritage de JavascriptRenderer:

Fonctions membres publiques

 __construct (DebugBar $debugBar, $baseUrl=null, $basePath=null)
 
 setOptions (array $options)
 
 setBasePath ($path)
 
 getBasePath ()
 
 setBaseUrl ($url)
 
 getBaseUrl ()
 
 setIncludeVendors ($enabled=true)
 
 areVendorsIncluded ()
 
 disableVendor ($name)
 
 setJavascriptClass ($className)
 
 getJavascriptClass ()
 
 setVariableName ($name)
 
 getVariableName ()
 
 setInitialization ($init)
 
 getInitialization ()
 
 setEnableJqueryNoConflict ($enabled=true)
 
 isJqueryNoConflictEnabled ()
 
 setUseRequireJs ($enabled=true)
 
 isRequireJsUsed ()
 
 addControl ($name, array $options)
 
 disableControl ($name)
 
 getControls ()
 
 ignoreCollector ($name)
 
 getIgnoredCollectors ()
 
 setAjaxHandlerClass ($className)
 
 getAjaxHandlerClass ()
 
 setBindAjaxHandlerToFetch ($bind=true)
 
 isAjaxHandlerBoundToFetch ()
 
 setBindAjaxHandlerToJquery ($bind=true)
 
 isAjaxHandlerBoundToJquery ()
 
 setBindAjaxHandlerToXHR ($bind=true)
 
 isAjaxHandlerBoundToXHR ()
 
 setAjaxHandlerAutoShow ($autoShow=true)
 
 isAjaxHandlerAutoShow ()
 
 setOpenHandlerClass ($className)
 
 getOpenHandlerClass ()
 
 setOpenHandlerUrl ($url)
 
 getOpenHandlerUrl ()
 
 setCspNonce ($nonce=null)
 
 getCspNonce ()
 
 addAssets ($cssFiles, $jsFiles, $basePath=null, $baseUrl=null)
 
 addInlineAssets ($inlineCss, $inlineJs, $inlineHead)
 
 getAssets ($type=null, $relativeTo=self::RELATIVE_PATH)
 
 getAsseticCollection ($type=null)
 
 dumpCssAssets ($targetFilename=null)
 
 dumpJsAssets ($targetFilename=null)
 
 dumpHeadAssets ($targetFilename=null)
 
 renderHead ()
 
 renderOnShutdown ($here=true, $initialize=true, $renderStackedData=true, $head=false)
 
 renderOnShutdownWithHead ($here=true, $initialize=true, $renderStackedData=true)
 
 replaceTagInBuffer ($here=true, $initialize=true, $renderStackedData=true, $head=false)
 
 render ($initialize=true, $renderStackedData=true)
 

Champs de données

const INITIALIZE_CONSTRUCTOR = 2
 
const INITIALIZE_CONTROLS = 4
 
const REPLACEABLE_TAG = "{--DEBUGBAR_OB_START_REPLACE_ME--}"
 
const RELATIVE_PATH = 'path'
 
const RELATIVE_URL = 'url'
 

Fonctions membres protégées

 getRelativeRoot ($relativeTo, $basePath, $baseUrl)
 
 makeUriRelativeTo ($uri, $root)
 
 filterAssetArray ($array, $type='')
 
 createAsseticCollection ($files=null, $content=null)
 
 dumpAssets ($files=null, $content=null, $targetFilename=null, $useRequireJs=false)
 
 getJsInitializationCode ()
 
 getJsControlsDefinitionCode ($varname)
 
 getAddDatasetCode ($requestId, $data, $suffix=null)
 
 getNonceAttribute ()
 

Attributs protégés

 $debugBar
 
 $baseUrl
 
 $basePath
 
 $cssVendors
 
 $jsVendors
 
 $includeVendors = true
 
 $cssFiles = array('debugbar.css', 'widgets.css', 'openhandler.css')
 
 $jsFiles = array('debugbar.js', 'widgets.js', 'openhandler.js')
 
 $additionalAssets = array()
 
 $javascriptClass = 'PhpDebugBar.DebugBar'
 
 $variableName = 'phpdebugbar'
 
 $enableJqueryNoConflict = true
 
 $useRequireJs = false
 
 $initialization
 
 $controls = array()
 
 $ignoredCollectors = array()
 
 $ajaxHandlerClass = 'PhpDebugBar.AjaxHandler'
 
 $ajaxHandlerBindToFetch = false
 
 $ajaxHandlerBindToJquery = true
 
 $ajaxHandlerBindToXHR = false
 
 $ajaxHandlerAutoShow = true
 
 $openHandlerClass = 'PhpDebugBar.OpenHandler'
 
 $openHandlerUrl
 
 $cspNonce
 

Description détaillée

Renders the debug bar using the client side javascript implementation

Generates all the needed initialization code of controls

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( DebugBar  $debugBar,
  $baseUrl = null,
  $basePath = null 
)
Paramètres
\DebugBar\DebugBar$debugBar
string$baseUrl
string$basePath

Références $basePath, __DIR__, baseUrl, et null.

Documentation des fonctions membres

◆ addAssets()

addAssets (   $cssFiles,
  $jsFiles,
  $basePath = null,
  $baseUrl = null 
)

Add assets stored in files to render in the head

Paramètres
array$cssFilesAn array of filenames
array$jsFilesAn array of filenames
string$basePathBase path of those files
string$baseUrlBase url of those files
Renvoie
$this

Références $basePath, et $this.

◆ addControl()

addControl (   $name,
array  $options 
)

Adds a control to initialize

Possible options:

  • icon: icon name
  • tooltip: string
  • widget: widget class name
  • title: tab title
  • map: a property name from the data to map the control to
  • default: a js string, default value of the data map

"icon" or "widget" are at least needed

Paramètres
string$name
array$options

Références $name, $options, et $this.

◆ addInlineAssets()

addInlineAssets (   $inlineCss,
  $inlineJs,
  $inlineHead 
)

Add inline assets to render inline in the head. Ideally, you should store static assets in files that you add with the addAssets function. However, adding inline assets is useful when integrating with 3rd-party libraries that require static assets that are only available in an inline format.

The inline content arrays require special string array keys: they are used to deduplicate content. This is particularly useful if multiple instances of the same asset end up being added. Inline assets from all collectors are merged together into the same array, so these content IDs effectively deduplicate the inline assets.

Paramètres
array$inlineCssAn array map of content ID to inline CSS content (not including <style> tag)
array$inlineJsAn array map of content ID to inline JS content (not including <script> tag)
array$inlineHeadAn array map of content ID to arbitrary inline HTML content (typically <style>/<script> tags); it must be embedded within the <head> element
Renvoie
$this

Références $this.

◆ areVendorsIncluded()

areVendorsIncluded ( )

Checks if vendors assets are included

Renvoie
boolean

◆ createAsseticCollection()

createAsseticCollection (   $files = null,
  $content = null 
)
protected

Create an Assetic AssetCollection with the given content. Filenames will be converted to absolute path using the base path.

Paramètres
array | null$filesArray of asset filenames.
array | null$contentArray of inline asset content.
Renvoie

Références $content, et $item.

◆ disableControl()

disableControl (   $name)

Disables a control

Paramètres
string$name

Références $name, $this, et null.

◆ disableVendor()

disableVendor (   $name)

Disable a specific vendor's assets.

Paramètres
string$name"jquery", "fontawesome", "highlightjs"
Renvoie
void

Références $name.

◆ dumpAssets()

dumpAssets (   $files = null,
  $content = null,
  $targetFilename = null,
  $useRequireJs = false 
)
protected

Write assets to standard output or in a file

Paramètres
array | null$filesFilenames containing assets
array | null$contentInline content to dump
string$targetFilename
bool$useRequireJs

Références $content, $item, et null.

◆ dumpCssAssets()

dumpCssAssets (   $targetFilename = null)

Write all CSS assets to standard output or in a file

Paramètres
string$targetFilename

◆ dumpHeadAssets()

dumpHeadAssets (   $targetFilename = null)

Write all inline HTML header assets to standard output or in a file (only returns assets not already returned by dumpCssAssets or dumpJsAssets)

Paramètres
string$targetFilename

Références null.

◆ dumpJsAssets()

dumpJsAssets (   $targetFilename = null)

Write all JS assets to standard output or in a file

Paramètres
string$targetFilename

◆ filterAssetArray()

filterAssetArray (   $array,
  $type = '' 
)
protected

Filters a tuple of (css, js, inline_css, inline_js, inline_head) assets according to $type

Paramètres
array$array
string$type'css', 'js', 'inline_css', 'inline_js', 'inline_head', or null for all
Renvoie
array

Références $type.

◆ getAddDatasetCode()

getAddDatasetCode (   $requestId,
  $data,
  $suffix = null 
)
protected

Returns the js code needed to add a dataset

Paramètres
string$requestId
array$data
mixed$suffix
Renvoie
string

Références $data, et $suffix.

◆ getAjaxHandlerClass()

getAjaxHandlerClass ( )

Returns the class name of the ajax handler

Renvoie
string

◆ getAsseticCollection()

getAsseticCollection (   $type = null)

Returns an array where all items are Assetic AssetCollection:

  • The first one contains the CSS files
  • The second one contains the JS files
  • The third one contains arbitrary inline HTML (typically composed of <script>/<style> elements); it must be embedded within the <head> element
Paramètres
string$typeOptionally return only 'css', 'js', or 'inline_head' collection
Renvoie
array|

Références $type, et null.

◆ getAssets()

getAssets (   $type = null,
  $relativeTo = self::RELATIVE_PATH 
)

Returns the list of asset files

Paramètres
string$type'css', 'js', 'inline_css', 'inline_js', 'inline_head', or null for all
string$relativeToThe type of path to which filenames must be relative (path, url or null)
Renvoie
array

Références $basePath, $root, $type, et baseUrl.

◆ getBasePath()

getBasePath ( )

Returns the path which assets are relative to

Renvoie
string

Références $basePath.

◆ getBaseUrl()

getBaseUrl ( )

Returns the base URL from which assets will be served

Renvoie
string

◆ getControls()

getControls ( )

Returns the list of controls

This does not include controls provided by collectors

Renvoie
array

◆ getCspNonce()

getCspNonce ( )

Get the CSP Nonce

Renvoie
string|null

◆ getIgnoredCollectors()

getIgnoredCollectors ( )

Returns the list of ignored collectors

Renvoie
array

◆ getInitialization()

getInitialization ( )

Returns what should be initialized

Renvoie
integer

◆ getJavascriptClass()

getJavascriptClass ( )

Returns the javascript class name

Renvoie
string

◆ getJsControlsDefinitionCode()

getJsControlsDefinitionCode (   $varname)
protected

Returns the js code needed to initialized the controls and data mapping of the debug bar

Controls can be defined by collectors themselves or using {

Voir également
addControl()}
Paramètres
string$varnameDebug bar's variable name
Renvoie
string

Références $name, $options, $opts, et elseif.

◆ getJsInitializationCode()

getJsInitializationCode ( )
protected

Returns the js code needed to initialize the debug bar

Renvoie
string

Références elseif, et null.

◆ getNonceAttribute()

getNonceAttribute ( )
protected

If a nonce it set, create the correct attribute

Renvoie
string

◆ getOpenHandlerClass()

getOpenHandlerClass ( )

Returns the class name of the js open handler

Renvoie
string

◆ getOpenHandlerUrl()

getOpenHandlerUrl ( )

Returns the url for the open handler

Renvoie
string

◆ getRelativeRoot()

getRelativeRoot (   $relativeTo,
  $basePath,
  $baseUrl 
)
protected

Returns the correct base according to the type

Paramètres
string$relativeTo
string$basePath
string$baseUrl
Renvoie
string

Références $basePath, et null.

◆ getVariableName()

getVariableName ( )

Returns the variable name of the class instance

Renvoie
string

◆ ignoreCollector()

ignoreCollector (   $name)

Ignores widgets provided by a collector

Paramètres
string$name

Références $name, et $this.

◆ isAjaxHandlerAutoShow()

isAjaxHandlerAutoShow ( )

Checks whether the ajax handler will immediately show new ajax requests.

Renvoie
boolean

◆ isAjaxHandlerBoundToFetch()

isAjaxHandlerBoundToFetch ( )

Checks whether bindToFetch() will be called on the ajax handler

Renvoie
boolean

◆ isAjaxHandlerBoundToJquery()

isAjaxHandlerBoundToJquery ( )

Checks whether bindToJquery() will be called on the ajax handler

Renvoie
boolean

◆ isAjaxHandlerBoundToXHR()

isAjaxHandlerBoundToXHR ( )

Checks whether bindToXHR() will be called on the ajax handler

Renvoie
boolean

◆ isJqueryNoConflictEnabled()

isJqueryNoConflictEnabled ( )

Checks if jQuery.noConflict() will be called

Renvoie
boolean

◆ isRequireJsUsed()

isRequireJsUsed ( )

Checks if RequireJS is used

Renvoie
boolean

◆ makeUriRelativeTo()

makeUriRelativeTo (   $uri,
  $root 
)
protected

Makes a URI relative to another

Paramètres
string | array$uri
string$root
Renvoie
string

Références $root, et $uri.

◆ render()

render (   $initialize = true,
  $renderStackedData = true 
)

Returns the code needed to display the debug bar

AJAX request should not render the initialization code.

Paramètres
boolean$initializeWhether or not to render the debug bar initialization code
boolean$renderStackedDataWhether or not to render the stacked data
Renvoie
string

Références $data, $id, $suffix, et null.

◆ renderHead()

renderHead ( )

Renders the html to include needed assets

Only useful if Assetic is not used

Renvoie
string

Références $content, $html, et null.

◆ renderOnShutdown()

renderOnShutdown (   $here = true,
  $initialize = true,
  $renderStackedData = true,
  $head = false 
)

Register shutdown to display the debug bar

Paramètres
boolean$hereSet position of HTML. True if is to current position or false for end file
boolean$initializeWhether to render the de bug bar initialization code
bool$renderStackedData
bool$head
Renvoie
string Return "{--DEBUGBAR_OB_START_REPLACE_ME--}" or return an empty string if $here == false

Références $this.

◆ renderOnShutdownWithHead()

renderOnShutdownWithHead (   $here = true,
  $initialize = true,
  $renderStackedData = true 
)

Same as renderOnShutdown() with $head = true

Paramètres
boolean$here
boolean$initialize
boolean$renderStackedData
Renvoie
string

◆ replaceTagInBuffer()

replaceTagInBuffer (   $here = true,
  $initialize = true,
  $renderStackedData = true,
  $head = false 
)

Is callback function for register_shutdown_function(...)

Paramètres
boolean$hereSet position of HTML. True if is to current position or false for end file
boolean$initializeWhether to render the de bug bar initialization code
bool$renderStackedData
bool$head

Références $count.

◆ setAjaxHandlerAutoShow()

setAjaxHandlerAutoShow (   $autoShow = true)

Sets whether new ajax debug data will be immediately shown. Setting to false could be useful if there are a lot of tracking events cluttering things.

Paramètres
boolean$autoShow

Références $this.

◆ setAjaxHandlerClass()

setAjaxHandlerClass (   $className)

Sets the class name of the ajax handler

Set to false to disable

Paramètres
string$className

Références $className, et $this.

◆ setBasePath()

setBasePath (   $path)

Sets the path which assets are relative to

Paramètres
string$path

Références $path, et $this.

◆ setBaseUrl()

setBaseUrl (   $url)

Sets the base URL from which assets will be served

Paramètres
string$url

Références $this, $url, et baseUrl.

◆ setBindAjaxHandlerToFetch()

setBindAjaxHandlerToFetch (   $bind = true)

Sets whether to call bindToFetch() on the ajax handler

Paramètres
boolean$bind

Références $this.

◆ setBindAjaxHandlerToJquery()

setBindAjaxHandlerToJquery (   $bind = true)

Sets whether to call bindToJquery() on the ajax handler

Paramètres
boolean$bind

Références $this.

◆ setBindAjaxHandlerToXHR()

setBindAjaxHandlerToXHR (   $bind = true)

Sets whether to call bindToXHR() on the ajax handler

Paramètres
boolean$bind

Références $this.

◆ setCspNonce()

setCspNonce (   $nonce = null)

Sets the CSP Nonce (or remove it by setting to null)

Paramètres
string | null$nonce
Renvoie
$this

Références $this.

◆ setEnableJqueryNoConflict()

setEnableJqueryNoConflict (   $enabled = true)

Sets whether to call jQuery.noConflict()

Paramètres
boolean$enabled

Références $enabled, et $this.

◆ setIncludeVendors()

setIncludeVendors (   $enabled = true)

Whether to include vendor assets

You can only include js or css vendors using setIncludeVendors('css') or setIncludeVendors('js')

Paramètres
boolean$enabled

Références $enabled, et $this.

◆ setInitialization()

setInitialization (   $init)

Sets what should be initialized

  • INITIALIZE_CONSTRUCTOR: only initializes the instance
  • INITIALIZE_CONTROLS: initializes the controls and data mapping
  • INITIALIZE_CONSTRUCTOR | INITIALIZE_CONTROLS: initialize everything (default)
Paramètres
integer$init

Références $this.

◆ setJavascriptClass()

setJavascriptClass (   $className)

Sets the javascript class name

Paramètres
string$className

Références $className, et $this.

◆ setOpenHandlerClass()

setOpenHandlerClass (   $className)

Sets the class name of the js open handler

Paramètres
string$className

Références $className, et $this.

◆ setOpenHandlerUrl()

setOpenHandlerUrl (   $url)

Sets the url of the open handler

Paramètres
string$url

Références $this, et $url.

◆ setOptions()

setOptions ( array  $options)

Sets options from an array

Options:

  • base_path
  • base_url
  • include_vendors
  • javascript_class
  • variable_name
  • initialization
  • enable_jquery_noconflict
  • controls
  • disable_controls
  • ignore_collectors
  • ajax_handler_classname
  • ajax_handler_bind_to_jquery
  • ajax_handler_auto_show
  • open_handler_classname
  • open_handler_url
Paramètres
array$options[description]

Références $control, $name, et $options.

◆ setUseRequireJs()

setUseRequireJs (   $enabled = true)

Sets whether to use RequireJS or not

Paramètres
boolean$enabled
Renvoie
$this

Références $enabled, et $this.

◆ setVariableName()

setVariableName (   $name)

Sets the variable name of the class instance

Paramètres
string$name

Références $name, et $this.

Documentation des champs

◆ $additionalAssets

$additionalAssets = array()
protected

◆ $ajaxHandlerAutoShow

$ajaxHandlerAutoShow = true
protected

◆ $ajaxHandlerBindToFetch

$ajaxHandlerBindToFetch = false
protected

◆ $ajaxHandlerBindToJquery

$ajaxHandlerBindToJquery = true
protected

◆ $ajaxHandlerBindToXHR

$ajaxHandlerBindToXHR = false
protected

◆ $ajaxHandlerClass

$ajaxHandlerClass = 'PhpDebugBar.AjaxHandler'
protected

◆ $basePath

$basePath
protected

◆ $baseUrl

$baseUrl
protected

◆ $controls

$controls = array()
protected

◆ $cspNonce

$cspNonce
protected

◆ $cssFiles

$cssFiles = array('debugbar.css', 'widgets.css', 'openhandler.css')
protected

◆ $cssVendors

$cssVendors
protected
Valeur initiale :
= array(
'fontawesome' => 'vendor/font-awesome/css/font-awesome.min.css',
'highlightjs' => 'vendor/highlightjs/styles/github.css'
)

◆ $debugBar

$debugBar
protected

◆ $enableJqueryNoConflict

$enableJqueryNoConflict = true
protected

◆ $ignoredCollectors

$ignoredCollectors = array()
protected

◆ $includeVendors

$includeVendors = true
protected

◆ $initialization

$initialization
protected

◆ $javascriptClass

$javascriptClass = 'PhpDebugBar.DebugBar'
protected

◆ $jsFiles

$jsFiles = array('debugbar.js', 'widgets.js', 'openhandler.js')
protected

◆ $jsVendors

$jsVendors
protected
Valeur initiale :
= array(
'jquery' => 'vendor/jquery/dist/jquery.min.js',
'highlightjs' => 'vendor/highlightjs/highlight.pack.js'
)

◆ $openHandlerClass

$openHandlerClass = 'PhpDebugBar.OpenHandler'
protected

◆ $openHandlerUrl

$openHandlerUrl
protected

◆ $useRequireJs

$useRequireJs = false
protected

◆ $variableName

$variableName = 'phpdebugbar'
protected

◆ INITIALIZE_CONSTRUCTOR

const INITIALIZE_CONSTRUCTOR = 2

◆ INITIALIZE_CONTROLS

const INITIALIZE_CONTROLS = 4

◆ RELATIVE_PATH

const RELATIVE_PATH = 'path'

◆ RELATIVE_URL

const RELATIVE_URL = 'url'

◆ REPLACEABLE_TAG

const REPLACEABLE_TAG = "{--DEBUGBAR_OB_START_REPLACE_ME--}"

La documentation de cette classe a été générée à partir du fichier suivant :