From: David ‘Bombe’ Roden Date: Sat, 9 Nov 2013 21:14:46 +0000 (+0100) Subject: Remove unused plugin. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=563b924d21a02faa60409d21cc6ec1fd2740347c;p=Sone.git Remove unused plugin. --- 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); - } - -}