Ticket #15795: 15795.2.diff

File 15795.2.diff, 2.2 KB (added by nacin, 2 years ago)

Fixing some self-closed option elements.

Line 
1Index: wp-admin/press-this.php
2===================================================================
3--- wp-admin/press-this.php     (revision 17041)
4+++ wp-admin/press-this.php     (working copy)
5@@ -27,6 +27,7 @@
6  */
7 function press_it() {
8        // define some basic variables
9+       $quick = array();
10        $quick['post_status'] = 'draft'; // set as draft first
11        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
12        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
13@@ -64,6 +65,19 @@
14        } else {
15                $quick['ID'] = $post_ID;
16                wp_update_post($quick);
17+
18+               // Post formats
19+               if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) {
20+                       $post_formats = get_theme_support( 'post-formats' );
21+                       if ( is_array( $post_formats ) ) {
22+                               $post_formats = $post_formats[0];
23+                               if ( in_array( $_POST['post_format'], $post_formats ) )
24+                                       set_post_format( $post_ID, $_POST['post_format'] );
25+                               elseif ( '0' == $_POST['post_format'] )
26+                                       set_post_format( $post_ID, false );
27+                       }
28+               }
29+
30        }
31        return $post_ID;
32 }
33@@ -468,10 +482,6 @@
34                        <div class="photolist"></div>
35 
36                        <div id="submitdiv" class="stuffbox">
37-                               <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>">
38-                                       <br/>
39-                               </div>
40-                               <h3><?php _e('Publish') ?></h3>
41                                <div class="inside">
42                                        <p>
43                                        <?php
44@@ -484,6 +494,20 @@
45                                                } ?>
46                                                <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" id="saving" style="display:none;" />
47                                        </p>
48+                                       <?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) :
49+                                                       $post_formats = get_theme_support( 'post-formats' );
50+                                                       if ( is_array( $post_formats[0] ) ) :
51+                                               ?>
52+                                       <p>
53+                                               <label for="post_format"><?php _e( 'Post Format:' ); ?>
54+                                               <select name="post_format" id="post_format">
55+                                                       <option value="0"><?php _e( 'Standard' ); ?></option>
56+                                               <?php foreach ( $post_formats[0] as $format ): ?>
57+                                                       <option value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option>
58+                                               <?php endforeach; ?>
59+                                               </select></label>
60+                                       </p>
61+                                       <?php endif; endif; ?>
62                                </div>
63                        </div>
64