All pastes #568543 Raw Edit

MellerTime

public php v1 · immutable
·published 2007-06-15 16:14 UTC
rendered paste body
<?php/*Plugin Name: Test Plugin*/function custom_twidget_widget($args) {	extract($args);	$options = get_option('twidget_widget');		if ( empty($options['title']) ) {		$title = __('Twidget Widget');	}	else {		$title = $options['title'];	}		echo $before_widget . $before_title . $title . $after_title . $options['text'] . $after_widget . "\n";	}function custom_twidget_widget_control() {	$options = $newoptions = get_option('twidget_widget');	if ( $_POST["twidget_widget-submit"] ) {				$newoptions['title'] = strip_tags(stripslashes($_POST["twidget_widget-title"]));		$newoptions['text'] = stripslashes($_POST['twidget_widget-text']);		}		if ( $options != $newoptions ) {				$options = $newoptions;				update_option('twidget_widget', $options);			}		$title = attribute_escape($options['title']);	$text = attribute_escape($options['text']);	?>			<p><label for="twidget_widget-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="twidget_widget-title" name="twidget_widget-title" type="text" value="<?php echo $title; ?>" /></label></p>			<p><label for="twidget_widget-text"><?php _e('Text:'); ?> <textarea style="widget: 250px;" id="twidget_widget-text" name="twidget_widget-text"><?php echo $text; ?></textarea></label></p>			<input type="hidden" id="twidget_widget-submit" name="twidget_widget-submit" value="1" /><?php}function register_twidget_widget ( ) {	wp_register_sidebar_widget('twidget_widget', __('Twidget Widget'), 'custom_twidget_widget');	wp_register_widget_control('twidget_widget', __('Twidget Widget'), 'custom_twidget_widget_control');}add_action('init', 'register_twidget_widget');?>