Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Unfiltered Text Widget
<?php # -*- coding: utf-8 -*-
/**
* Simplified variant of the native text widget class.
*
* Usage:
* add_action( 'widgets_init', array ( 'Unfiltered_Text_Widget', 'register' ), 20 );
*
* @author Thomas Scholz aka toscho http://toscho.de
* @version 2012.01.05
*/
class Unfiltered_Text_Widget extends WP_Widget
{
/**
* Constructor.
*/
public function __construct()
{
parent::__construct(
'unfiltered_text'
, __( 'Unfiltered Text', 't5_theme' )
, array( 'description' => __( 'Pure Markup', 't5_theme' ) )
, array( 'width' => 300, 'height' => 150 )
);
}
/**
* Output.
*
* @param array $args
* @param array $instance
* @return void
*/
public function widget( $args, $instance )
{
echo $instance['text'];
}
/**
* Prepares the content. Not.
*
* @param array $new_instance New content
* @param array $old_instance Old content
* @return array New content
*/
public function update( $new_instance, $old_instance )
{
return $new_instance;
}
/**
* Backend form.
*
* @param array $instance
* @return void
*/
public function form( $instance )
{
$instance = wp_parse_args( (array) $instance, array( 'text' => '' ) );
$text = esc_textarea( $instance['text'] );
?>
<textarea class="widefat" rows="7" cols="20" id="<?php
echo $this->get_field_id( 'text' );
?>" name="<?php
echo $this->get_field_name( 'text' );
?>"><?php
echo $text;
?></textarea>
<?php
}
/**
* Registers this widget.
*
* @return void
*/
public static function register()
{
register_widget( __CLASS__ );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.