You are here

function _print_page_match in Printer, email and PDF versions 6

Same name and namespace in other branches
  1. 5.4 print.module \_print_page_match()
  2. 5.3 print.module \_print_page_match()
  3. 7 print.module \_print_page_match()
  4. 5.x print.module \_print_page_match()

Check if the provided page is enabled according to the visibility settings

Parameters

$visibility: current visibility settings: 0 for show on every page except the listed pages 1 for show on only the listed pages

$pages: list of pages

Return value

TRUE if it is enabled, FALSE otherwise

3 calls to _print_page_match()
print_link_allowed in ./print.module
Check if the link to the PF version is allowed depending on the settings
print_mail_link_allowed in print_mail/print_mail.module
Check if the link to send by email is allowed depending on the settings
print_pdf_link_allowed in print_pdf/print_pdf.module
Check if the link to the PDF version is allowed depending on the settings

File

./print.module, line 782
Displays Printer-friendly versions of Drupal pages.

Code

function _print_page_match($visibility, $path, $pages) {
  if ($pages) {
    if ($visibility == 2) {
      return drupal_eval($pages);
    }
    $alias = drupal_get_path_alias($path);
    $page_match = drupal_match_path($path, $pages);
    if ($alias != $path) {
      $page_match = $page_match || drupal_match_path($alias, $pages);
    }
    return !($visibility xor $page_match);
  }
  else {
    return !$visibility;
  }
}