You are here

function _shorten_xml in Shorten URLs 7

Same name and namespace in other branches
  1. 8.2 shorten.module \_shorten_xml()
  2. 8 shorten.module \_shorten_xml()
  3. 6 shorten.module \_shorten_xml()
  4. 7.2 shorten.module \_shorten_xml()

Parses the value between tags in an XML document.

Parameters

$xml: The contents of the XML document.

$tag: The tag to get the value from.

Return value

The value from the specified tag, typically an abbreviated URL.

1 call to _shorten_xml()
shorten_fetch in ./shorten.module
Downloads the response of the URL abbreviation service.

File

./shorten.module, line 457
Shortens URLs via external services.

Code

function _shorten_xml($xml, $tag) {
  $start = strpos($xml, $tag) + drupal_strlen($tag) + 1;
  $end = strpos($xml, $tag, $start + 1) - 2;
  $length = -(drupal_strlen($xml) - $end);
  return drupal_substr($xml, $start, $length);
}