see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Ricardo Gladwell // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: StarRider // +----------------------------------------------------------------------+ // $Id$ /** * definitions */ global $gBitSystem; if( ( $gBitSystem->isPackageActive( 'wiki' ) ) && ( $gBitSystem->isFeatureActive( 'wiki_copyrights' ) ) ) { // Do not include this Plugin if this Package and Feature are not active define( 'PLUGIN_GUID_DATACOPYRIGHT', 'datacopyright' ); global $gLibertySystem; $pluginParams = [ 'tag' => 'COPYRIGHT', 'auto_activate' => false, 'requires_pair' => false, 'load_function' => '\data_copyright', 'title' => 'CopyRight', 'help_page' => 'DataPluginCopyRight', 'description' => KernelTools::tra("This plugin is used to insert CopyRight notices."), 'help_function' => '\data_copyright_help', 'syntax' => "{COPYRIGHT title= year= authors= }", 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATACOPYRIGHT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACOPYRIGHT ); // Help Function function data_copyright_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
title' . KernelTools::tra( "string") . '
' . KernelTools::tra( "(optional)") . '
' . KernelTools::tra( "The Title of the Publication. There is no default.") . '
year' . KernelTools::tra( "string") . '
' . KernelTools::tra( "(optional)") . '
' . KernelTools::tra( "The Year of the Publication. There is no default.") . '
authors' . KernelTools::tra( "string") . '
' . KernelTools::tra( "(optional)") . '
' . KernelTools::tra( "The Authors of the Publication. There is no default.") . '
' . KernelTools::tra("Example: ") . "{COPYRIGHT title='The Tiki Way' year='May 10, 2004' authors='StarRider' }"; return $help; } // Load Function function data_copyright($data, $params) { // Pre-Clyde Changes // This plugin did not use any parameters - The keywords ~Title~ ~year~ and ~authors~ were inbeded in $data like this // {COPYRIGHT()}~title~The Tiki Way~year~May 10, 2004~authors~StarRider{COPYRIGHT} // Changed this to use Parameters instead // Added testing to maintain Pre-Clyde compatability // The next 2 lines allow access to the $pluginParams given above and may be removed when no longer needed global $gLibertySystem; $pluginParams = $gLibertySystem->mPlugins[PLUGIN_GUID_DATACOPYRIGHT]; extract ($params, EXTR_SKIP); // This maintains Pre-Clyde Parameters if ( !empty( $data) ) { // The problem with this is that $authors HAS to be the last key-word $pos1 = strpos( strtolower($data), '~title~') + 7; $pos2 = strpos( strtolower($data), '~', $pos1 + 1 ); $title = substr( $data, $pos1, $pos2-$pos1); $pos1 = strpos( strtolower($data), '~year~') + 6; $pos2 = strpos( strtolower($data), '~', $pos1 + 1 ); $year = substr( $data, $pos1, $pos2-$pos1); $pos1 = strpos( strtolower($data), '~authors~') + 9; $pos2 = strlen($data) - $pos1; $authors = substr( $data, $pos1, $pos2); } else { $title = $title ?? ' '; $year = $year ?? ' '; $authors = $authors ?? ' '; } $ret = 'The plugin "' . $pluginParams['tag'] . '" has not been completed as yet. '; return $ret; } }