// not execute hooks if joomla is not loaded
if (defined('_JEXEC')) {
//Invoke the Joomla plugin system to observe to civicrm events.
- jimport( 'joomla.plugin.helper' );
+ jimport( 'joomla.plugin.helper' );
JPluginHelper::importPlugin('civicrm');
- // get app based on cli or web
- if ( PHP_SAPI != 'cli' ) {
- $app = JFactory::getApplication( 'administrator' );
- } else {
- $app = JCli::getInstance();
+ // get app based on cli or web
+ if ( PHP_SAPI != 'cli' ) {
+ $app = JFactory::getApplication( 'administrator' );
+ }
+ else {
+ // condition on Joomla version
+ if( version_compare(JVERSION, '3.0', 'lt') ) {
+ $app = JCli::getInstance();
+ }
+ else {
+ $app = JApplicationCli::getInstance();
+ }
}
$result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5));
// Get the framework.
require $joomlaBase . '/libraries/import.php';
require $joomlaBase . '/libraries/joomla/event/dispatcher.php';
- require $joomlaBase . '/libraries/joomla/environment/uri.php';
- require $joomlaBase . '/libraries/joomla/application/component/helper.php';
require $joomlaBase . '/configuration.php';
+ // Files may be in different places depending on Joomla version
+ if ( !defined('JVERSION') ) {
+ require $joomlaBase . '/libraries/cms/version/version.php';
+ $jversion = new JVersion;
+ define('JVERSION', $jversion->getShortVersion());
+ }
+
+ if( version_compare(JVERSION, '3.0', 'lt') ) {
+ require $joomlaBase . '/libraries/joomla/environment/uri.php';
+ require $joomlaBase . '/libraries/joomla/application/component/helper.php';
+ }
+ else {
+ require $joomlaBase . '/libraries/joomla/uri/uri.php';
+ require $joomlaBase . '/libraries/legacy/component/helper.php';
+ }
+
jimport('joomla.application.cli');
return TRUE;