All pastes #569362 Raw Edit

twidget

public php v1 · immutable
·published 2007-06-16 04:28 UTC
rendered paste body
<?php/*Plugin Name: AWeber Opt-In FormPlugin URI: http://four-oh.comDescription: A <a href="http://wordpress.org">WordPress</a> <a href="http://automattic.com/code/widgets/">widget</a> to display an <a href="http://www.aweber.com/">AWeber</a> opt-in form.Author: Charles StricklinVersion: 1.0dAuthor URI: http://charlesstricklin.comMucho, mucho thanks to Chris Meller <http://incoherentbabble.com> for his help.Released under the GNU General Public License (GPL)http://www.gnu.org/licenses/gpl.txt*/function custom_aweber_widget($args) {	extract($args);	$options = get_option('aweber_widget');	echo $before_widget . $before_title . $options['title'] . $after_title . $options['text'] . $after_widget . "\n";	}function custom_aweber_widget_control() {		$options = $newoptions = get_option('aweber_widget');	if ( $_POST["aweber_widget-submit"] ) {		$newoptions['title'] = strip_tags(stripslashes($_POST["aweber_widget-title"]));		$newoptions['text'] = stripslashes($_POST['aweber_widget-text']);		$newoptions['form'] = stripslashes($_POST['aweber_widget-form']);		$newoptions['disclaimer'] = stripslashes($_POST['aweber_widget-disclaimer']);	}		if ( $options != $newoptions ) {		$options = $newoptions;		update_option('aweber_widget', $options);	}		$title = attribute_escape($options['title']);	$text = attribute_escape($options['text']);	$form = attribute_escape($options['form']);	$disclaimer = attribute_escape($options['disclaimer']);	?><table width="100%" cellspacing="2" cellpadding="5">	<tbody>		<tr>			<th scope="row" valign="top" style="text-align: right;"><label for="aweber_widget-title"><?php _e('Title:'); ?></label></th>			<td>				<textarea style="width: 200px;" id="aweber_widget-title" name="aweber_widget-title"><?php echo $title; ?></textarea>			</td>		</tr>		<tr>			<th scope="row" valign="top" style="text-align: right;"><label for="aweber_widget-text"><?php _e('Description:'); ?></label></th>			<td>				<textarea style="width: 200px;" id="aweber_widget-text" name="aweber_widget-text"><?php echo $text; ?></textarea>			</td>		</tr>		<tr>			<th scope="row" valign="top" style="text-align: right;"><label for="aweber_widget-form"><?php _e('AWeber HTML Form:'); ?></label></th>			<td>				<textarea style="width: 200px;" id="aweber_widget-form" name="aweber_widget-form"><?php echo $form; ?></textarea>			</td>		</tr>		<tr>			<th scope="row" valign="top" style="text-align: right;"><label for="aweber_widget-disclaimer"><?php _e('Disclaimer:'); ?></label></th>			<td>				<textarea style="width: 200px;" id="aweber_widget-disclaimer" name="aweber_widget-disclaimer"><?php echo $disclaimer; ?></textarea>			</td>		</tr>	</tbody></table>	<input type="hidden" id="aweber_widget-submit" name="aweber_widget-submit" value="1" /><?php}function register_aweber_widget ( ) {	wp_register_sidebar_widget('aweber_widget', __('AWeber Widget'), 'custom_aweber_widget');	wp_register_widget_control('aweber_widget', __('AWeber Widget'), 'custom_aweber_widget_control', array('height'=>300, 'width'=>400));}add_action('init', 'register_aweber_widget');?>