function _shorten_xml in Shorten URLs 8
Same name and namespace in other branches
- 8.2 shorten.module \_shorten_xml()
- 6 shorten.module \_shorten_xml()
- 7.2 shorten.module \_shorten_xml()
- 7 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 386 - Shortens URLs via external services.
Code
function _shorten_xml($xml, $tag) {
$start = strpos($xml, $tag) + \Drupal\Component\Utility\Unicode::strlen($tag) + 1;
$end = strpos($xml, $tag, $start + 1) - 2;
$length = -(\Drupal\Component\Utility\Unicode::strlen($xml) - $end);
return \Drupal\Component\Utility\Unicode::substr($xml, $start, $length);
}