[wellwell-devel] [wellwell/zoom] Add link filter module and filters to Zoom component module.

Stefan Hornburg wellwell-devel at rt.icdevgroup.org
Tue Nov 2 08:03:10 UTC 2010


commit f99115550dffb629040e038227a929a9c89f2637
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Mon Nov 1 12:45:05 2010 +0100

    Add link filter module and filters to Zoom component module.

 lib/WellWell/Compose/Component/Zoom.pm |   12 ++++++++--
 lib/WellWell/Filter/Link.pm            |   34 ++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/lib/WellWell/Compose/Component/Zoom.pm b/lib/WellWell/Compose/Component/Zoom.pm
index 72d8d29..cb5de05 100644
--- a/lib/WellWell/Compose/Component/Zoom.pm
+++ b/lib/WellWell/Compose/Component/Zoom.pm
@@ -26,6 +26,8 @@ use Template::Zoom;
 use Template::Zoom::Specification::XML;
 use Template::Zoom::HTML;
 
+use WellWell::Filter::Link;
+
 sub new {
 	my ($class, @parms) = @_;
 
@@ -39,6 +41,7 @@ sub new {
 sub process {
 	my ($self, $attributes) = @_;
 	my ($content, $xml_spec, $spec, $iter_name, $html_object, $zoom);
+	my (%filters);
 
 	# parse specification
 	$xml_spec = new Template::Zoom::Specification::XML;
@@ -57,10 +60,13 @@ sub process {
 		$list_object->input($attributes);
 	}
 
-	$zoom = new Template::Zoom (template => $html_object, dbh => $self->{dbh});
+	# filters
+	$filters{link} = \&WellWell::Filter::Link::filter;
+		
+	$zoom = new Template::Zoom (template => $html_object, filters => \%filters,
+								dbh => $self->{dbh});
 
 	return $zoom->process($attributes);
-
 }
-			
+
 1;
diff --git a/lib/WellWell/Filter/Link.pm b/lib/WellWell/Filter/Link.pm
new file mode 100644
index 0000000..2f9ac31
--- /dev/null
+++ b/lib/WellWell/Filter/Link.pm
@@ -0,0 +1,34 @@
+# WellWell::Filter::Link - WellWell link filter
+#
+# Copyright (C) 2010 Stefan Hornburg (Racke) <racke at linuxia.de>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package WellWell::Filter::Link;
+
+use strict;
+use warnings;
+
+use Vend::Util;
+
+sub filter {
+	my ($url) = @_;
+	my $link;
+
+	$link = vendUrl($url);
+}
+
+1;



More information about the wellwell-devel mailing list