[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

bw_link_url() – Constructs a suitable URL

You appear to be a bot. Output may be restricted

Description

Constructs a suitable URL

We've been given what may be an URL. What can we do to make the link really easy to use? parse_url produces an array which may contain these fields:

  • scheme – e.g. http
  • host
  • port
  • user
  • pass
  • path
  • query – after the question mark ?
  • fragment – after the hashmark #

Usage

$string = bw_link_url( $url, $atts );

Parameters

$url
( string ) required – an URL – or part thereof
$atts
( array ) required – shortcode parameters

Returns

string the newly constructed url

Source

File name: oik/shortcodes/oik-link.php
Lines:
1 to 34 of 34
function bw_link_url( $url, $atts ) {
  $newurl = $url;
  $parts = parse_url( $url );
  bw_trace2( $parts, "parts" );
  $scheme = bw_array_get( $parts, "scheme", null );
  if ( !$scheme ) {
    $path = bw_array_get( $parts, "path", null );
    if ( $path ) {
      $parts['scheme'] = is_ssl() ? 'https://' : 'http://';
      $parts['host'] = bw_array_get( $parts, "host", null );
    
      if ( $parts['host'] ) {
        // No need to check if this is a domain, just use it.
        // OR do we?
        //gobang();
      } else {
        // No host... 
        // check to see if the path is a domain?
        $parts = bw_host_or_path( $parts );
        
        //$newurl = set_url_scheme( "$domain/$url" );
      }  
    } else {
      $parts['scheme'] = null;
      $parts['host'] = null;
    }
    $newurl = bw_build_url( $parts );
  } else {
    // Let whatever they've typed be used
  } 
  //$newurl = set_url_scheme( $newurl ); 
  //e("bw_link_url: $newurl" );
  return( $newurl );
}
 
 View on GitHub View on Trac

Published: February 2, 2018 | Last updated: February 2, 2018

Information

Function name: bw_link_url
Plugin ref: oik – oik information kit
Version: 4.7.2
Sourcefile: shortcodes/oik-link.php
File ref: shortcodes/oik-link.php
Deprecated?: No
API Letters: B,L,U

Recent plugin updates

oik v4.7.2 oik v4.7.2 includes a fix to the logic to render blocks for Content and Excerpts in the bw_pages shortcode. ...
oik v4.7.1 Upgrade to oik v4.7.1 for bw_pages rendering blocks for Content and Excerpts, and support for post_name attribute for shortcode which query posts ...
oik-shortcodes v1.41.1 Upgrade to oik-shortcodes v1.41.1 for a couple of minor changes. ...
oik-bob-bing-wide v2.2.2 Upgrade to oik-bob-bing-wide v2.2.2 for improvements to bw_dash examples and fixes to some SVG icon's visibility. ...
oik-bwtrace v3.3.1 Upgrade to oik-bwtrace v3.3.1 to measure plugin load times and ad hoc action timing points. ...

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: [email protected]

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2022. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.0.1. PHP: 7.4.30. Memory limit: 768M