Back to Route class

Method _

public static string
_
(mixed $url, mixed $xhtml = true, mixed $tls = self::TLS_IGNORE, mixed $absolute = false)
Translates an internal Joomla URL to a humanly readable URL. This method builds links for the current active client.
Parameters
  • string $url Absolute or Relative URI to Joomla resource.
  • bool $xhtml Replace & by & for XML compliance.
  • int $tls Secure state for the resolved URI. Use Route::TLS_* constants 0: (default) No change, use the protocol currently used in the request 1: Make URI secure using global secure site URI. 2: Make URI unsecure using the global unsecure site URI.
  • bool $absolute Return an absolute URL
Returns
  • string The translated humanly readable URL.
Since
  • 1.7.0
Class: Route
Project: Joomla

Method _ - Source code

/**
 * Translates an internal Joomla URL to a humanly readable URL. This method builds links for the current active client.
 *
 * @param   string   $url       Absolute or Relative URI to Joomla resource.
 * @param   boolean  $xhtml     Replace & by & for XML compliance.
 * @param   integer  $tls       Secure state for the resolved URI. Use Route::TLS_* constants
 *                                0: (default) No change, use the protocol currently used in the request
 *                                1: Make URI secure using global secure site URI.
 *                                2: Make URI unsecure using the global unsecure site URI.
 * @param   boolean  $absolute  Return an absolute URL
 *
 * @return  string  The translated humanly readable URL.
 *
 * @since   1.7.0
 */
public static function _($url, $xhtml = true, $tls = self::TLS_IGNORE, $absolute = false)
{
    try {
        // @deprecated  4.0 Before 3.9.7 this method silently converted $tls to integer
        if (!is_int($tls)) {
            @trigger_error(__METHOD__ . '() called with incompatible variable type on parameter $tls.', E_USER_DEPRECATED);
            $tls = (int) $tls;
        }
        // @todo  Deprecate in 4.0 Before 3.9.7 this method accepted -1.
        if ($tls === -1) {
            $tls = self::TLS_DISABLE;
        }
        $app = Factory::getApplication();
        $client = $app->getName();
        return static::link($client, $url, $xhtml, $tls, $absolute);
    } catch (\RuntimeException $e) {
        // @deprecated  4.0 Before 3.9.0 this method failed silently on router error. This B/C will be removed in Joomla 4.0.
        return null;
    }
}