You are here

function apdqc_entity_urls in Asynchronous Prefetch Database Query Cache 7

Returns an array of entity URL prefixes.

Parameters

string $match: URL prefix to match.

Return value

array All entity names with the prefix if $match is empty. An array($name, $first_part_uri) if $match was matched. NULL if $match was not matched.

2 calls to apdqc_entity_urls()
apdqc_init in ./apdqc.module
Implements hook_init().
apdqc_stream_wrappers in ./apdqc.module
Implements hook_stream_wrappers().

File

./apdqc.module, line 1642
Asynchronous Prefetch Database Query Cache module.

Code

function apdqc_entity_urls($match = '') {
  static $entities;
  static $return;
  if (!isset($entities)) {
    $entities = array();
    if (module_exists('comment')) {
      $entities['comment'] = 'comment/';
    }
    if (module_exists('heartbeat')) {
      $entities['heartbeat'] = 'heartbeat/message/';
    }
    if (module_exists('mollom_test')) {
      $entities['mollom_test'] = 'mollom-test/form/';
    }
    if (module_exists('node')) {
      $entities['node'] = 'node/';
      $entities['_node'] = 'node';
    }
    if (module_exists('privatemsg_message')) {
      $entities['privatemsg_message'] = 'messages/view/';
    }
    if (module_exists('relation')) {
      $entities['relation'] = 'relation/';
    }
    if (module_exists('search_api')) {
      $entities['search_api_server'] = 'admin/config/search/search_api/server/';
      $entities['search_api_index'] = 'admin/config/search/search_api/index/';
    }
    if (module_exists('taxonomy')) {
      $entities['taxonomy_term'] = 'taxonomy/term/';
    }
    if (module_exists('uc_order')) {
      $entities['uc_order'] = 'admin/store/orders/';
    }
    if (module_exists('user')) {
      $entities['user'] = 'user/';
      $entities['_user'] = 'user';
    }
  }
  if (empty($match)) {
    return $entities;
  }
  foreach ($entities as $name => $first_part_uri) {
    if (strpos($match, $first_part_uri) === 0) {
      $return[$match] = array(
        ltrim($name, '_'),
        $first_part_uri,
      );
      break;
    }
  }
  if (isset($return[$match])) {
    return $return[$match];
  }
}