From 563b924d21a02faa60409d21cc6ec1fd2740347c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 9 Nov 2013 22:14:46 +0100 Subject: [PATCH] Remove unused plugin. --- .../pterodactylus/sone/template/GetPagePlugin.java | 62 ---------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java diff --git a/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java b/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java deleted file mode 100644 index f79b06e..0000000 --- a/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Sone - GetPagePlugin.java - Copyright © 2010–2013 David Roden - * - * 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 3 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, see . - */ - -package net.pterodactylus.sone.template; - -import java.util.Map; - -import net.pterodactylus.sone.web.page.FreenetRequest; -import net.pterodactylus.util.template.Plugin; -import net.pterodactylus.util.template.TemplateContext; -import net.pterodactylus.util.web.Request; - -/** - * Extracts a page number from a {@link Request}’s parameters and stores it in - * the {@link TemplateContext}. - * - * @author David ‘Bombe’ Roden - */ -public class GetPagePlugin implements Plugin { - - @Override - public void execute(TemplateContext templateContext, Map parameters) { - String requestKey = parameters.get("request"); - String parameter = parameters.get("parameter"); - String pageKey = parameters.get("key"); - - if (requestKey == null) { - requestKey = "request"; - } - if (parameter == null) { - parameter = "page"; - } - if (pageKey == null) { - pageKey = "page"; - } - - FreenetRequest request = (FreenetRequest) templateContext.get(requestKey); - String pageString = request.getHttpRequest().getParam(parameter); - int page = 0; - try { - page = Integer.parseInt(pageString); - } catch (NumberFormatException nfe1) { - /* ignore. */ - } - templateContext.set(pageKey, page); - } - -} -- 2.7.4