classes/fields/website.php
public function build_url( $url, $options = array() ) {

		$url = (array) $url;

		$allow_port = (int) pods_v( static::$type . '_allow_port', $options, 0 );

		// If port is not allowed, always set to empty
		if ( 0 === $allow_port ) {
			$url['port'] = '';
		}

		if ( function_exists( 'http_build_url' ) ) {
			return http_build_url( $url );
		}

		$defaults = array(
			'scheme'   => 'http',
			'host'     => '',
			'port'     => '',
			'path'     => '/',
			'query'    => '',
			'fragment' => '',
		);

		$url = array_merge( $defaults, $url );

		$new_url = array();

		$new_url[] = trim( $url['scheme'] . '://', ':' );
		$new_url[] = $url['host'];

		if ( ! empty( $url['port'] ) ) {
			$new_url[] = ':' . $url['port'];
		}

		$new_url[] = '/' . ltrim( $url['path'], '/' );

		if ( ! empty( $url['query'] ) ) {
			$new_url[] = '?' . ltrim( $url['query'], '?' );
		}

		if ( ! empty( $url['fragment'] ) ) {
			$new_url[] = '#' . ltrim( $url['fragment'], '#' );
		}

		// Pull all of the parts back together
		$new_url = implode( '', $new_url );

		return $new_url;

	}
public function build_url( $url, $options = array() ) {

		$url = (array) $url;

		$allow_port = (int) pods_v( static::$type . '_allow_port', $options, 0 );

		// If port is not allowed, always set to empty
		if ( 0 === $allow_port ) {
			$url['port'] = '';
		}

		if ( function_exists( 'http_build_url' ) ) {
			return http_build_url( $url );
		}

		$defaults = array(
			'scheme'   => 'http',
			'host'     => '',
			'port'     => '',
			'path'     => '/',
			'query'    => '',
			'fragment' => '',
		);

		$url = array_merge( $defaults, $url );

		$new_url = array();

		$new_url[] = trim( $url['scheme'] . '://', ':' );
		$new_url[] = $url['host'];

		if ( ! empty( $url['port'] ) ) {
			$new_url[] = ':' . $url['port'];
		}

		$new_url[] = '/' . ltrim( $url['path'], '/' );

		if ( ! empty( $url['query'] ) ) {
			$new_url[] = '?' . ltrim( $url['query'], '?' );
		}

		if ( ! empty( $url['fragment'] ) ) {
			$new_url[] = '#' . ltrim( $url['fragment'], '#' );
		}

		// Pull all of the parts back together
		$new_url = implode( '', $new_url );

		return $new_url;

	}
public function build_url ( $ url , $ options = array ( ) ) { $ url = ( array ) $ url ; $ allow_port = ( int ) pods_v ( static :: $ type . '_allow_port' , $ options , 0 ) ; // If port is not allowed, always set to empty if ( 0 === $ allow_port ) { $ url [ 'port' ] = '' ; } if ( function_exists ( 'http_build_url' ) ) { return http_build_url ( $ url ) ; } $ defaults = array ( 'scheme' => 'http' , 'host' => '' , 'port' => '' , 'path' => '/' , 'query' => '' , 'fragment' => '' , ) ; $ url = array_merge ( $ defaults , $ url ) ; $ new_url = array ( ) ; $ new_url [ ] = trim ( $ url [ 'scheme' ] . '://' , ':' ) ; $ new_url [ ] = $ url [ 'host' ] ; if ( ! empty ( $ url [ 'port' ] ) ) { $ new_url [ ] = ':' . $ url [ 'port' ] ; } $ new_url [ ] = '/' . ltrim ( $ url [ 'path' ] , '/' ) ; if ( ! empty ( $ url [ 'query' ] ) ) { $ new_url [ ] = '?' . ltrim ( $ url [ 'query' ] , '?' ) ; } if ( ! empty ( $ url [ 'fragment' ] ) ) { $ new_url [ ] = '#' . ltrim ( $ url [ 'fragment' ] , '#' ) ; } // Pull all of the parts back together $ new_url = implode ( '' , $ new_url ) ; return $ new_url ; }
Build a url from url parts

@param array|string $url     URL value.
@param array        $options Field options.

@return string
Build a url from url parts