From 7d875bd64704586a7aed8c22bfd6ed016873ba3a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 27 Apr 2013 09:06:41 -0700 Subject: [PATCH] CRM_Utils_Hook_Joomla - Formatting --- CRM/Utils/Hook/Joomla.php | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/CRM/Utils/Hook/Joomla.php b/CRM/Utils/Hook/Joomla.php index 043e00a315..17b2fa7df3 100644 --- a/CRM/Utils/Hook/Joomla.php +++ b/CRM/Utils/Hook/Joomla.php @@ -35,24 +35,24 @@ */ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook { function invoke($numParams, - &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, - $fnSuffix + &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, + $fnSuffix ) { // ensure that we are running in a joomla context // we've not yet figured out how to bootstrap joomla, so we should // 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' ); + if (PHP_SAPI != 'cli') { + $app = JFactory::getApplication('administrator'); } else { // condition on Joomla version - if( version_compare(JVERSION, '3.0', 'lt') ) { + if (version_compare(JVERSION, '3.0', 'lt')) { $app = JCli::getInstance(); } else { @@ -62,16 +62,19 @@ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook { $result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5)); - $moduleResult = $this->commonInvoke( $numParams, - $arg1, $arg2, $arg3, $arg4, $arg5, - $fnSuffix, 'joomla' ); - if ( ! empty( $moduleResult ) && is_array( $moduleResult ) ) { - if ( empty( $result ) ) { - $result = $moduleResult; - } else if ( is_array( $moduleResult ) ) { - $result = array_merge( $result, $moduleResult ); - } - } + $moduleResult = $this->commonInvoke($numParams, + $arg1, $arg2, $arg3, $arg4, $arg5, + $fnSuffix, 'joomla'); + if (!empty($moduleResult) && is_array($moduleResult)) { + if (empty($result)) { + $result = $moduleResult; + } + else { + if (is_array($moduleResult)) { + $result = array_merge($result, $moduleResult); + } + } + } if (!empty($result)) { // collapse result returned from hooks -- 2.25.1