Making WordPress.org

Changeset 12053


Ignore:
Timestamp:
09/05/2022 08:21:02 PM (4 years ago)
Author:
iandunn
Message:

Developer: Sync with Git 41e97d9

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
1 added
6 deleted
8 edited

Legend:

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

    r7817 r12053  
    2323        public static function do_init() {
    2424                add_action( 'admin_enqueue_scripts', [ __CLASS__, 'admin_enqueue_scripts' ] );
    25        
     25
    2626                add_action( 'comment_author', [ __CLASS__, 'append_user_nicename' ], 10, 2 );
    2727
     
    3131
    3232                        // Reset votes after editing a comment in the wp-admin.
    33                         add_filter( 'comment_edit_redirect',  [ __CLASS__, 'comment_edit_redirect'], 10, 2 );
     33                        add_filter( 'comment_edit_redirect', [ __CLASS__, 'comment_edit_redirect' ], 10, 2 );
    3434                }
    3535        }
     
    6767                 */
    6868                if ( (bool) apply_filters( 'devhub-admin_enqueue_scripts', in_array( get_current_screen()->id, $screen_ids ) ) ) {
    69                         wp_enqueue_style( 'wporg-admin', get_template_directory_uri() . '/stylesheets/admin.css', [], '20181101' );
     69                        wp_enqueue_style(
     70                                'wporg-admin',
     71                                get_template_directory_uri() . '/stylesheets/admin.css',
     72                                [],
     73                                filemtime( dirname( __DIR__ ) . '/stylesheets/admin.css' ),
     74                        );
    7075                }
    7176        }
     
    8590                if ( $comment->user_id ) {
    8691                        $username = get_user_by( 'id', $comment->user_id )->user_nicename;
    87        
     92
    8893                        $author_name .= '</strong><div class="comment-author-nicename">@' . $username . '</div><strong>';
    8994                }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/autocomplete.php

    r12051 r12053  
    2222        public function init() {
    2323
    24                 add_action( 'wp_ajax_autocomplete',  array( $this, 'autocomplete_data_update' ) );
    25                 add_action( "wp_ajax_nopriv_autocomplete", array( $this, 'autocomplete_data_update' ) );
     24                add_action( 'wp_ajax_autocomplete', array( $this, 'autocomplete_data_update' ) );
     25                add_action( 'wp_ajax_nopriv_autocomplete', array( $this, 'autocomplete_data_update' ) );
    2626
    2727                // Enqueue scripts and styles.
     
    3737        public function scripts_and_styles() {
    3838
    39                 wp_enqueue_style( 'awesomplete-css', get_template_directory_uri() . '/stylesheets/awesomplete.css', array(), '20220905' );
    40                 wp_enqueue_style( 'autocomplete-css', get_template_directory_uri() . '/stylesheets/autocomplete.css', array(), '20220905' );
     39                wp_enqueue_style(
     40                        'awesomplete-css',
     41                        get_template_directory_uri() . '/stylesheets/awesomplete.css',
     42                        array(),
     43                        filemtime( dirname( __DIR__ ) . '/stylesheets/awesomplete.css' )
     44                );
     45                wp_enqueue_style(
     46                        'autocomplete-css',
     47                        get_template_directory_uri() . '/stylesheets/autocomplete.css',
     48                        array(),
     49                        filemtime( dirname( __DIR__ ) . '/stylesheets/autocomplete.css' )
     50                );
    4151
    42                 wp_register_script( 'awesomplete', get_template_directory_uri() . '/js/awesomplete.min.js', array(), '20220905', true );
     52                wp_register_script(
     53                        'awesomplete',
     54                        get_template_directory_uri() . '/js/awesomplete.min.js',
     55                        array(),
     56                        filemtime( dirname( __DIR__ ) . '/js/awesomplete.min.js' ),
     57                        true
     58                );
    4359                wp_enqueue_script( 'awesomplete' );
    4460
    4561                wp_register_script( 'autocomplete', get_stylesheet_directory_uri() . '/js/autocomplete.js', array( 'awesomplete' ), filemtime( dirname( __DIR__ ) . '/js/autocomplete.js' ), true );
    46                 wp_localize_script( 'autocomplete', 'autocomplete', array(
     62                wp_localize_script(
     63                        'autocomplete',
     64                        'autocomplete',
     65                        array(
    4766                                'ajaxurl' => admin_url( 'admin-ajax.php' ),
    4867                                'nonce'   => wp_create_nonce( 'autocomplete_nonce' ),
     
    7291                );
    7392
    74                 if ( !( isset( $_POST['data'] ) && $_POST['data'] ) ) {
     93                if ( ! ( isset( $_POST['data'] ) && $_POST['data'] ) ) {
    7594                        wp_send_json_error( $defaults );
    7695                }
     
    86105
    87106                foreach ( $form_data['post_type'] as $key => $post_type ) {
    88                         if ( !in_array( $post_type , $parser_post_types ) ) {
     107                        if ( ! in_array( $post_type, $parser_post_types ) ) {
    89108                                unset( $form_data['post_type'][ $key ] );
    90109                        }
    91110                }
    92111
    93                 $post_types = !empty( $form_data['post_type'] ) ? $form_data['post_type'] : $parser_post_types;
     112                $post_types = ! empty( $form_data['post_type'] ) ? $form_data['post_type'] : $parser_post_types;
    94113
    95114                $args = array(
     
    117136
    118137                                if ( $post->post_type == 'wp-parser-class' ) {
    119                                         $title =  'class ' . $title . ' {}';
     138                                        $title = 'class ' . $title . ' {}';
    120139                                }
    121140
     
    124143                }
    125144
    126                 wp_send_json_success ( $form_data );
     145                wp_send_json_success( $form_data );
    127146        }
    128147
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/customizer.php

    r9325 r12053  
    2222 */
    2323function wporg_developer_customize_preview_js() {
    24         wp_enqueue_script( 'wporg_developer_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
     24        wp_enqueue_script(
     25                'wporg_developer_customizer',
     26                get_template_directory_uri() . '/js/customizer.js',
     27                array( 'customize-preview' ),
     28                filemtime( dirname( __DIR__ ) . '/js/customizer.js' ),
     29                true
     30        );
    2531}
    2632add_action( 'customize_preview_init', 'wporg_developer_customize_preview_js' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/explanations.php

    r12030 r12053  
    144144                        $url = parse_url( $preview_link );
    145145                        $url_query = array();
    146                         parse_str ( $url['query'], $url_query );
     146                        parse_str( $url['query'], $url_query );
    147147
    148148                        $preview_link = get_preview_post_link(
     
    184184                                        $menu[ $i ][0] = sprintf(
    185185                                                __( 'Explanations %s', 'wporg' ),
    186                                                 "<span class='update-plugins count-{$count}'><span class='plugin-count'>" . number_format_i18n( $count ) . "</span></span>"
     186                                                "<span class='update-plugins count-{$count}'><span class='plugin-count'>" . number_format_i18n( $count ) . '</span></span>'
    187187                                        );
    188188                                        break;
     
    274274                                        <strong><?php _e( 'Associated with: ', 'wporg' ); ?></strong>
    275275                                        <?php
    276                                         printf( '<a href="%1$s">%2$s</a>',
     276                                        printf(
     277                                                '<a href="%1$s">%2$s</a>',
    277278                                                esc_url( get_permalink( $post->post_parent ) ),
    278279                                                str_replace( 'Explanation: ', '', get_the_title( $post->post_parent ) )
     
    357358                if ( in_array( $role, array( 'administrator', 'editor', 'expl_editor' ) ) ) {
    358359                        $base_caps = array(
    359                                 'edit_explanations', 'edit_others_explanations',
    360                                 'edit_published_explanations', 'edit_posts'
     360                                'edit_explanations',
     361                                'edit_others_explanations',
     362                                'edit_published_explanations',
     363                                'edit_posts',
    361364                        );
    362365
     
    367370                        $editor_caps = array(
    368371                                'publish_explanations',
    369                                 'delete_explanations', 'delete_others_explanations',
    370                                 'delete_published_explanations', 'delete_private_explanations',
    371                                 'edit_private_explanations', 'read_private_explanations'
     372                                'delete_explanations',
     373                                'delete_others_explanations',
     374                                'delete_published_explanations',
     375                                'delete_private_explanations',
     376                                'edit_private_explanations',
     377                                'read_private_explanations',
    372378                        );
    373379
     
    405411                        }
    406412
    407                         $expl_action['edit-expl'] = sprintf( '<a href="%1$s" alt="%2$s">%3$s</a>',
     413                        $expl_action['edit-expl'] = sprintf(
     414                                '<a href="%1$s" alt="%2$s">%3$s</a>',
    408415                                esc_url( get_edit_post_link( $expl->ID ) ),
    409416                                esc_attr__( 'Edit Explanation', 'wporg' ),
     
    411418                        );
    412419                } else {
    413                         $expl_action['add-expl'] = sprintf( '<a href="" class="create-expl" data-nonce="%1$s" data-id="%2$s">%3$s</a>',
     420                        $expl_action['add-expl'] = sprintf(
     421                                '<a href="" class="create-expl" data-nonce="%1$s" data-id="%2$s">%3$s</a>',
    414422                                esc_attr( wp_create_nonce( 'create-expl' ) ),
    415423                                esc_attr( $post->ID ),
     
    451459                                </a><!-- #create-explanation -->
    452460                        </span><!-- expl-row-actions -->
    453                 <?php
     461                        <?php
    454462                endif;
    455463        }
     
    468476                }
    469477
    470                 switch( $status = $post->post_status ) {
    471                         case 'draft' :
     478                switch ( $status = $post->post_status ) {
     479                        case 'draft':
    472480                                $label = __( 'Draft', 'wporg' );
    473481                                break;
    474                         case 'pending' :
     482                        case 'pending':
    475483                                $label = __( 'Pending Review', 'wporg' );
    476484                                break;
    477                         case 'publish' :
     485                        case 'publish':
    478486                                $label = __( 'Published', 'wporg' );
    479487                                break;
    480                         default :
     488                        default:
    481489                                $status = '';
    482490                                $label = __( 'None', 'wporg' );
     
    496504         */
    497505        public function admin_enqueue_base_scripts( $do_enqueue ) {
    498                 return $do_enqueue || in_array( get_current_screen()->id, $this->screen_ids  );
     506                return $do_enqueue || in_array( get_current_screen()->id, $this->screen_ids );
    499507        }
    500508
     
    508516                $parsed_post_types_screen_ids = DevHub_Admin::get_parsed_post_types_screen_ids();
    509517
    510                 if ( in_array( get_current_screen()->id, array_merge(
     518                if ( in_array(
     519                        get_current_screen()->id,
     520                        array_merge(
    511521                                $parsed_post_types_screen_ids,
    512522                                $this->screen_ids
    513                 ) ) ) {
    514                         wp_enqueue_script( 'wporg-explanations', get_template_directory_uri() . '/js/explanations.js', array( 'jquery', 'wp-util' ), '20160630', true );
    515 
    516                         wp_localize_script( 'wporg-explanations', 'wporg', array(
    517                                 'editContentLabel' => __( 'Edit Explanation', 'wporg' ),
    518                                 'statusLabel'      => array(
    519                                         'draft'        => __( 'Draft', 'wporg' ),
    520                                         'pending'      => __( 'Pending Review', 'wporg' ),
    521                                         'publish'      => __( 'Published', 'wporg' ),
    522                                 ),
    523                         ) );
     523                        )
     524                ) ) {
     525                        wp_enqueue_script(
     526                                'wporg-explanations',
     527                                get_template_directory_uri() . '/js/explanations.js',
     528                                array( 'jquery', 'wp-util' ),
     529                                filemtime( dirname( __DIR__ ) . '/js/explanations.js' ),
     530                                true
     531                        );
     532
     533                        wp_localize_script(
     534                                'wporg-explanations',
     535                                'wporg',
     536                                array(
     537                                        'editContentLabel' => __( 'Edit Explanation', 'wporg' ),
     538                                        'statusLabel'      => array(
     539                                                'draft'        => __( 'Draft', 'wporg' ),
     540                                                'pending'      => __( 'Pending Review', 'wporg' ),
     541                                                'publish'      => __( 'Published', 'wporg' ),
     542                                        ),
     543                                )
     544                        );
    524545                }
    525546        }
     
    559580                                );
    560581                        }
    561 
    562582                }
    563583        }
     
    605625                        $pos   = false === $index ? count( $columns ) : $index + 1;
    606626
    607                         $col_data = [ 'has_explanation' => sprintf(
    608                                 '<span class="dashicons dashicons-info" title="%s"></span><span class="screen-reader-text">%s</span>',
    609                                 esc_attr__( 'Has explanation?', 'wporg' ),
    610                                 esc_html__( 'Explanation?', 'wporg' )
    611                         ) ];
     627                        $col_data = [
     628                                'has_explanation' => sprintf(
     629                                        '<span class="dashicons dashicons-info" title="%s"></span><span class="screen-reader-text">%s</span>',
     630                                        esc_attr__( 'Has explanation?', 'wporg' ),
     631                                        esc_html__( 'Explanation?', 'wporg' )
     632                                ),
     633                        ];
    612634                        $columns  = array_merge( array_slice( $columns, 0, $pos ), $col_data, array_slice( $columns, $pos ) );
    613635                }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/parsed-content.php

    r7815 r12053  
    9999                                        <div class="wporg_parsed_readonly <?php echo $ticket ? 'hidden' : ''; ?>"><?php echo apply_filters( 'the_content', $content ); ?></div>
    100100                                        <div class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>">
    101                                                 <?php wp_editor( $content, 'content', array(
    102                                                         'media_buttons' => false,
    103                                                         'tinymce'       => false,
    104                                                         'quicktags'     => true,
    105                                                         'textarea_rows' => 10,
    106                                                         'textarea_name' => 'content',
    107                                                 ) ); ?>
     101                                                <?php wp_editor(
     102                                                        $content,
     103                                                        'content',
     104                                                        array(
     105                                                                'media_buttons' => false,
     106                                                                'tinymce'       => false,
     107                                                                'quicktags'     => true,
     108                                                                'textarea_rows' => 10,
     109                                                                'textarea_name' => 'content',
     110                                                        )
     111                                                ); ?>
    108112                                        </div>
    109113                                </td>
     
    164168                // Only enqueue 'wporg-parsed-content' script and styles on Code Reference post type screens.
    165169                if ( in_array( get_current_screen()->id, $this->post_types ) ) {
    166                         wp_enqueue_script( 'wporg-parsed-content', get_template_directory_uri() . '/js/parsed-content.js', array( 'jquery', 'utils' ), '20150824', true );
    167 
    168                         wp_localize_script( 'wporg-parsed-content', 'wporgParsedContent', array(
    169                                 'ajaxURL'    => admin_url( 'admin-ajax.php' ),
    170                                 'searchText' => __( 'Searching ...', 'wporg' ),
    171                                 'retryText'  => __( 'Invalid ticket number, please try again.', 'wporg' )
    172                         ) );
     170                        wp_enqueue_script(
     171                                'wporg-parsed-content',
     172                                get_template_directory_uri() . '/js/parsed-content.js',
     173                                array( 'jquery', 'utils' ),
     174                                filemtime( dirname( __DIR__ ) . '/js/parsed-content.js' ),
     175                                true
     176                        );
     177
     178                        wp_localize_script(
     179                                'wporg-parsed-content',
     180                                'wporgParsedContent',
     181                                array(
     182                                        'ajaxURL'    => admin_url( 'admin-ajax.php' ),
     183                                        'searchText' => __( 'Searching ...', 'wporg' ),
     184                                        'retryText'  => __( 'Invalid ticket number, please try again.', 'wporg' ),
     185                                )
     186                        );
    173187                }
    174188        }
     
    200214
    201215                                $nodes = $doc->getElementsByTagName( 'title' );
    202                                 $title = $nodes->item(0)->nodeValue;
     216                                $title = $nodes->item( 0 )->nodeValue;
    203217
    204218                                // Strip off the site name.
     
    213227                        update_post_meta( $post_id, 'wporg_ticket_title', $title );
    214228
    215                         $link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $ticket_url ),  apply_filters( 'the_title', $title ) );
     229                        $link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $ticket_url ), apply_filters( 'the_title', $title ) );
    216230
    217231                        // Can haz success.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-preview.php

    r9433 r12053  
    3636        public static function scripts_and_styles() {
    3737                if ( is_singular() ) {
    38                         wp_enqueue_script( 'wporg-developer-tabs', get_template_directory_uri() . '/js/tabs.js', array( 'jquery' ), '20160824', 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'  ), '20200111', true );
    40                         wp_localize_script( 'wporg-developer-preview', 'wporg_note_preview', array(
    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(),
    46                         ) );
     38                        wp_enqueue_script(
     39                                'wporg-developer-tabs',
     40                                get_template_directory_uri() . '/js/tabs.js',
     41                                array( 'jquery' ),
     42                                filemtime( dirname( __DIR__ ) . '/js/tabs.js' ),
     43                                true
     44                        );
     45
     46                        wp_enqueue_script(
     47                                'wporg-developer-preview',
     48                                get_template_directory_uri() . '/js/user-notes-preview.js',
     49                                array( 'jquery', 'wporg-developer-function-reference', 'wporg-developer-tabs' ),
     50                                filemtime( dirname( __DIR__ ) . '/js/user-notes-preview.js' ),
     51                                true
     52                        );
     53
     54                        wp_localize_script(
     55                                'wporg-developer-preview',
     56                                'wporg_note_preview',
     57                                array(
     58                                        'ajaxurl'       => admin_url( 'admin-ajax.php' ),
     59                                        'nonce'         => wp_create_nonce( 'preview_nonce' ),
     60                                        'preview'       => __( 'preview note', 'wporg' ),
     61                                        'preview_empty' => __( 'Nothing to preview', 'wporg' ),
     62                                        'is_admin'      => is_admin(),
     63                                )
     64                        );
    4765                }
    4866        }
     
    5169         * Ajax action to update the comment preview.
    5270         */
    53         public static function ajax_preview( ) {
     71        public static function ajax_preview() {
    5472                check_ajax_referer( 'preview_nonce', 'preview_nonce' );
    5573
     
    8098
    8199                ob_start();
    82 ?>
     100                ?>
    83101                <div id='comment-preview' class='tab-section comment byuser depth-1 comment-preview' aria-hidden="true">
    84102                        <article class='preview-body comment-body'>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php

    r10937 r12053  
    4848        public static function do_init() {
    4949                // Save a non-AJAX submitted vote.
    50                 add_action( 'template_redirect',  array( __CLASS__, 'vote_submission' ) );
     50                add_action( 'template_redirect', array( __CLASS__, 'vote_submission' ) );
    5151
    5252                // Save AJAX submitted vote.
    53                 add_action( 'wp_ajax_note_vote',  array( __CLASS__, 'ajax_vote_submission' ) );
     53                add_action( 'wp_ajax_note_vote', array( __CLASS__, 'ajax_vote_submission' ) );
    5454
    5555                // Enqueue scripts and styles.
     
    6565                // Only need to enqueue voting-related resources if there are comments to vote on.
    6666                if ( self::user_can_vote() && is_singular() && '0' != get_comments_number() ) {
    67                         wp_register_script( 'wporg-developer-user-notes-voting', get_template_directory_uri() . '/js/user-notes-voting.js', array( 'wp-a11y' ), '20210428', true );
    68                         wp_localize_script( 'wporg-developer-user-notes-voting', 'wporg_note_voting', array(
    69                                 'ajaxurl' => admin_url( 'admin-ajax.php' ),
    70                         ) );
     67                        wp_register_script(
     68                                'wporg-developer-user-notes-voting',
     69                                get_template_directory_uri() . '/js/user-notes-voting.js',
     70                                array( 'wp-a11y' ),
     71                                filemtime( dirname( __DIR__ ) . '/js/user-notes-voting.js' ),
     72                                true
     73                        );
     74
     75                        wp_localize_script(
     76                                'wporg-developer-user-notes-voting',
     77                                'wporg_note_voting',
     78                                array(
     79                                        'ajaxurl' => admin_url( 'admin-ajax.php' ),
     80                                )
     81                        );
    7182                        wp_enqueue_script( 'wporg-developer-user-notes-voting' );
    7283                }
     
    97108                                exit();
    98109                        }
    99 
    100110                }
    101111
     
    177187         * @access public
    178188         *
    179          * @param  int  $user_id    Optional. The user ID. If not defined, assumes current user.
    180          * @param  int  $comment_id Optional. The comment ID. If not defined, assumes being able to comment generally.
     189         * @param  int $user_id    Optional. The user ID. If not defined, assumes current user.
     190         * @param  int $comment_id Optional. The comment ID. If not defined, assumes being able to comment generally.
    181191         * @return bool True if the user can vote.
    182192         */
     
    209219         * Determines if a note was submitted by the current user.
    210220         *
    211          * @param int   $comment_id The comment ID, or empty to use current comment.
     221         * @param int $comment_id The comment ID, or empty to use current comment.
    212222         * @return bool True if the note was submitted by the current user.
    213223         */
     
    237247         * @access public
    238248         *
    239          * @param  int    $comment_id The comment ID
    240          * @param  int    $user_id    Optional. The user ID. If not defined, assumes current user.
     249         * @param  int $comment_id The comment ID
     250         * @param  int $user_id    Optional. The user ID. If not defined, assumes current user.
    241251         * @return bool   True if the user has upvoted the comment.
    242252         */
     
    262272         * @access public
    263273         *
    264          * @param  int    $comment_id The comment ID
    265          * @param  int    $user_id    Optional. The user ID. If not defined, assumes current user.
     274         * @param  int $comment_id The comment ID
     275         * @param  int $user_id    Optional. The user ID. If not defined, assumes current user.
    266276         * @return bool   True if the user has downvoted the comment.
    267277         */
     
    289299         * @param int $comment_id The comment ID, or empty to use current comment.
    290300         */
    291         public static function show_voting( $comment_id = '') {
     301        public static function show_voting( $comment_id = '' ) {
    292302                if ( ! $comment_id ) {
    293303                        global $comment;
     
    330340                if ( 'a' === $tag ) {
    331341                        $up_url = $logged_in ?
    332                                 add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'up' ), $comment_link ) :
     342                                add_query_arg(
     343                                        array(
     344                                                '_wpnonce' => $nonce,
     345                                                'comment' => $comment_id,
     346                                                'vote' => 'up',
     347                                        ),
     348                                        $comment_link
     349                                ) :
    333350                                $log_in_url;
    334351                        echo '" href="' . esc_url( $up_url );
     
    336353                echo '">';
    337354                echo '<span class="dashicons dashicons-arrow-up" aria-hidden="true"></span>';
    338                 echo '<span class="screen-reader-text">' . $title .  '</span>';
     355                echo '<span class="screen-reader-text">' . $title . '</span>';
    339356                echo "</{$tag}>";
    340357
     
    348365                        . 'class="user-note-voting-count ' . esc_attr( $class ) . '" '
    349366                        . 'title="' . esc_attr( $title ) . '">'
    350                         . '<span class="screen-reader-text">' . __( 'Vote results for this note: ', 'wporg' ) .  '</span>'
     367                        . '<span class="screen-reader-text">' . __( 'Vote results for this note: ', 'wporg' ) . '</span>'
    351368                        . self::count_votes( $comment_id, 'difference' )
    352369                        . '</span>';
     
    371388                if ( 'a' === $tag ) {
    372389                        $down_url = $logged_in ?
    373                                 add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'down' ), $comment_link ) :
     390                                add_query_arg(
     391                                        array(
     392                                                '_wpnonce' => $nonce,
     393                                                'comment' => $comment_id,
     394                                                'vote' => 'down',
     395                                        ),
     396                                        $comment_link
     397                                ) :
    374398                                $log_in_url;
    375399                        echo '" href="' . esc_url( $down_url );
     
    377401                echo '">';
    378402                echo '<span class="dashicons dashicons-arrow-down" aria-hidden="true"></span>';
    379                 echo '<span class="screen-reader-text">' . $title .  '</span>';
     403                echo '<span class="screen-reader-text">' . $title . '</span>';
    380404                echo "</{$tag}>";
    381405
     
    435459         * @access public
    436460         *
    437          * @param  int  $comment_id The comment ID
    438          * @param  int  $user_id    Optional. The user ID. Default is current user.
     461         * @param  int $comment_id The comment ID
     462         * @param  int $user_id    Optional. The user ID. Default is current user.
    439463         * @return bool Whether the up vote succeed (a new vote or a change in vote).
    440464         */
     
    448472         * @access public
    449473         *
    450          * @param  int  $comment_id The comment ID
    451          * @param  int  $user_id    Optional. The user ID. Default is current user.
     474         * @param  int $comment_id The comment ID
     475         * @param  int $user_id    Optional. The user ID. Default is current user.
    452476         * @return bool Whether the down vote succeed (a new vote or a change in vote).
    453477         */
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/page-dashicons.php

    r11213 r12053  
    1010require_once __DIR__ . '/inc/dashicons.php';
    1111
    12 wp_enqueue_style(  'dashicons-page', get_template_directory_uri() . '/stylesheets/page-dashicons.css', array(), '20210830' );
    13 wp_enqueue_script( 'dashicons-page', get_template_directory_uri() . '/js/page-dashicons.js', array( 'jquery', 'wp-util' ), '20210830' );
     12wp_enqueue_style(
     13        'dashicons-page',
     14        get_template_directory_uri() . '/stylesheets/page-dashicons.css',
     15        array(),
     16        filemtime( __DIR__ . '/stylesheets/page-dashicons.css' )
     17);
     18wp_enqueue_script(
     19        'dashicons-page',
     20        get_template_directory_uri() . '/js/page-dashicons.js',
     21        array( 'jquery', 'wp-util' ),
     22        filemtime( __DIR__ . '/js/page-dashicons.js' )
     23);
    1424
    1525get_header(); ?>
    1626
    1727        <div id="content-area" <?php body_class( 'dashicons-page' ); ?>>
    18                 <?php while ( have_posts() ) : the_post(); ?>
     28                <?php while ( have_posts() ) :
     29                        the_post(); ?>
    1930                <main id="main" <?php post_class( 'site-main' ); ?> role="main">
    2031
     
    4455                                                $group_info['label']
    4556                                        );
    46                                        
     57
    4758                                        echo "<!-- {$group} -->\n";
    4859
     
    6879                                <h3><?php _e( 'WordPress Usage', 'wporg' ); ?></h3>
    6980
    70                                 <p><?php  printf(
    71                                         __( 'Admin menu items can be added with <code><a href="%s">register_post_type()</a></code> and <code><a href="%s">add_menu_page()</a></code>, which both have an option to set an icon. To show the current icon, you should pass in %s.', 'wporg' ),
     81                                <p>
     82                                <?php  printf(
     83                                        __( 'Admin menu items can be added with <code><a href="%1$s">register_post_type()</a></code> and <code><a href="%2$s">add_menu_page()</a></code>, which both have an option to set an icon. To show the current icon, you should pass in %3$s.', 'wporg' ),
    7284                                        'https://developer.wordpress.org/reference/functions/register_post_type/',
    7385                                        'https://developer.wordpress.org/reference/functions/add_menu_page/',
     
    7789                                <h4><?php _e( 'Examples', 'wporg' ); ?></h4>
    7890
    79                                 <p><?php printf(
     91                                <p>
     92                                <?php printf(
    8093                                        __( 'In <code><a href="%s">register_post_type()</a></code>, set <code>menu_icon</code> in the arguments array.', 'wporg' ),
    8194                                        'https://developer.wordpress.org/reference/functions/register_post_type/'
     
    89102 */
    90103function wpdocs_create_post_type() {
    91     register_post_type( 'acme_product',
    92         array(
    93             'labels' => array(
    94                 'name'          => __( 'Products', 'textdomain' ),
    95                 'singular_name' => __( 'Product', 'textdomain' )
    96             ),
    97             'public'      => true,
    98             'has_archive' => true,
    99             'menu_icon'   => 'dashicons-products',
    100         )
    101     );
     104        register_post_type( 'acme_product',
     105                array(
     106                        'labels' => array(
     107                                'name'          => __( 'Products', 'textdomain' ),
     108                                'singular_name' => __( 'Product', 'textdomain' )
     109                        ),
     110                        'public'      => true,
     111                        'has_archive' => true,
     112                        'menu_icon'   => 'dashicons-products',
     113                )
     114        );
    102115}
    103116add_action( 'init', 'wpdocs_create_post_type', 0 );
    104117</pre>
    105118
    106                                 <p><?php printf(
     119                                <p>
     120                                <?php printf(
    107121                                        __( 'The function <code><a href="%s">add_menu_page()</a></code> accepts a parameter after the callback function for an icon URL, which can also accept a dashicons class.', 'wporg' ),
    108122                                        'https://developer.wordpress.org/reference/functions/add_menu_page/'
     
    116130 */
    117131function wpdocs_add_my_custom_menu() {
    118     // Add an item to the menu.
    119     add_menu_page(
    120         __( 'My Page', 'textdomain' ),
    121         __( 'My Title', 'textdomain' ),
    122         'manage_options',
    123         'my-page',
    124         'my_admin_page_function',
    125         'dashicons-admin-media'
    126     );
     132        // Add an item to the menu.
     133        add_menu_page(
     134                __( 'My Page', 'textdomain' ),
     135                __( 'My Title', 'textdomain' ),
     136                'manage_options',
     137                'my-page',
     138                'my_admin_page_function',
     139                'dashicons-admin-media'
     140        );
    127141}</pre>
    128142
     
    151165                                <h4><?php _e( 'Examples', 'wporg' ); ?></h4>
    152166
    153                                 <p><?php printf(
     167                                <p>
     168                                <?php printf(
    154169                                        /* translators: %s: URL to Block Editor Handbook for registering a block. */
    155170                                        __( 'Adding an icon to a block. The <code>registerBlockType</code> function accepts a parameter "icon" which accepts the name of a dashicon. The provided example is truncated. See the <a href="%s">full example</a> in the Block Editor Handbook.', 'wporg' ),
     
    168183} );
    169184</pre>
    170                                 <p><?php printf(
     185                                <p>
     186                                <?php printf(
    171187                                        /* translators: %s: URL to handbook page for Dashicon component. */
    172188                                        __( 'Using an icon as a component. A dedicated <code>Dashicon</code> component is available. See the <a href="%s">related documentation</a> in the Block Editor Handbook.', 'wporg' ),
     
    176192<pre>
    177193import { Dashicon } from '@wordpress/components';
    178  
     194
    179195const MyDashicon = () =&gt; (
    180196    &lt;div&gt;
Note: See TracChangeset for help on using the changeset viewer.