You appear to be a bot. Output may be restricted
Description
See if domain required?This is now a lot simpler. If it starts with '/' then path[0] will be null So we use this as the domain ( host ) otherwise… we treat as a link within the current site
path[0] | path[1] | e.g. | Processing |
---|---|---|---|
set | set | post_type/etcetera | |
set | null | post_type | Is this a permalink? |
null | set | /somewhere | |
null | null | / | domain required. They just entered ‘/’ – so domain required. A bit of a silly link? No; it depends on what’s in query/fragment |
Usage
$array = bw_see_if_domain_required( $parts, $path );
Parameters
- $parts
- ( array ) required – the URL's component parts
- $path
- ( mixed ) required –
Returns
array partsSource
File name: oik/shortcodes/oik-link.phpLines:
1 to 22 of 22
function bw_see_if_domain_required( $parts, $path ) { $path0 = bw_array_get( $path, 0, null ); $path1 = bw_array_get( $path, 1, null ); if ( $path0 ) { //$parts = bw_check_permalink( $parts, $path0, $path1 ); $parts['host'] = $path0; $parts['path'] = $path1; if ( $path1 ) { // we don't yet know if we need to set the host } else { // we still don't know } } else { $parts['host'] = bw_get_domain(); if ( $path1 ) { // } else { // } } return( $parts ); }View on GitHub View on Trac