Description
Create or update an "oik_api" post_type
Usage
$ID = _oiksc_create_api( $plugin, $api, $file, $type, $title, $echo );Parameters
- $plugin
- ( ID ) required –
- $api
- ( string ) required –
- $file
- ( string ) required –
- $type
- ( string ) required –
- $title
- ( string ) optional –
- $echo
- ( bool ) optional default: 1 – true for the front end, false in batch
Returns
IDSource
File name: oik-shortcodes/admin/oik-apis.phpLines:
1 to 42 of 42
function _oiksc_create_api( $plugin, $api, $file, $type, $title=null, $echo=true ) { p( "Creating API: $api file: $file" ); oik_require( "shortcodes/oik-apilink.php", "oik-shortcodes" ); $post_ids = oikai_get_oik_api_byname( $api ); bw_trace2( $post_ids, "post_ids", BW_TRACE_DEBUG ); if ( !$post_ids || 0 === count( $post_ids) ) { $post_id = oiksc_create_oik_api( $plugin, $api, $file, $type, $title ); } else { $post = get_post( $post_ids[0] ); if ( $post ) { $post_id = $post->ID; oiksc_update_oik_api( $post, $plugin, $api, $file, $type, $title ); } else { p( "Error: post missing for " . $post_ids[0]); } } oikai_load_posts( $api ); global $oikai_post_id; $oikai_post_id = $post_id; /** * We need to ensure that the first instance of the function name does not appear as a call to the function. * To achieve this we need to let the pseudo method know that it's part of the class. */ $class = oikai_get_class( $api ); p( "Class $class" ); bw_context( "classname", $class ); //bw_context( "variable", "this" ); //bw_context( "operator", "function" ); bw_context( "paged", false ); oiksc_build_callees( $api, $file, $plugin, $post_id, $echo ); if ( $echo ) { oikai_save_callees( $post_id ); oiksc_save_hooks( $post_id ); oiksc_save_associations( $post_id ); } return( $post_id ); }View on GitHub
Called by
1 to 3 of 3
Invoked by
Calls
1 to 12 of 12
- bw_context() – Set/return some contextual information
- bw_trace2() – Trace $value to the trace log file if tracing is active
- oikai_get_class() – Return the class name for this method
- oikai_get_oik_api_byname() – Load the API(s) for the given function
- oikai_load_posts() – Load posts associated with the given function
- oikai_save_callees() – Save the callee list for the current API
- oiksc_build_callees() – Build the callees for this API
- oiksc_create_oik_api() – Programmatically create an oik_api record for a selected plugin’s func
- oiksc_save_associations() – Update hook associations defined by this API
- oiksc_save_hooks() – Save the hook invocations
- oiksc_update_oik_api() – Update the meta data for an oik_api post_type
- p() – Output a paragraph of translatable text
