function shorten_cs_shorten_service in Shorten URLs 7
Same name and namespace in other branches
- 8.2 modules/shorten_cs/shorten_cs.module \shorten_cs_shorten_service()
- 8 modules/shorten_cs/shorten_cs.module \shorten_cs_shorten_service()
- 6 shorten_cs.module \shorten_cs_shorten_service()
- 7.2 shorten_cs.module \shorten_cs_shorten_service()
Implements hook_shorten_service().
File
- ./shorten_cs.module, line 43 
- Allows users to specify custom services for the Shorten URLs module.
Code
function shorten_cs_shorten_service() {
  $result = db_query("SELECT * FROM {shorten_cs}")
    ->fetchAll();
  $services = array();
  foreach ($result as $service) {
    $services[$service->name] = array(
      'custom' => $service->type == 'text' ? FALSE : $service->type,
      'url' => $service->url,
    );
    if ($service->type == 'xml') {
      $services[$service->name]['tag'] = $service->tag;
    }
    elseif ($service->type == 'json') {
      $services[$service->name]['json'] = $service->tag;
    }
  }
  return $services;
}