1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<?php
namespace Bitweaver\Liberty;
use Bitweaver\KernelTools;
/**
* @version $Revision$
* @package liberty
* @subpackage plugins_data
*/
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Ricardo Gladwell <axonrg@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
// $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 =
'<table class="data help">'
.'<tr>'
.'<th>' . KernelTools::tra( "Key" ) . '</th>'
.'<th>' . KernelTools::tra( "Type" ) . '</th>'
.'<th>' . KernelTools::tra( "Comments" ) . '</th>'
.'</tr>'
.'<tr class="odd">'
.'<td>title</td>'
.'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra( "(optional)") . '</td>'
.'<td>' . KernelTools::tra( "The Title of the Publication. There is no default.") . '</td>'
.'</tr>'
.'<tr class="even">'
.'<td>year</td>'
.'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra( "(optional)") . '</td>'
.'<td>' . KernelTools::tra( "The Year of the Publication. There is no default.") . '</td>'
.'</tr>'
.'<tr class="odd">'
.'<td>authors</td>'
.'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra( "(optional)") . '</td>'
.'<td>' . KernelTools::tra( "The Authors of the Publication. There is no default.") . '</td>'
.'</tr>'
.'</table>'
. 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 <strong>"' . $pluginParams['tag'] . '"</strong> has not been completed as yet. ';
return $ret;
}
}
|