Description
Implement [api] shortcode to produce simple links to an APIIf there's just one API it's shown as "api()". If more than one then they're comma separated, but NOT in an HTML list "api(), api2()" Links are created to PHP, the local site or the 'preferred' WordPress reference site.
Usage
$string = oikai_api( $atts, $content, $tag );Parameters
- $atts
- ( array ) optional – shortcode parameters
- $content
- ( string ) optional – content
- $tag
- ( string ) optional – the shortcode tag
Returns
string generated HTMLSource
File name: oik-shortcodes/shortcodes/oik-api.phpLines:
1 to 24 of 24
function oikai_api( $atts=null, $content=null, $tag=null ) { oiksc_autoload(); $apis = bw_array_get_from( $atts, "api,0", null ); if ( $apis ) { $apia = bw_as_array( $apis ); oik_require( "shortcodes/oik-apilink.php", "oik-shortcodes" ); oik_require( "shortcodes/oik-api-importer.php", "oik-shortcodes" ); $count = 0; foreach ( $apia as $key => $api ) { $api = oikai_simplify_apiname( $api ); if ( $count ) { e( "," ); e( " " ); } $count++; $type = oikai_determine_reference_type( $api ); oikai_handle_reference_type( $api, $type ); } } else { oik_require( "shortcodes/oik-api-status.php", "oik-shortcodes" ); oikai_api_status( $atts ); } return( bw_ret() ); }View on GitHub
Called by
Invoked by
Calls
1 to 6 of 6
- bw_as_array() – Split a string into an array if necessary
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- oikai_api_status() – Report the current status of the system
- oikai_determine_reference_type() – Determine the reference type for a string
- oikai_handle_reference_type() – Produce a link to the API based on the reference_type
- oikai_simplify_apiname() – Simplify the API name
