Make WordPress Core

Ticket #5113: text-widget.diff

File text-widget.diff, 1.9 KB (added by Denis-de-Bernardy, 19 years ago)
  • widgets.php

     
    532532        $options = get_option('widget_text');
    533533        $title = $options[$number]['title'];
    534534        $text = apply_filters( 'widget_text', $options[$number]['text'] );
     535        $text = $options[$number]['filter'] ? wpautop($text) : $text;
    535536?>
    536537                <?php echo $before_widget; ?>
    537538                        <?php if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
     
    547548        if ( $_POST["text-submit-$number"] ) {
    548549                $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["text-title-$number"]));
    549550                $newoptions[$number]['text'] = stripslashes($_POST["text-text-$number"]);
     551                $newoptions[$number]['filter'] = isset($_POST["text-filter-$number"]);
    550552                if ( !current_user_can('unfiltered_html') )
    551553                        $newoptions[$number]['text'] = stripslashes(wp_filter_post_kses($newoptions[$number]['text']));
    552554        }
     
    556558        }
    557559        $title = attribute_escape($options[$number]['title']);
    558560        $text = format_to_edit($options[$number]['text']);
     561        $filter = (bool) $options[$number]['filter'];
    559562?>
    560563                        <input style="width: 450px;" id="text-title-<?php echo $number; ?>" name="text-title-<?php echo $number; ?>" type="text" value="<?php echo $title; ?>" />
    561564                        <textarea style="width: 450px; height: 280px;" id="text-text-<?php echo $number; ?>" name="text-text-<?php echo $number; ?>"><?php echo $text; ?></textarea>
     565                        <label for="text-filter-<?php echo "$number"; ?>"><input type="checkbox" id="text-filter-<?php echo "$number"; ?>" name="text-filter-<?php echo "$number"; ?>" id="text-filter-<?php echo "$number"; ?>" <?php echo $filter ? "checked" : ""; ?> />&nbsp;<?php _e('Automatically insert paragraphs'); ?>
    562566                        <input type="hidden" id="text-submit-<?php echo "$number"; ?>" name="text-submit-<?php echo "$number"; ?>" value="1" />
    563567<?php
    564568}