/* Author URI: http://ottodestruct.com */ class PHP_Code_Widget extends WP_Widget { function __construct() { load_plugin_textdomain( 'php-code-widget', false, dirname( plugin_basename( __FILE__ ) ) ); $widget_ops = array('classname' => 'widget_execphp', 'description' => __('Arbitrary text, HTML, or PHP Code', 'php-code-widget')); $control_ops = array('width' => 400, 'height' => 350); parent::__construct('execphp', __('PHP Code', 'php-code-widget'), $widget_ops, $control_ops); } function widget( $args, $instance ) { extract($args); $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance ); $text = apply_filters( 'widget_execphp', $instance['text'], $instance ); echo $before_widget; if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ob_start(); eval('?>'.$text); $text = ob_get_contents(); ob_end_clean(); ?>
'', 'text' => '' ) ); $title = strip_tags($instance['title']); $text = format_to_edit($instance['text']); ?>

/>