You are here

function _print_friendly_urls in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print.pages.inc \_print_friendly_urls()
  2. 6 print.pages.inc \_print_friendly_urls()
  3. 7.2 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

$url: absolute URL to be inserted in the list

Return value

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
_print_rewrite_urls in ./print.pages.inc
Callback function for the preg_replace_callback for URL-capable patterns
_print_var_generator in ./print.pages.inc
Post-processor that fills the array for the template with common details

File

./print.pages.inc, line 409
Contains the functions to generate Printer-friendly pages.

Code

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