You are here

function shurly_service_output_txt in ShURLy 8

Same name and namespace in other branches
  1. 6 shurly_service/shurly_service.inc \shurly_service_output_txt()
  2. 7 shurly_service/shurly_service.inc \shurly_service_output_txt()

Output txt data Just outputs the shortUrl attribute... won't show errors

File

shurly_service/shurly_service.inc, line 122
Link general search functionalities to services module.

Code

function shurly_service_output_txt($data) {

  // Sniff the URL and figure out what to output.
  switch (arg(2)) {
    case 'expand':
      $key = 'longUrl';
      break;
    case 'shorten':
    default:
      $key = 'shortUrl';
  }
  if ($data['success']) {
    print $data[$key];
  }
  else {
    print t("ERROR: !error", [
      '!error' => $data['error'],
    ]);
  }
}