Changeset 3852 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-preview.php
- Timestamp:
- 08/24/2016 08:22:35 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-preview.php
r3790 r3852 36 36 public static function scripts_and_styles() { 37 37 if ( is_singular() ) { 38 wp_enqueue_script( 'wporg-developer-preview', get_template_directory_uri() . '/js/user-notes-preview.js', array( 'jquery', 'quicktags', 'wporg-developer-function-reference' ), '20160809', true ); 38 wp_enqueue_script( 'wporg-developer-tabs', get_template_directory_uri() . '/js/tabs.js', array( 'jquery' ), '20160809', true ); 39 wp_enqueue_script( 'wporg-developer-preview', get_template_directory_uri() . '/js/user-notes-preview.js', array( 'jquery', 'wporg-developer-function-reference', 'wporg-developer-tabs' ), '20160809', true ); 39 40 wp_localize_script( 'wporg-developer-preview', 'wporg_note_preview', array( 40 'ajaxurl' => admin_url( 'admin-ajax.php' ), 41 'nonce' => wp_create_nonce( 'preview_nonce' ), 42 'preview' => __( 'preview note', 'wporg' ), 41 'ajaxurl' => admin_url( 'admin-ajax.php' ), 42 'nonce' => wp_create_nonce( 'preview_nonce' ), 43 'preview' => __( 'preview note', 'wporg' ), 44 'preview_empty' => __( 'Nothing to preview', 'wporg' ), 45 'is_admin' => is_admin(), 43 46 ) ); 44 47 } … … 55 58 } 56 59 57 $comment = apply_filters( 'pre_comment_content', $_POST['preview_comment'] );60 $comment = apply_filters( 'pre_comment_content', $_POST['preview_comment'] ); 58 61 $comment = wp_unslash( $comment ); 59 62 $comment = apply_filters( 'get_comment_text', $comment ); 60 $comment = apply_filters( 'comment_text', $comment ); 63 $comment = apply_filters( 'comment_text', $comment ); 61 64 62 65 wp_send_json_success( array( 'comment' => $comment ) ); 63 66 } 67 68 /** 69 * Captures the comment-preview markup displayed (and populated) below the Add Note form. 70 * 71 * @access public 72 * @static 73 * 74 * @return string Comment preview HTML markup. 75 */ 76 public static function comment_preview() { 77 if ( ! class_exists( 'DevHub_Note_Preview' ) ) { 78 return ''; 79 } 80 81 ob_start(); 82 ?> 83 <div id='comment-preview' class='tab-section comment byuser depth-1 comment-preview' aria-hidden="true"> 84 <article class='preview-body comment-body'> 85 <div class='preview-content comment-content'></div> 86 </article> 87 </div> 88 <?php 89 90 return ob_get_clean(); 91 } 64 92 } 65 93 66 67 94 DevHub_Note_Preview::init(); 68
Note: See TracChangeset
for help on using the changeset viewer.