fs_canonize_url

The NextGEN Gallery fs canonize url function.

Description

(string) fs_canonize_url( (string) $url, (constant) $omit_host = false, (array) $ignore_params = array() ); 

Returns (string)

Parameters (3)

0. $url (string)
The url.
1. $omit_host — Optional. (constant) => false
The omit host.
2. $ignore_params — Optional. (array) => array()
The ignore params.

Usage

  1. if ( !function_exists( 'fs_canonize_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextgen-gallery/freemius/includes/fs-core-functions.php'; 
  3.  
  4. // The url. 
  5. $url = ''; 
  6.  
  7. // The omit host. 
  8. $omit_host = false; 
  9.  
  10. // The ignore params. 
  11. $ignore_params = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = fs_canonize_url($url, $omit_host, $ignore_params); 
  15.  

Defined (1)

The function is defined in the following location(s).

/freemius/includes/fs-core-functions.php  
  1. function fs_canonize_url( $url, $omit_host = false, $ignore_params = array() ) { 
  2. $parsed_url = parse_url( strtolower( $url ) ); 
  3.  
  4. // if ( ! isset( $parsed_url['host'] ) ) { 
  5. // return $url; 
  6. // } 
  7.  
  8. $canonical = ( ( $omit_host || ! isset( $parsed_url['host'] ) ) ? '' : $parsed_url['host'] ) . $parsed_url['path']; 
  9.  
  10. if ( isset( $parsed_url['query'] ) ) { 
  11. parse_str( $parsed_url['query'], $queryString ); 
  12. $canonical .= '?' . fs_canonize_query_string( $queryString, $ignore_params ); 
  13.  
  14. return $canonical;