Ticket #17944: 17944-standards.diff

File 17944-standards.diff, 3.2 KB (added by CoenJacobs, 23 months ago)

Fixed two Coding Standards issues

  • wp-admin/includes/class-wp-themes-list-table.php

     
    172172        $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] ); 
    173173 
    174174        $actions = implode ( ' | ', $actions ); 
     175         
     176        $ct = array( 
     177                'title'          => $title, 
     178                'template_dir'   => $template_dir, 
     179                'stylesheet_dir' => $stylesheet_dir, 
     180                'parent_theme'   => $parent_theme, 
     181        ); 
    175182?> 
    176183                <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> 
    177184<?php if ( $screenshot ) : ?> 
     
    183190        printf( __( '%1$s %2$s by %3$s' ), $title, $version, $author ) ; ?></h3> 
    184191<p class="description"><?php echo $description; ?></p> 
    185192<span class='action-links'><?php echo $actions ?></span> 
    186         <?php if ( current_user_can( 'edit_themes' ) && $parent_theme ) { 
    187         /* translators: 1: theme title, 2:  template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?> 
    188         <p><?php printf( __( 'The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme ); ?></p> 
    189 <?php } else { ?> 
    190         <p><?php printf( __( 'All of this theme&#8217;s files are located in <code>%2$s</code>.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?></p> 
    191 <?php } ?> 
     193<?php $this->_show_files_location( $ct ); ?> 
    192194<?php if ( $tags ) : ?> 
    193195<p><?php _e( 'Tags:' ); ?> <?php echo join( ', ', $tags ); ?></p> 
    194196<?php endif; ?> 
     
    235237                // Only get here if each word exists in the tags or one of the fields 
    236238                return true; 
    237239        } 
     240         
     241        function _show_files_location( $ct ) { 
     242                if ( ! is_array( $ct ) ) { 
     243                        $ct = get_object_vars( $ct ); 
     244                } 
     245                if ( current_user_can( 'edit_themes' ) && ! empty( $ct['parent_theme'] ) ) { 
     246                        /* translators: 1:  template dir, 2: stylesheet_dir, 3: theme title, 4: parent_theme */ ?> 
     247                        <p><?php printf( __( 'The template files are located in <code>%1$s</code>. The stylesheet files are located in <code>%2$s</code>. <strong>%3$s</strong> uses templates from <strong>%4$s</strong>. Changes made to the templates will affect both themes.' ), str_replace( WP_CONTENT_DIR, '', $ct['template_dir'] ), str_replace( WP_CONTENT_DIR, '', $ct['stylesheet_dir'] ), $ct['title'], $ct['parent_theme'] ); ?></p> 
     248                <?php } else { ?> 
     249                        <p><?php printf( __( 'All of this theme&#8217;s files are located in <code>%1$s</code>.' ), str_replace( WP_CONTENT_DIR, '', $ct['template_dir'] ) ); ?></p> 
     250                <?php } 
     251        } 
    238252} 
    239253 
    240254?> 
  • wp-admin/themes.php

     
    118118                } 
    119119        } 
    120120        echo implode ( ' | ', $options ); 
     121         
     122        $wp_list_table->_show_files_location( $ct ); 
    121123 
    122124        if ( $ct->tags ) : ?> 
    123125        <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>