remove tabs (whitespace only)
[civicrm-core.git] / CRM / Utils / Hook.php
index 044fb0fd16aa7d032287513a1731d6495102c7d7..8b780590112d3c31df6f14b6449134ac1418baa7 100644 (file)
@@ -97,7 +97,7 @@ abstract class CRM_Utils_Hook {
   ) {
 
     $this->commonBuildModuleList($fnPrefix);
-    
+
     return $this->runHooks($this->commonCiviModules, $fnSuffix,
       $numParams, $arg1, $arg2, $arg3, $arg4, $arg5
     );
@@ -131,43 +131,45 @@ abstract class CRM_Utils_Hook {
   ) {
     $result = $fResult = array();
 
-    foreach ($civiModules as $module) {
-      $fnName = "{$module}_{$fnSuffix}";
-      if (function_exists($fnName)) {
-        switch ($numParams) {
-          case 0:
-            $fResult = $fnName();
-            break;
-
-          case 1:
-            $fResult = $fnName($arg1);
-            break;
-
-          case 2:
-            $fResult = $fnName($arg1, $arg2);
-            break;
-
-          case 3:
-            $fResult = $fnName($arg1, $arg2, $arg3);
-            break;
-
-          case 4:
-            $fResult = $fnName($arg1, $arg2, $arg3, $arg4);
-            break;
-
-          case 5:
-            $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5);
-            break;
-
-          default:
-            CRM_Core_Error::fatal(ts('Invalid hook invocation'));
-            break;
+    if ($civiModules !== NULL) {
+      foreach ($civiModules as $module) {
+        $fnName = "{$module}_{$fnSuffix}";
+        if (function_exists($fnName)) {
+          switch ($numParams) {
+            case 0:
+              $fResult = $fnName();
+              break;
+
+            case 1:
+              $fResult = $fnName($arg1);
+              break;
+
+            case 2:
+              $fResult = $fnName($arg1, $arg2);
+              break;
+
+            case 3:
+              $fResult = $fnName($arg1, $arg2, $arg3);
+              break;
+
+            case 4:
+              $fResult = $fnName($arg1, $arg2, $arg3, $arg4);
+              break;
+
+            case 5:
+              $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5);
+              break;
+
+            default:
+              CRM_Core_Error::fatal(ts('Invalid hook invocation'));
+              break;
+          }
         }
-      }
 
-      if (!empty($fResult) &&
+        if (!empty($fResult) &&
           is_array($fResult)) {
-        $result = array_merge($result, $fResult);
+          $result = array_merge($result, $fResult);
+        }
       }
     }
 
@@ -179,8 +181,8 @@ abstract class CRM_Utils_Hook {
     foreach ($civiModules as $civiModule) {
       if (!file_exists($civiModule['filePath'])) {
         CRM_Core_Session::setStatus(
-               ts( 'Error loading module file (%1). Please restore the file or disable the module.', array(1 => $civiModule['filePath']) ),
-               ts( 'Warning'), 'error');
+          ts( 'Error loading module file (%1). Please restore the file or disable the module.', array(1 => $civiModule['filePath']) ),
+          ts( 'Warning'), 'error');
         continue;
       }
       include_once $civiModule['filePath'];