From 91e79715e57a3348607451cdc240be99cb0773de Mon Sep 17 00:00:00 2001 From: OlivierRaginel Date: Fri, 4 May 2012 13:27:49 +0000 Subject: [PATCH] Item11808: perltidy them all, so people are not accidentally impacted by the new enforced rule -- Sorry Micha, could not find a way to define specific values within the file git-svn-id: http://svn.foswiki.org/trunk/EmbedPlugin@14686 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- lib/TWiki/Plugins/EmbedPlugin.pm | 66 +++++++++++++++++--------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/lib/TWiki/Plugins/EmbedPlugin.pm b/lib/TWiki/Plugins/EmbedPlugin.pm index b8f1ea1..5107909 100755 --- a/lib/TWiki/Plugins/EmbedPlugin.pm +++ b/lib/TWiki/Plugins/EmbedPlugin.pm @@ -11,7 +11,7 @@ # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details, published at +# GNU General Public License for more details, published at # http://www.gnu.org/copyleft/gpl.html # # ========================= @@ -37,24 +37,24 @@ # getSessionValueHandler ( $key ) 1.010 Use only in one Plugin # setSessionValueHandler ( $key, $value ) 1.010 Use only in one Plugin # -# initPlugin is required, all other are optional. +# initPlugin is required, all other are optional. # For increased performance, all handlers except initPlugin are # disabled. To enable a handler remove the leading DISABLE_ from # the function name. Remove disabled handlers you do not need. # -# NOTE: To interact with TWiki use the official TWiki functions +# NOTE: To interact with TWiki use the official TWiki functions # in the TWiki::Func module. Do not reference any functions or # variables elsewhere in TWiki!! - # ========================= -package TWiki::Plugins::EmbedPlugin; # change the package name and $pluginName!!! +package TWiki::Plugins::EmbedPlugin + ; # change the package name and $pluginName!!! # ========================= use vars qw( - $web $topic $user $installWeb $VERSION $RELEASE $pluginName - $debug $exampleCfgVar - ); + $web $topic $user $installWeb $VERSION $RELEASE $pluginName + $debug $exampleCfgVar +); # This should always be $Rev$ so that TWiki can determine the checked-in # status of the plugin. It is used by the build automation tools, so @@ -66,36 +66,39 @@ $VERSION = '$Rev$'; # of the version number in PLUGINDESCRIPTIONS. $RELEASE = 'Dakar'; -$pluginName = 'EmbedPlugin'; # Name of this Plugin +$pluginName = 'EmbedPlugin'; # Name of this Plugin # ========================= -sub initPlugin -{ +sub initPlugin { ( $topic, $web, $user, $installWeb ) = @_; # check for Plugins.pm versions - if( $TWiki::Plugins::VERSION < 1 ) { - TWiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm" ); + if ( $TWiki::Plugins::VERSION < 1 ) { + TWiki::Func::writeWarning( + "Version mismatch between $pluginName and Plugins.pm"); return 0; } # Get plugin debug flag - $debug = TWiki::Func::getPreferencesFlag( "\U$pluginName\E_DEBUG" ); + $debug = TWiki::Func::getPreferencesFlag("\U$pluginName\E_DEBUG"); - # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... - $exampleCfgVar = &TWiki::Func::getPreferencesValue( "EMPTYPLUGIN_EXAMPLE" ) || "default"; + # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... + $exampleCfgVar = &TWiki::Func::getPreferencesValue("EMPTYPLUGIN_EXAMPLE") + || "default"; # Plugin correctly initialized - TWiki::Func::writeDebug( "- TWiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug; + TWiki::Func::writeDebug( + "- TWiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK") + if $debug; return 1; } # ========================= -sub commonTagsHandler -{ +sub commonTagsHandler { ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead - TWiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug; + TWiki::Func::writeDebug("- ${pluginName}::commonTagsHandler( $_[2].$_[1] )") + if $debug; # This is the place to define customized tags and variables # Called by sub handleCommonTags, after %INCLUDE:"..."% @@ -108,15 +111,18 @@ sub commonTagsHandler } # ========================= -sub handleEmbed -{ - my ( $theAttributes ) = @_; - my $filename = &TWiki::Func::extractNameValuePair($theAttributes, "filename"); - my $width = &TWiki::Func::extractNameValuePair($theAttributes, "width") || 200; - my $height = &TWiki::Func::extractNameValuePair($theAttributes, "height") || 42; - my $autostart = &TWiki::Func::extractNameValuePair($theAttributes, "autostart") || 1; - - my $string =< EOM - $string =~ s/\n/ /g; # not allowed to have newlines else you get rendering + $string =~ s/\n/ /g; # not allowed to have newlines else you get rendering return $string; return "