Make WordPress Core

Ticket #11390: press-this-fix-entities.patch

File press-this-fix-entities.patch, 1.6 KB (added by noel, 15 years ago)

fixes entities and titles

  • wp-admin/press-this.php

     
    4343        // define some basic variables
    4444        $quick['post_status'] = 'draft'; // set as draft first
    4545        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
    46         $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : '';
    47         $quick['post_title'] = isset($_POST['title']) ? $_POST['title'] : '';
    48         $quick['post_content'] = '';
     46        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
     47        $quick['post_title'] = ( trim($_POST['title']) != '' ) ? $_POST['title'] : '  ';
     48        $quick['post_content'] = isset($_POST['post_content']) ? $_POST['post_content'] : '';
    4949
    5050        // insert the post with nothing in it, to get an ID
    5151        $post_ID = wp_insert_post($quick, true);
     
    6868        $quick['post_content'] = $content;
    6969        // error handling for $post
    7070        if ( is_wp_error($post_ID)) {
     71                wp_delete_post($post_ID);
    7172                wp_die($id);
    72                 wp_delete_post($post_ID);
    7373        // error handling for media_sideload
    7474        } elseif ( is_wp_error($upload)) {
     75                wp_delete_post($post_ID);
    7576                wp_die($upload);
    76                 wp_delete_post($post_ID);
    7777        } else {
    7878                $quick['ID'] = $post_ID;
    7979                wp_update_post($quick);
     
    9797        $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
    9898        $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
    9999}
     100$selection = html_entity_decode($selection);
    100101
    101102$url = isset($_GET['u']) ? esc_url($_GET['u']) : '';
    102103$image = isset($_GET['i']) ? $_GET['i'] : '';