see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Marc Laporte // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: StarRider // +----------------------------------------------------------------------+ // $Id$ /** * definitions */ define( 'PLUGIN_GUID_DATAINCLUDE', 'datainclude' ); global $gLibertySystem; $pluginParams = [ 'tag' => 'INCLUDE', 'auto_activate' => true, 'requires_pair' => false, 'load_function' => '\data_include', 'title' => 'Include', 'help_page' => 'DataPluginInclude', 'description' => KernelTools::tra("This plugin is used to include the contents of one Wiki page in another Wiki page."), 'help_function' => '\data_include_help', 'syntax' => "{INCLUDE content_id= }", 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAINCLUDE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAINCLUDE ); // Help Function function data_include_help() { $help = '
'.KernelTools::tra( 'key' ).' '.KernelTools::tra( 'type' ).' '.KernelTools::tra( 'comments' ).'
page_name '.KernelTools::tra( 'string (optional)' ).' '.KernelTools::tra( 'To include any wiki page you can use it\'s page name (this has to be a unique name. if it\'s not unique, use the page_id instead) (this method is deprecated).' ).'
page_id '.KernelTools::tra( 'numeric (optional)' ).' '.KernelTools::tra( 'To include any wiki page you can use it\'s page_id number.' ).'
content_id '.KernelTools::tra( 'numeric (optional)' ).' '.KernelTools::tra( 'To include any content from bitweaver insert the appropriate numeric content id. This can include blog posts, images, wiki texts...
Avaliable content can be viewed here' ).'
Example: {INCLUDE page_name=Welcome} Example: {INCLUDE page_id=15} Example: {INCLUDE content_id=15}'; return $help; } function data_include($data, $params) { $ret = "

Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page.

"; // load page by page_id if( isset( $params['page_id'] ) && is_numeric( $params['page_id'] ) ) { global $gLibertySystem; $typeClass = $gLibertySystem->getContentClassName( 'bitpage' ); $wp = new BitPage( $params['page_id'] ); if( $wp->load() ) { $ret = $wp->getParsedData(); } // load page by content_id } elseif( isset( $params['content_id'] ) && is_numeric( $params['content_id'] ) ) { if( $obj = LibertyBase::getLibertyObject( $params['content_id'] ) ) { $ret = $obj->getParsedData(); } // load page by page_name } elseif( isset( $params['page_name'] ) ) { $ret = "page_name isn't working yet, please use page_id or content_id"; } // if $ret is empty, we need to make sure there is at least a space that we get rid of the {} if( empty( $ret )) { $ret = ' '; } return $ret; }