You are here

function _pdf_export_generate_base_path in PDF Export 7

Creates a base path for images (mostly used when using basic auth).

2 calls to _pdf_export_generate_base_path()
_pdf_export_get_base_path in ./pdf_export.module
Helper to get the base path for images.
_pdf_export_prepend_basic_auth_callback in ./pdf_export.module
Regex replace callback in order to set the correct url for images.

File

./pdf_export.module, line 235
PDF Export module.

Code

function _pdf_export_generate_base_path($styles_path, $basic_auth = FALSE) {
  $url = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http';
  $url .= '://';
  if ($basic_auth && !empty($_SERVER["PHP_AUTH_USER"])) {
    $url .= $_SERVER["PHP_AUTH_USER"];
    if (!empty($_SERVER["PHP_AUTH_PW"])) {
      $url .= ':' . $_SERVER["PHP_AUTH_PW"];
    }
    $url .= '@';
  }
  $url .= $_SERVER["HTTP_HOST"] . '/' . $styles_path;
  return $url;
}