Skip to content

Commit

Permalink
Added onBeforeRender Trigger
Browse files Browse the repository at this point in the history
Added onAfterCacheRender Trigger
Added parse method to JDocument and JDocumentHTML
Moved all "system" triggers inside of JApplication/children

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@11435 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
  • Loading branch information
ircmaxell committed Jan 24, 2009
1 parent 5acb915 commit c563a64
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 81 deletions.
6 changes: 5 additions & 1 deletion administrator/includes/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function initialise($options = array())
*/
function route()
{

parent::route();
}

/**
Expand Down Expand Up @@ -138,6 +138,7 @@ function dispatch($component = NULL)

$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');
$this->triggerEvent('onAfterDispatch');
}

/**
Expand All @@ -162,8 +163,11 @@ function render()
);

$document =& JFactory::getDocument();
$document->prepare($params);
$this->triggerEvent('onBeforeRender');
$data = $document->render($this->getCfg('caching'), $params );
JResponse::setBody($data);
$this->triggerEvent('onAfterRender');
}

/**
Expand Down
19 changes: 4 additions & 15 deletions administrator/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,35 @@
$mainframe->initialise(array(
'language' => $mainframe->getUserState( "application.lang", 'lang' )
));

JPluginHelper::importPlugin('system');

// trigger the onAfterInitialise events
// Profiling
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
$mainframe->triggerEvent('onAfterInitialise');

/**
* ROUTE THE APPLICATION
*
* NOTE :
*/
$mainframe->route();

// trigger the onAfterRoute events
// Profiling
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
$mainframe->triggerEvent('onAfterRoute');

/**
* DISPATCH THE APPLICATION
*
* NOTE :
*/

$mainframe->dispatch();

// trigger the onAfterDispatch events
// Profiling
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
$mainframe->triggerEvent('onAfterDispatch');

/**
* RENDER THE APPLICATION
*
* NOTE :
*/
$mainframe->render();

// trigger the onAfterRender events
// Profiling
JDEBUG ? $_PROFILER->mark( 'afterRender' ) : null;
$mainframe->triggerEvent( 'onAfterRender' );

/**
* RETURN THE RESPONSE
Expand Down
20 changes: 18 additions & 2 deletions includes/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,19 @@ public function initialise( $options = array())
* @access public
*/
public function route() {
parent::route();
// get the full request URI
$uri = clone(JURI::getInstance());

$router =& $this->getRouter();
$result = $router->parse($uri);

JRequest::set($result, 'get', false );

// authorization
$Itemid = JRequest::getInt('Itemid');
$this->authorize($Itemid);

$this->triggerEvent('onAfterRoute');
}

/**
Expand Down Expand Up @@ -126,6 +138,7 @@ public function dispatch($component = null)

$contents = JComponentHelper::renderComponent($component);
$document->setBuffer( $contents, 'component');
$this->triggerEvent('onAfterDispatch');
}

/**
Expand Down Expand Up @@ -168,8 +181,11 @@ public function render()
} break;
}

$data = $document->render( $this->getCfg('caching'), $params);
$document->parse($params);
$this->triggerEvent('onBeforeRender');
$data = $document->render($this->getCfg('caching'), $params );
JResponse::setBody($data);
$this->triggerEvent('onAfterRender');
}

/**
Expand Down
25 changes: 4 additions & 21 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,60 +24,43 @@
*
* NOTE :
*/


$mainframe =& JFactory::getApplication('site');

/**
* INITIALISE THE APPLICATION
*
* NOTE :
*/
// set the language
$mainframe->initialise();

JPluginHelper::importPlugin('system');

// trigger the onAfterInitialise events
// profiling
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
$mainframe->triggerEvent('onAfterInitialise');

/**
* ROUTE THE APPLICATION
*
* NOTE :
*/
$mainframe->route();

// authorization
$Itemid = JRequest::getInt('Itemid');
$mainframe->authorize($Itemid);

// trigger the onAfterRoute events
// profiling
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
$mainframe->triggerEvent('onAfterRoute');

/**
* DISPATCH THE APPLICATION
*
* NOTE :
*/
$mainframe->dispatch();

// trigger the onAfterDispatch events
// Profiling
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
$mainframe->triggerEvent('onAfterDispatch');

/**
* RENDER THE APPLICATION
*
* NOTE :
*/
$mainframe->render();

// trigger the onAfterRender events
// Profiling
JDEBUG ? $_PROFILER->mark('afterRender') : null;
$mainframe->triggerEvent('onAfterRender');

/**
* RETURN THE RESPONSE
Expand Down
6 changes: 6 additions & 0 deletions installation/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ COMMITERS
Do not forget to update this page on the wiki when making changes relevant to developers:
http://docs.joomla.org/index.php?title=Version_1.6_Developer_Notes

24-Jan-2009 Anthony Ferrara
+ Added onBeforeRender Trigger
+ Added onAfterCacheRender Trigger
+ Added parse method to JDocument and JDocumentHTML
^ Moved all "system" triggers inside of JApplication/children

24-Jan-2009 Andrew Eddie
^ Move text files to /installation/ folder

Expand Down
10 changes: 10 additions & 0 deletions libraries/joomla/application/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ public function initialise($options = array())
$editor = $user->getParam('editor', $this->getCfg('editor'));
$editor = JPluginHelper::isEnabled('editors', $editor) ? $editor : $this->getCfg('editor');
$config->setValue('config.editor', $editor);

JPluginHelper::importPlugin('system');
$this->triggerEvent('onAfterInitialise');
}

/**
Expand All @@ -207,6 +210,8 @@ public function route()
$result = $router->parse($uri);

JRequest::set($result, 'get', false );

$this->triggerEvent('onAfterRoute');
}

/**
Expand All @@ -228,6 +233,8 @@ public function dispatch($component = null)

$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');

$this->triggerEvent('onAfterDispatch');
}

/**
Expand All @@ -249,8 +256,11 @@ public function render()
);

$document =& JFactory::getDocument();
$document->parse($params);
$this->triggerEvent('onBeforeRender');
$data = $document->render($this->getCfg('caching'), $params );
JResponse::setBody($data);
$this->triggerEvent('onAfterRender');
}

/**
Expand Down
10 changes: 10 additions & 0 deletions libraries/joomla/document/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,16 @@ public function &loadRenderer( $type )
return $instance;
}

/**
* Parses the document and prepares the buffers
*
* @access public
* @return null
*/
public function parse($params = array()) {
return null;
}

/**
* Outputs the document
*
Expand Down
Loading

0 comments on commit c563a64

Please sign in to comment.