Welcome, visitor! Log in
 

Source View: widget_text

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
392      function __construct() {
393           $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
394           $control_ops = array('width' => 400, 'height' => 350);
395           parent::__construct('text', __('Text'), $widget_ops, $control_ops);
396      }
397
398      function widget( $args, $instance ) {
399           extract($args);
400           $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
401           $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
402           echo $before_widget;
403           if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
404                <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
405           <?php
406           echo $after_widget;
407      }
408
409      function update( $new_instance, $old_instance ) {
410           $instance = $old_instance;