23
23
24
24
25
25
# =========================
26
- package TWiki ::Plugins::BarcodePlugin ; # change the package name and $pluginName!!!
26
+ package Foswiki ::Plugins::BarcodePlugin ; # change the package name and $pluginName!!!
27
27
# =========================
28
28
29
29
use vars qw(
@@ -43,7 +43,7 @@ use vars qw(
43
43
$pluginInitialized;
44
44
) ;
45
45
46
- # This should always be $Rev$ so that TWiki can determine the checked-in
46
+ # This should always be $Rev$ so that Foswiki can determine the checked-in
47
47
# status of the plugin. It is used by the build automation tools, so
48
48
# you should leave it alone.
49
49
$VERSION = ' $Rev$' ;
@@ -61,21 +61,21 @@ sub initPlugin
61
61
( $topic , $web , $user , $installWeb ) = @_ ;
62
62
63
63
# check for Plugins.pm versions
64
- if ( $TWiki ::Plugins::VERSION < 1 ) {
65
- TWiki ::Func::writeWarning( " Version mismatch between $pluginName and Plugins.pm" );
64
+ if ( $Foswiki ::Plugins::VERSION < 1 ) {
65
+ Foswiki ::Func::writeWarning( " Version mismatch between $pluginName and Plugins.pm" );
66
66
return 0;
67
67
}
68
68
69
69
# Get plugin debug flag
70
- $debug = TWiki ::Func::getPreferencesFlag( " \U $pluginName \E _DEBUG" );
70
+ $debug = Foswiki ::Func::getPreferencesFlag( " \U $pluginName \E _DEBUG" );
71
71
72
72
# Get plugin preferences, the variable defined by: * Set EXAMPLE = ...
73
73
# $barcodeCount is used to assign a unique filename to each barcode in a topic.
74
74
$barcodeCount =0;
75
75
$pluginInitialized = 0;
76
76
77
77
# Plugin correctly initialized
78
- TWiki ::Func::writeDebug( " - TWiki ::Plugins::${pluginName} ::initPlugin( $web .$topic ) is OK" ) if $debug ;
78
+ Foswiki ::Func::writeDebug( " - Foswiki ::Plugins::${pluginName} ::initPlugin( $web .$topic ) is OK" ) if $debug ;
79
79
return 1;
80
80
}
81
81
@@ -139,7 +139,7 @@ sub _parse_parameters
139
139
return %args ;
140
140
}
141
141
142
- # Return the value for the specified TWiki plugin parameter. If the
142
+ # Return the value for the specified Foswiki plugin parameter. If the
143
143
# parameter does not exist, then return the specified default value. The
144
144
# parameter is deleted from the list of specified parameters allowing the
145
145
# code to determine what parameters remain and were not requested.
@@ -172,7 +172,7 @@ sub _make_filename
172
172
173
173
# before save, create directories if they don't exist.
174
174
# If the top level "pub/$web" directory doesn't exist, create it.
175
- my $dir = TWiki ::Func::getPubDir() . " /$web " ;
175
+ my $dir = Foswiki ::Func::getPubDir() . " /$web " ;
176
176
if ( ! -e " $dir " ) {
177
177
umask ( 002 );
178
178
mkdir ( $dir , 0775 );
@@ -193,7 +193,7 @@ sub commonTagsHandler
193
193
{
194
194
# ## my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead
195
195
196
- TWiki ::Func::writeDebug( " - ${pluginName} ::commonTagsHandler( $_ [2].$_ [1] )" ) if $debug ;
196
+ Foswiki ::Func::writeDebug( " - ${pluginName} ::commonTagsHandler( $_ [2].$_ [1] )" ) if $debug ;
197
197
198
198
# This is the place to define customized tags and variables
199
199
# Called by sub handleCommonTags, after %INCLUDE:"..."%
@@ -204,7 +204,7 @@ sub commonTagsHandler
204
204
205
205
# =========================
206
206
sub _makeBarcode {
207
- TWiki ::Func::writeDebug( " - ::makeBarcode " ) if $debug ;
207
+ Foswiki ::Func::writeDebug( " - ::makeBarcode " ) if $debug ;
208
208
my ($args , $topic , $web ) = @_ ;
209
209
if (!$pluginInitialized ) {
210
210
$pluginInitialized = 1;
@@ -217,14 +217,14 @@ sub _makeBarcode {
217
217
# Parse the args
218
218
my %parameters = _parse_parameters($args );
219
219
220
- TWiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode( arg=$args )" ) if $debug ;
220
+ Foswiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode( arg=$args )" ) if $debug ;
221
221
222
222
# Create the PNG
223
223
my $bc = new Barcode::Code128;
224
224
225
225
# Get text
226
226
my ($text ) = _get_parameter(" text" ,$defaultText , \%parameters );
227
- TWiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode text=$text " ) if $debug ;
227
+ Foswiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode text=$text " ) if $debug ;
228
228
# Get Default Paramters
229
229
my ($padding ) = _get_parameter(" padding" ,$defaultPadding , \%parameters );
230
230
my ($height ) = _get_parameter(" height" ,$defaultHeight , \%parameters );
@@ -249,7 +249,7 @@ sub _makeBarcode {
249
249
$text =~ tr | A-Za-z\-| a-zA-Z/| ;
250
250
}
251
251
my ($dir , $filename ) = _make_filename(" barcode" ,$barcodeCount ++, $topic , $web );
252
- TWiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode file=$dir $filename " ) if $debug ;
252
+ Foswiki ::Func::writeDebug( " - ${pluginName} ::handleBarcode file=$dir $filename " ) if $debug ;
253
253
254
254
my $bc_png ;
255
255
eval {$bc_png =$bc -> png($text )} || return _make_error $@ ;
0 commit comments