Skip to content

Commit

Permalink
Item8649: fix using "0" value for =HEADLINESPLUGIN_REFRESH=, =HEADLIN…
Browse files Browse the repository at this point in the history
…ESPLUGIN_LIMIT=, and =HEADLINESPLUGIN_USERAGENTTIMEOUT=

git-svn-id: http://svn.foswiki.org/trunk/HeadlinesPlugin@6822 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Mar 21, 2010
1 parent a7ed18f commit a200aed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions data/System/HeadlinesPlugin.txt
Expand Up @@ -126,9 +126,9 @@ Plugin settings are stored as preferences variables. To reference a plugin setti
* Timeout fetching a feed using the LWP::UserAgent. Default: =20=
* Set USERAGENTTIMEOUT = 20

* Name of user agent. Default: =FoswikiHeadlinesPlugin/2.21.1=
* Name of user agent. Default: =FoswikiHeadlinesPlugin/2.21.2=
<verbatim>
* Set USERAGENTNAME = FoswikiHeadlinesPlugin/2.21.1
* Set USERAGENTNAME = FoswikiHeadlinesPlugin/2.21.2
</verbatim>

* Default header: (variables are explained in the syntax rules)
Expand Down Expand Up @@ -179,6 +179,7 @@ Check if above examples show a news feed instead of variable.
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- specify latest version first -->&nbsp; |
| 09 Mar 2010: | can now use =0= properly with =HEADLINESPLUGIN_REFRESH=, =HEADLINESPLUGIN_LIMIT=, =HEADLINESPLUGIN_USERAGENTTIMEOUT= |
| 08 Mar 2009: | Ported without changes to Foswiki namespace by Kenneth Lavrsen and put under "Feel Free To Modify" in Foswiki context. |
| 12 Feb 2009: | {PROXY}{HOST} supports domain with and without protocol -- Peter Thoeny |
| 06 Feb 2009: | added {PROXY}{SkipProxyForDomains} configure setting, added USERAGENTNAME plugin setting -- Peter Thoeny |
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/HeadlinesPlugin.pm
Expand Up @@ -31,7 +31,7 @@ use strict;
use vars qw($VERSION $RELEASE $isInitialized $doneHeader);

$VERSION = '$Rev$';
$RELEASE = '2.21.1';
$RELEASE = '2.21.2';

# =========================
sub initPlugin {
Expand Down
12 changes: 7 additions & 5 deletions lib/Foswiki/Plugins/HeadlinesPlugin/Core.pm
Expand Up @@ -3,7 +3,7 @@
# Copyright (C) 2002-2006 Peter Thoeny, peter@thoeny.org
# Copyright (C) 2005-2006 Michael Daum <micha@nats.informatik.uni-hamburg.de>
# Copyright (C) 2005 TWiki Contributors
# Copyright (C) 2009 Foswiki Contributors
# Copyright (C) 2009,2010 Foswiki Contributors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -305,16 +305,18 @@ sub doInit {
$isInitialized = 1;

# Get plugin preferences
$defaultRefresh = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_REFRESH') || 60;
$defaultLimit = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_LIMIT') || 100;
$defaultRefresh = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_REFRESH');
$defaultRefresh = 60 unless length $defaultRefresh;
$defaultLimit = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_LIMIT');
$defaultLimit = 100 unless length $defaultLimit;
$defaultHeader = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_HEADER') ||
'| *[[$link][$title ]]* |';
$defaultFormat = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_FORMAT') ||
'| [[$link][$title]] |';
$useLWPUserAgent = Foswiki::Func::getPreferencesValue('HEADLINESPLUGIN_USELWPUSERAGENT')
|| 'on';
$userAgentTimeout = Foswiki::Func::getPreferencesValue("HEADLINESPLUGIN_USERAGENTTIMEOUT")
|| 20;
$userAgentTimeout = Foswiki::Func::getPreferencesValue("HEADLINESPLUGIN_USERAGENTTIMEOUT");
$userAgentTimeout = 20 unless length $userAgentTimeout;
$userAgentName = Foswiki::Func::getPreferencesValue("HEADLINESPLUGIN_USERAGENTNAME") ||
'FoswikiHeadlinesPlugin/' . $Foswiki::Plugins::HeadlinesPlugin::RELEASE;

Expand Down

0 comments on commit a200aed

Please sign in to comment.