CRM_Utils_Hook_Joomla - Formatting
authorTim Otten <totten@civicrm.org>
Sat, 27 Apr 2013 16:06:41 +0000 (09:06 -0700)
committerTim Otten <totten@civicrm.org>
Sat, 27 Apr 2013 16:06:41 +0000 (09:06 -0700)
CRM/Utils/Hook/Joomla.php

index 043e00a315ee2cbd037eef520c057f3569f315bb..17b2fa7df3e65e09571a35f40198c504d4124006 100644 (file)
  */
 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