/* * [Donate.java] * * Summary: Generate a PayPal request for donation. * * Copyright: (c) 2011-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2011-02-11 initial version */ package com.mindprod.htmlmacros.macro; import com.mindprod.fastcat.FastCat; import com.mindprod.htmlmacros.support.Tools; import static java.lang.System.*; /** * Generate a PayPal request for donation. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2011-02-11 initial version * @since 2011-02-11 */ public final class Donate extends Macro { /** * amount donated so for to all glossaries. */ private static final String DONATED_SO_FAR = "$1989.00 US"; /** * how to use the macro */ private static final String USAGE = "\nDonate macro needs glossaryName payPalButtonId"; /** * Expand Donate macro * * @param glossaryName name of glossary the donation supports, also "CMP Utilities" * @param payPalButtonId code to index information about the button stored on PayPal website. * Encodes the glossary name for PayPal. * * @return expanded macro HTML */ private String expand( final String glossaryName, final String payPalButtonId ) { final FastCat sb = new FastCat(); sb.append( "
\n" ); sb.append( "\n" ); sb.append( "\n" ); sb.append( "\n" ); // this is slowing page loads down // sb.append( "\"impression\n" ); // impression counter sb.append( "" ); sb.append( DONATED_SO_FAR ); sb.append( " donated so far. If the " ); sb.append( glossaryName ); sb.append( " solved your problem, please donate a buck or two,\n" ); sb.append( "or donate to one of the charities featured in the footer public service ads\n" ); sb.append( "throughout the website and get a tax receipt.\n" ); sb.append( "
" ); return sb.toString(); } // end expandNoRef /** * Generate a PayPal payment request * * @param parms show currency amount level. * @param quiet true if want output suppressed. * @param verbose @return expanded macro HTML */ public String expandMacro( String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "D" ); } if ( parms.length != 2 ) { throw new IllegalArgumentException( USAGE ); } final String glossaryName = parms[ 0 ]; final String payPalButtonId = parms[ 1 ]; return expand( glossaryName, payPalButtonId ); } // Raw what PayPal wants: //
// // // // //
}