see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Gustavo Muslera // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: wjames5 // | Reworked from: data.articles.php from wikiplugin_articles.php // +----------------------------------------------------------------------+ // $Id$ /** * definitions */ global $gBitSystem, $gBitSmarty; define( 'PLUGIN_GUID_DATAQUOTE', 'dataquote' ); global $gLibertySystem; $pluginParams = array ( 'tag' => 'quote', 'auto_activate' => FALSE, 'requires_pair' => TRUE, 'load_function' => 'data_quote', 'help_function' => 'data_quote_help', 'title' => 'Quote', 'help_page' => 'DataPluginQuote', 'description' => tra( "This plugin allows content to be attributed to other authors and visually indicated." ), 'syntax' => "{quote format_guid= user= comment_id= }.. content ..{/quote}", 'plugin_type' => DATA_PLUGIN ); $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAQUOTE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAQUOTE ); // Help Routine function data_quote_help() { $help ="
" . tra( "Key" ) . " " . tra( "Type" ) . " " . tra( "Comments" ) . "
comment_id " . tra( "comment_id") . '
' . tra("(optional)") . "
" . tra( "specify the comment_id of the comment being quoted") . "
user " . tra( "user") . '
' . tra("(optional)") . "
" . tra( "specify the user whose comemnt is being quoted") . "
format_guid " . tra( "string") . '
' . tra("(required)") . "
" . tra( "Specify what renderer should be used to render the contents") . "
". tra("Example: ") . '{quote format_guid="tikiwiki" comment_id="7" user="user"} ... {/quote}
'; return $help; } // Executable Routine function data_quote( $pData, $pParams ) { global $gLibertySystem, $gBitSmarty, $gBitSystem; if( empty( $pParams['format_guid'] )) { // default should be set - if not, we'll use tikiwiki - can't use PLUGIN_GUID_TIKIWIKI since it might not be defined. $pParams['format_guid'] = $gBitSystem->getConfig( 'default_format', 'tikiwiki' ); } $rendererHash = array(); $rendererHash['content_id'] = 0; $rendererHash['format_guid'] = $pParams['format_guid']; $rendererHash['data'] = trim( $pData ); $formatGuid = $rendererHash['format_guid']; $ret = ""; if( $func = $gLibertySystem->getPluginFunction( $formatGuid, 'load_function' ) ) { $ret = $func( $rendererHash, $this ); } $quote = array(); $user = empty( $pParams['user'] ) ? NULL : $pParams['user']; if( !empty( $pParams['comment_id'] )) { if( ACTIVE_PACKAGE == 'boards' ) { $c = new BitBoardPost( preg_replace( '/[^0-9]/', '', $pParams['comment_id'] ) ); } else { $c = new LibertyComment( preg_replace( '/[^0-9]/', '', $pParams['comment_id'] ) ); } if( empty( $c->mInfo['title'] )) { $c->mInfo['title'] = "#".$c->mCommentId; } $quote['cite_url'] = $c->getDisplayUrl(); $quote['title'] = $c->mInfo['title']; $quote['created'] = $c->mInfo['created']; if( empty( $user )) { $user = $c->mInfo['login']; } } $quote['login'] = $user; if( !empty( $user )) { $u = new BitUser(); $u->load( TRUE, $user ); $quote['user_url'] = $u->getDisplayUrl(); $quote['user_display_name'] = $u->mInfo['display_name']; } $quote['ret'] = $ret; $gBitSmarty->assign( "quote", $quote ); $repl = $gBitSmarty->fetch( "bitpackage:liberty/plugins/data_quote.tpl" ); return $repl; } ?>