Item13050: lots of use of uninitialized variables in the error logs

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: DpSyntaxHighlighterPlugin
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: MichaelDaum
--- a/lib/Foswiki/Plugins/DpSyntaxHighlighterPlugin.pm
+++ b/lib/Foswiki/Plugins/DpSyntaxHighlighterPlugin.pm
@@ -93,21 +93,22 @@ sub _parseLang {
 sub _handleTag {
     my ($rawParams, $code) = @_;
     my %params = Foswiki::Func::extractParameters($rawParams);
-    my $el = (lc$params{el} eq 'textarea' ? 'textarea' : 'pre');
-    my $lang = lc$params{lang} || lc$params{_DEFAULT}; # language
+
+    my $el = lc($params{el} || 'pre');
+    my $lang = lc($params{lang} || $params{_DEFAULT} || ''); # language
 
     # start
     my $out = "<$el name='code' class='brush: $lang\;";
 
     # attributes
-    $out .= " auto-links: false;" if lc$params{noautolinks} eq 'on';
-    $out .= " gutter: false;" if lc$params{nogutter} eq 'on';
-    $out .= " toolbar: false;" if lc$params{nocontrols} eq 'on';
-    $out .= " collapse: true;" if lc$params{collapse} eq 'on';
+    $out .= " auto-links: false;" if Foswiki::Func::isTrue($params{noautolinks});
+    $out .= " gutter: false;" if Foswiki::Func::isTrue($params{nogutter});
+    $out .= " toolbar: false;" if Foswiki::Func::isTrue($params{nocontrols});
+    $out .= " collapse: true;" if Foswiki::Func::isTrue($params{collapse});
     $out .= " first-line: $params{firstline};" if $params{firstline};
-    $out .= " wrap-lines: false;" if lc$params{nowrap} eq 'on';
-    $out .= " ruler: true;" if lc$params{ruler} eq 'on';
-    $out .= " smart-tabs: false;" if lc$params{nosmarttabs} eq 'on';
+    $out .= " wrap-lines: false;" if Foswiki::Func::isTrue($params{nowrap});
+    $out .= " ruler: true;" if Foswiki::Func::isTrue($params{ruler});
+    $out .= " smart-tabs: false;" if Foswiki::Func::isTrue($params{nosmarttabs});
     $out .= " tab-size: $params{tabsize};" if $params{tabsize};
     $out .= " highlight: [$params{highlight}];" if $params{highlight};
     $out .= "'";
@@ -159,10 +160,10 @@ sub _doHead {
     my $jsDefs = '';
 
     # Hide about/print buttons
-    if (uc(Foswiki::Func::getPreferencesValue("\U$pluginName\_HIDE_ABOUT")) eq 'ON') {
+    if (Foswiki::Func::getPreferencesFlag("\U$pluginName\_HIDE_ABOUT")) {
         $jsDefs .= "\n  delete SyntaxHighlighter.toolbar.items[\"about\"];";
     }
-    if (uc(Foswiki::Func::getPreferencesValue("\U$pluginName\_HIDE_PRINT")) eq 'ON') {
+    if (Foswiki::Func::getPreferencesFlag("\U$pluginName\_HIDE_PRINT")) {
         $jsDefs .= "\n  delete SyntaxHighlighter.toolbar.items[\"printSource\"];";
     }

-- MichaelDaum - 08 Oct 2014

 

ItemTemplate edit

Summary lots of use of uninitialized variables in the error logs
ReportedBy MichaelDaum
Codebase
SVN Range
AppliesTo Extension
Component DpSyntaxHighlighterPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r2 - 04 Dec 2014, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy