forked from GNUsocial/gnu-social
Add 4 new events: StartCssLinkElement, EndCssLinkElement, StartScriptElement, EndScriptElement
This commit is contained in:
parent
c89b10ffe4
commit
40afc7e987
21
EVENTS.txt
21
EVENTS.txt
@ -574,3 +574,24 @@ EndShortenUrl: After a URL has been shortened
|
||||
- $shortenerName: name of the requested shortener
|
||||
- $shortenedUrl: short version of the url
|
||||
|
||||
StartCssLinkElement: Before a <link rel="stylesheet"..> element is written
|
||||
- $action
|
||||
- &$src
|
||||
- &$theme
|
||||
- &$media
|
||||
|
||||
EndCssLinkElement: After a <link rel="stylesheet"..> element is written
|
||||
- $action
|
||||
- $src
|
||||
- $theme
|
||||
- $media
|
||||
|
||||
StartScriptElement: Before a <script...> element is written
|
||||
- $action
|
||||
- &$src
|
||||
- &$type
|
||||
|
||||
EndScriptElement: After a <script...> element is written
|
||||
- $action
|
||||
- $src
|
||||
- $type
|
||||
|
@ -350,6 +350,7 @@ class HTMLOutputter extends XMLOutputter
|
||||
*/
|
||||
function script($src, $type='text/javascript')
|
||||
{
|
||||
if(Event::handle('StartScriptElement', array($this,&$src,&$type))) {
|
||||
$url = parse_url($src);
|
||||
if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
|
||||
{
|
||||
@ -358,6 +359,8 @@ class HTMLOutputter extends XMLOutputter
|
||||
$this->element('script', array('type' => $type,
|
||||
'src' => $src),
|
||||
' ');
|
||||
Event::handle('EndScriptElement', array($this,$src,$type));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -371,6 +374,7 @@ class HTMLOutputter extends XMLOutputter
|
||||
*/
|
||||
function cssLink($src,$theme=null,$media=null)
|
||||
{
|
||||
if(Event::handle('StartCssLinkElement', array($this,&$src,&$theme,&$media))) {
|
||||
$url = parse_url($src);
|
||||
if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
|
||||
{
|
||||
@ -384,6 +388,8 @@ class HTMLOutputter extends XMLOutputter
|
||||
'type' => 'text/css',
|
||||
'href' => $src,
|
||||
'media' => $media));
|
||||
Event::handle('EndCssLinkElement', array($this,$src,$theme,$media));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user