You are here

function coder_review_reviews in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/coder_review.module \coder_review_reviews()

Implements hook_reviews().

This creates an array of all of the reviews that are implemented by the coder_review module.

@todo Add an abbreviated explanation of what is coder_review.api.php.

See also

hook_reviews()

2 calls to coder_review_reviews()
_coder_review_modified in coder_review/coder_review.common.inc
Determines most recent modification timestamp of key coder_review code files.
_coder_review_reviews in coder_review/coder_review.common.inc
Creates a list of all modules that implement hook_reviews().

File

coder_review/coder_review.common.inc, line 53
Common functions used by both the drush and form interfaces.

Code

function coder_review_reviews() {
  static $cache = array();
  if (!$cache) {
    $path = _coder_review_file_path() . '/includes';
    foreach (scandir($path) as $file) {
      $pathinfo = pathinfo("{$path}/{$file}");
      if ($pathinfo['extension'] == 'inc') {
        require_once "{$path}/{$file}";
        $function = $pathinfo['filename'] . '_reviews';
        if (function_exists($function)) {
          $review = $function();
          if ($review) {
            foreach (array_keys($review) as $review_name) {
              $review[$review_name]['#file'] = "{$path}/{$file}";
            }
            $cache += $review;
          }
        }
      }
    }
  }
  return $cache;
}