You are here

function shorten_cs_shorten_service in Shorten URLs 8

Same name and namespace in other branches
  1. 8.2 modules/shorten_cs/shorten_cs.module \shorten_cs_shorten_service()
  2. 6 shorten_cs.module \shorten_cs_shorten_service()
  3. 7.2 shorten_cs.module \shorten_cs_shorten_service()
  4. 7 shorten_cs.module \shorten_cs_shorten_service()

Implements hook_shorten_service().

File

modules/shorten_cs/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;
}