Notice: Undefined variable: plugin_id in /home/customer/www/oik-plugins.com/public_html/wp-content/plugins/oik-shortcodes/shortcodes/oik-api-importer.php on line 2814
Dynamic API syntax help
Syntax
[bw_api
funcname="| function - Name of the function"
sourcefile="| sourcefile - Sourcefile containing the function"
plugin="| plugin - Implementing plugin slug"]
[bw_api funcname=oikai_apiref sourcefile=”shortcodes/oik-api-importer.php” plugin=oik-shortcodes]
You appear to be a bot. Output may be restricted
Description
Implement the [bw_api] shortcodeWhen coded as [bw_api]some php code[/bw_api] then this shortcode produces dynamic API documentation When the funcname parameter is not specified then we assume this is being invoked for current post – which is an API If we find the funcname (and sourcefile and plugin) then we can build the apiref including the callers and callees
Usage
$string = oikai_apiref( $atts, $content, $tag );
Parameters
- $atts
- ( array ) optional – { shortcode parameters
- $funcname
- ( string ) optional – the API function name which may be class::method ?
- $sourcefile
- ( string ) optional – the implementing sourcefile
- $plugin
- ( string ) optional – the implementing plugin }
- $content
- ( string ) optional – PHP source to be dynamically documented
- $tag
- ( string ) optional – the shortcode name
Returns
string generated HTMLSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
1 to 65 of 65
function oikai_apiref( $atts=null, $content=null, $tag=null ) { $is_bot_maybe = oiksc_is_bot_maybe(); if ( $is_bot_maybe ) { p( "You appear to be a bot. Output may be restricted" ); } oiksc_autoload(); $funcname = bw_array_get( $atts, "funcname", null ); $sourcefile = bw_array_get( $atts, "sourcefile", null ); $plugin = bw_array_get( $atts, "plugin", null ); $classname = null; $post_id = null; if ( $content ) { oikai_build_dynamic_docs( $content ); } else { if ( !$funcname ) { oik_require( "includes/bw_posts.php" ); $post_id = bw_global_post_id(); bw_trace2( $post_id, "post_id", true, BW_TRACE_VERBOSE ); $sourcefile = get_post_meta( $post_id, "_oik_api_source", true ); if ( $sourcefile ) { $plugin_id = get_post_meta( $post_id, "_oik_api_plugin", true ); if ( $plugin_id ) { $plugin = get_post_meta( $plugin_id, "_oikp_slug", true ); // It may be a theme so try for _oikth_slug if ( !$plugin ) { $plugin = get_post_meta( $plugin_id, "_oikth_slug", true ); } if ( $plugin ) { $funcname = get_post_meta( $post_id, "_oik_api_name", true ); $classname = oikai_get_noderef_value( $post_id, "_oik_api_class", "_oik_class_name" ); //$title = get_the_title(); //$title = str_replace( "(", " ", $title ); //$title = str_replace( ")", " ", $title ); //$title = str_replace( array( "(",")","-"), " ", $title ); //list( $funcname, $rest) = explode( " ", $title. " .", 2 ); } else { e( "Plugin not found for oik_api" ); } } else { e( "Plugin not defined for this API" ); } } else { e( "Sourcefile not defined for $post_id" ); } } if ( $funcname ) { oikai_build_apiref( $funcname, $sourcefile, $plugin, $classname, $post_id, true, $plugin_id ); if ( $post_id ) { oik_require( "shortcodes/oik-apilink.php", "oik-shortcodes" ); if ( !$is_bot_maybe ) { oikai_list_callers_callees( $post_id ); do_action( "bw_metadata", $post_id ); } } } else { e( "bw_api cannot determine the funcname" ); } } return( bw_ret() ); }View on Trac Note: For the oik_api post type, when the [bw_api] shortcode is omitted then it is automatically generated at the end of the content.