remove example file with case sensitive filename issue
[civicrm-core.git] / CRM / Utils / Hook.php
index 6881d068ff7cf4039abc3d04f6c719c14f6406a7..6adb9d714d8332c0db963e67f779ff29fb48b881 100644 (file)
@@ -91,19 +91,13 @@ abstract class CRM_Utils_Hook {
     $fnSuffix
   );
 
-  /**
-   * Get a list of modules implementing the given hook.
-   * @return Array of module names.
-   */
-  abstract function moduleImplements($hookName);
-
   function commonInvoke($numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5,
     $fnSuffix, $fnPrefix
   ) {
 
     $this->commonBuildModuleList($fnPrefix);
-    
+
     return $this->runHooks($this->commonCiviModules, $fnSuffix,
       $numParams, $arg1, $arg2, $arg3, $arg4, $arg5
     );
@@ -132,66 +126,50 @@ abstract class CRM_Utils_Hook {
     }
   }
 
-  /**
-   * Get a list of modules implementing the given hook.
-   * @return Array of module names.
-   */
-  function commonModuleImplements($fnSuffix, $fnPrefix) {
-    $return = array();
-
-    $this->commonBuildModuleList($fnPrefix);
-
-    foreach ($this->commonCiviModules as $module) {
-      $fnName = "{$module}_{$fnSuffix}";
-      if (function_exists($fnName)) {
-        $return[] = $module;
-      }
-    }
-    return $return;
-  }
-
   function runHooks(&$civiModules, $fnSuffix, $numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5
   ) {
     $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);
+        }
       }
     }
 
@@ -901,7 +879,7 @@ abstract class CRM_Utils_Hook {
 
   /**
    * This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission()
-   * in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/.permissions.php).
+   * in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php).
    *
    * @param string $entity       the API entity (like contact)
    * @param string $action       the API action (like get)