You are here

function _print_friendly_urls in Printer, email and PDF versions 7.2

Same name and namespace in other branches
  1. 5.4 print.pages.inc \_print_friendly_urls()
  2. 5.3 print.pages.inc \_print_friendly_urls()
  3. 6 print.pages.inc \_print_friendly_urls()
  4. 7 print.pages.inc \_print_friendly_urls()
  5. 5.x print.pages.inc \_print_friendly_urls()

Auxiliary function to store the Printer-friendly URLs list as static.

Parameters

string|int $url: Absolute URL to be inserted in the list.

Return value

array|int list of URLs previously stored if $url is 0, or the current count otherwise.

3 calls to _print_friendly_urls()
PrintBasicTest::testPrintRewriteUrls in tests/print_basic.test
Test rewrite of URLs.
theme_print_url_list in ./print.pages.inc
Returns HTML for the URL list of the print template.
_print_rewrite_urls in ./print.pages.inc
Callback function for the preg_replace_callback for URL-capable patterns.

File

./print.pages.inc, line 552

Code

function _print_friendly_urls($url = 0) {
  $urls =& drupal_static(__FUNCTION__, array());
  if ($url !== 0) {
    $url_idx = array_search($url, $urls);
    if ($url_idx !== FALSE) {
      return $url_idx + 1;
    }
    else {
      $urls[] = $url;
      return count($urls);
    }
  }
  else {
    $ret = $urls;
    $urls = array();
    return $ret;
  }
}