You appear to be a bot. Output may be restricted
Description
Form an URL for the given location assuming UK basedCater for different hosts.
Starting with a $tideurl that is expected to contain http://domain/port
we're trying to create something like this:
domain | format |
---|---|
tidetimes.org.uk | domain/port-tide-times.rss |
tidetimes.co.uk | domain/rss/port-tide-times |
Usage
$string = bw_tideurl_namify( $tideurl );
Parameters
- $tideurl
- ( string ) required – user input
Returns
string $newurl – URL to use for the RSS feedSource
File name: uk-tides/shortcodes/uk-tides.phpLines:
1 to 18 of 18
function bw_tideurl_namify( $tideurl ) { $newurl = strtolower( $tideurl ); $newurl = str_replace( "_", "-", $newurl ); $newurl = str_replace( " ", "-", $newurl ); $newurl = str_replace( ".rss", "", $newurl ); if ( false === strpos( $newurl, "-tide-times" ) ) { $newurl .= "-tide-times"; } $dotorguk = false !== strpos( $newurl, ".org.uk" ); if ( $dotorguk ) { $newurl .= ".rss"; } else { if ( false === strpos( $newurl, "/rss/" ) ) { $newurl = str_replace( ".co.uk/", ".co.uk/rss/", $newurl ); } } return $newurl; }View on GitHub View on Trac