Making WordPress.org


Ignore:
Timestamp:
10/28/2014 08:26:25 PM (9 years ago)
Author:
coffee2code
Message:

Code Reference: display parsed content in the reference-editing screen for all editors

fixes #679.
props DrewAPicture.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/parsed-content.php

    r831 r942  
    5353     */
    5454    public function add_meta_boxes() {
    55         if ( in_array( $screen = get_current_screen()->id, $this->post_types ) && current_user_can( 'manage_options' ) ) {
     55        if ( in_array( $screen = get_current_screen()->id, $this->post_types ) ) {
    5656            remove_meta_box( 'postexcerpt', $screen, 'normal' );
    57             add_meta_box( 'wporg_parsed_content', __( 'Manage Parsed Content', 'wporg' ), array( $this, 'parsed_meta_box_cb' ), $screen, 'normal' );
     57            add_meta_box( 'wporg_parsed_content', __( 'Parsed Content', 'wporg' ), array( $this, 'parsed_meta_box_cb' ), $screen, 'normal' );
    5858        }
    5959    }
     
    8383        <table class="form-table">
    8484            <tbody>
    85             <tr valign="top" id="ticket_controls">
    86                 <th scope="row">
    87                     <label for="wporg_parsed_ticket"><?php _e( 'Trac Ticket Number:', 'wporg' ); ?></label>
    88                 </th>
    89                 <td>
    90                     <span class="attachment_controls">
    91                         <input type="text" name="wporg_parsed_ticket" id="wporg_parsed_ticket" value="<?php echo esc_attr( $ticket ); ?>" />
    92                         <a href="#attach-ticket" class="button secondary <?php echo $ticket ? 'hidden' : ''; ?>" id="wporg_ticket_attach" name="wporg_ticket_attach" aria-label="<?php esc_attr_e( 'Attach a Core Trac ticket', 'wporg' ); ?>" data-nonce="<?php echo wp_create_nonce( 'wporg-attach-ticket' ); ?>" data-id="<?php the_ID(); ?>">
    93                             <?php esc_attr_e( 'Attach Ticket', 'wporg' ); ?>
    94                         </a>
    95                         <a href="#detach-ticket" class="button secondary <?php echo $ticket ? '' : 'hidden'; ?>" id="wporg_ticket_detach" name="wporg_ticket_detach" aria-label="<?php esc_attr_e( 'Detach the Trac ticket', 'wporg' ); ?>" data-nonce="<?php echo wp_create_nonce( 'wporg-detach-ticket' ); ?>" data-id="<?php the_ID(); ?>">
    96                             <?php esc_attr_e( 'Detach Ticket', 'wporg' ); ?>
    97                         </a>
    98                     </span>
    99                     <div id="ticket_status">
    100                         <span class="spinner"></span>
    101                         <span class="ticket_info_icon <?php echo $ticket ? 'dashicons dashicons-external' : ''; ?>"></span>
    102                         <span id="wporg_ticket_info"><em><?php echo $ticket_message; ?></em></span>
    103                     </div>
    104                 </td>
    105             </tr><!-- #ticket_controls -->
    106             <tr valign="top" class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>">
     85            <tr valign="top">
    10786                <th scope="row">
    10887                    <label for="excerpt"><?php _e( 'Parsed Description:', 'wporg' ); ?></label>
    10988                </th>
    11089                <td>
    111                     <textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; ?></textarea>
     90                    <div class="wporg_parsed_readonly <?php echo $ticket ? 'hidden' : ''; ?>"><?php echo apply_filters( 'the_content', $post->post_excerpt ); ?></div>
     91                    <textarea rows="1" cols="40" name="excerpt" id="excerpt" class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>"><?php echo $post->post_excerpt; ?></textarea>
    11292                </td>
    11393            </tr><!-- .wporg_parsed_content -->
    114             <tr valign="top" class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>" data-id="<?php the_id(); ?>">
     94            <tr valign="top" data-id="<?php the_id(); ?>">
    11595                <th scope="row">
    11696                    <label for="wporg_parsed_content"><?php _e( 'Parsed Summary:', 'wporg' ); ?></label>
    11797                </th>
    11898                <td>
    119                     <?php wp_editor( $content, 'wporg_parsed_content_editor', array(
    120                         'media_buttons' => false,
    121                         'tinymce'       => false,
    122                         'quicktags'     => true,
    123                         'textarea_rows' => 10,
    124                         'textarea_name' => 'wporg_parsed_content'
    125                     ) ); ?>
     99                    <div class="wporg_parsed_readonly <?php echo $ticket ? 'hidden' : ''; ?>"><?php echo apply_filters( 'the_content', $content ); ?></div>
     100                    <div class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>">
     101                        <?php wp_editor( $content, 'wporg_parsed_content_editor', array(
     102                            'media_buttons' => false,
     103                            'tinymce'       => false,
     104                            'quicktags'     => true,
     105                            'textarea_rows' => 10,
     106                            'textarea_name' => 'wporg_parsed_content',
     107                        ) ); ?>
     108                    </div>
    126109                </td>
    127110            </tr><!-- .wporg_parsed_content -->
     111            <?php if ( current_user_can( 'manage_options' ) ) : ?>
     112                <tr valign="top" id="ticket_controls">
     113                    <th scope="row">
     114                        <label for="wporg_parsed_ticket"><?php _e( 'Trac Ticket Number:', 'wporg' ); ?></label>
     115                    </th>
     116                    <td>
     117                        <span class="attachment_controls">
     118                            <input type="text" name="wporg_parsed_ticket" id="wporg_parsed_ticket" value="<?php echo esc_attr( $ticket ); ?>" />
     119                            <a href="#attach-ticket" class="button secondary <?php echo $ticket ? 'hidden' : ''; ?>" id="wporg_ticket_attach" name="wporg_ticket_attach" aria-label="<?php esc_attr_e( 'Attach a Core Trac ticket', 'wporg' ); ?>" data-nonce="<?php echo wp_create_nonce( 'wporg-attach-ticket' ); ?>" data-id="<?php the_ID(); ?>">
     120                                <?php esc_attr_e( 'Attach Ticket', 'wporg' ); ?>
     121                            </a>
     122                            <a href="#detach-ticket" class="button secondary <?php echo $ticket ? '' : 'hidden'; ?>" id="wporg_ticket_detach" name="wporg_ticket_detach" aria-label="<?php esc_attr_e( 'Detach the Trac ticket', 'wporg' ); ?>" data-nonce="<?php echo wp_create_nonce( 'wporg-detach-ticket' ); ?>" data-id="<?php the_ID(); ?>">
     123                                <?php esc_attr_e( 'Detach Ticket', 'wporg' ); ?>
     124                            </a>
     125                        </span>
     126                        <div id="ticket_status">
     127                            <span class="spinner"></span>
     128                            <span class="ticket_info_icon <?php echo $ticket ? 'dashicons dashicons-external' : ''; ?>"></span>
     129                            <span id="wporg_ticket_info"><em><?php echo $ticket_message; ?></em></span>
     130                        </div>
     131                    </td>
     132                </tr><!-- #ticket_controls -->
     133            <?php endif; // Admin-only controls ?>
    128134            </tbody>
    129135        </table>
Note: See TracChangeset for help on using the changeset viewer.