[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_api – Dynamic API syntax help


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] shortcode

When 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 HTML

Source

File name: oik-shortcodes/shortcodes/oik-api-importer.php
Lines:
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.

Published: November 15, 2012 | Last updated: November 16, 2012

Information

Shortcode: bw_api
Plugin ref: oik block shortcode and API server
Version: 1.41.1
API ref:
Enclosed content shortcode? Needs [/code]?: No
Expands in 'the_title'?: No
Letters:

Syntax

[bw_api
funcname="| function - Name of the function"
sourcefile="| sourcefile - Sourcefile containing the function"
plugin="| plugin - Implementing plugin slug"]

Shortcode examples

  • Example: demonstrating the [bw_api] shortcode

Related pages and posts

Pages
    Posts
      Posts related by tag
        Posts related by category name
        • Example: demonstrating the [bw_api] shortcode

        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: oikplug@oik-plugins.com

        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-2023. All rights reserved.


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