Function __global->_url_to_page_link

Definitions

sources/urls2.php

  • Convert a local URL to a page-link.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$url URLPATH No No required parameter N/A N/A The URL to convert. Note it may not be a URL Scheme, and it must be based on the local base URL (else failure WILL occur).
$abs_only boolean No No False N/A N/A Whether to only convert absolute URLs. Turn this on if you're not sure what you're passing is a URL not and you want to be extra safe.
$perfect_only boolean No No True N/A N/A Whether to only allow perfect conversions

Returns

  • The page-link (blank: could not convert)
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Convert a local URL to a page-link.
 *
 * @param  URLPATH $url The URL to convert. Note it may not be a URL Scheme, and it must be based on the local base URL (else failure WILL occur).
 * @param  boolean $abs_only Whether to only convert absolute URLs. Turn this on if you're not sure what you're passing is a URL not and you want to be extra safe.
 * @param  boolean $perfect_only Whether to only allow perfect conversions
 * @return string The page-link (blank: could not convert)
 */

function _url_to_page_link(string $url, bool $abs_only = false, bool $perfect_only = true) : string