function boost_parse_url

cis7 boost.module boost_parse_url($url = NULL, $b_path = NULL)
cle7 boost.module boost_parse_url($url = NULL, $b_path = NULL)
elmsmedia7 boost.module boost_parse_url($url = NULL, $b_path = NULL)
icor7 boost.module boost_parse_url($url = NULL, $b_path = NULL)
meedjum_blog7 boost.module boost_parse_url($url = NULL, $b_path = NULL)
mooc7 boost.module boost_parse_url($url = NULL, $b_path = NULL)

parse_url that takes into account the base_path

Parameters

$url: Full URL

$b_path: Base Path

1 call to boost_parse_url()
boost_transform_url in sites/all/modules/ulmus/boost/boost.module
Given a URL give back eveything we know

File

sites/all/modules/ulmus/boost/boost.module, line 461
Caches generated output as a static file to be served directly from the webserver.

Code

function boost_parse_url($url = NULL, $b_path = NULL) {
  global $base_root, $base_path;
  // Set defaults.
  if ($url === NULL) {
    $url = $base_root . request_uri();
  }
  if ($b_path == NULL) {
    $b_path = $base_path;
  }

  // Parse url.
  $parts = parse_url($url);
  if (empty($parts['host']) || empty($parts['path'])) {
    return FALSE;
  }
  if (!isset($parts['query'])) {
    $parts['query'] = '';
  }
  $parts['path'] = $parts['full_path'] = urldecode(preg_replace('/^' . preg_quote($b_path, '/') . '/i', '', $parts['path']));
  $parts['base_path'] = $b_path;
  $parts['query_array'] = array();
  parse_str($parts['query'], $parts['query_array']);

  // Check if language prefix for urls is enabled.
  if (drupal_multilingual() && variable_get('locale_language_negotiation_url_part') == LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) {
    // Get languages grouped by status and select only the enabled ones.
    $languages = language_list('enabled');
    $languages = $languages[1];
    list($language, $parts['path']) = language_url_split_prefix($parts['path'], $languages);
  }

  // Get page number and info from the query string.
  if (!empty($parts['query_array'])) {
    $query = array();
    foreach ($parts['query_array'] as $key => $val) {
      if ($key != 'q' && $key != 'destination' && $key != 'page' && !empty($val)) {
        $query[$key] = $val;
      }
      if ($key == 'page' && is_numeric($val)) {
        $parts['page_number'] = $val;
      }
    }
    ksort($query);
    $parts['query_extra'] = str_replace('&', '&', urldecode(http_build_query($query)));
  }

  // Get fully decoded URL.
  $decoded1 = urldecode($parts['base_path'] . $parts['path'] . variable_get('boost_char', BOOST_CHAR) . $parts['query']);
  $decoded2 = urldecode($decoded1);
  while ($decoded1 != $decoded2) {
    $decoded1 = urldecode($decoded2);
    $decoded2 = urldecode($decoded1);
  }
  $decoded = $decoded2;
  unset($decoded2);
  unset($decoded1);

  $parts['url_full'] = $parts['host'] . $parts['base_path'] . $parts['path'] . variable_get('boost_char', BOOST_CHAR) . $parts['query'];
  $parts['url'] = $url;
  $parts['url_decoded'] = $decoded;
  return $parts;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.