Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-install.php

    r42003 r42343  
    1313wp_reset_vars( array( 'tab' ) );
    1414
    15 if ( ! current_user_can('install_themes') )
     15if ( ! current_user_can( 'install_themes' ) ) {
    1616    wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
     17}
    1718
    1819if ( is_multisite() && ! is_network_admin() ) {
     
    2122}
    2223
    23 $title = __( 'Add Themes' );
     24$title       = __( 'Add Themes' );
    2425$parent_file = 'themes.php';
    2526
     
    4041}
    4142
    42 wp_localize_script( 'theme', '_wpThemeSettings', array(
    43     'themes'   => false,
    44     'settings' => array(
    45         'isInstall'  => true,
    46         'canInstall' => current_user_can( 'install_themes' ),
    47         'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
    48         'adminUrl'   => parse_url( self_admin_url(), PHP_URL_PATH )
    49     ),
    50     'l10n' => array(
    51         'addNew'              => __( 'Add New Theme' ),
    52         'search'              => __( 'Search Themes' ),
    53         'searchPlaceholder'   => __( 'Search themes...' ), // placeholder (no ellipsis)
    54         'upload'              => __( 'Upload Theme' ),
    55         'back'                => __( 'Back' ),
    56         'error'               => sprintf(
    57             /* translators: %s: support forums URL */
    58             __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    59             __( 'https://wordpress.org/support/' )
     43wp_localize_script(
     44    'theme', '_wpThemeSettings', array(
     45        'themes'          => false,
     46        'settings'        => array(
     47            'isInstall'  => true,
     48            'canInstall' => current_user_can( 'install_themes' ),
     49            'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
     50            'adminUrl'   => parse_url( self_admin_url(), PHP_URL_PATH ),
    6051        ),
    61         'tryAgain'            => __( 'Try Again' ),
    62         'themesFound'         => __( 'Number of Themes found: %d' ),
    63         'noThemesFound'       => __( 'No themes found. Try a different search.' ),
    64         'collapseSidebar'     => __( 'Collapse Sidebar' ),
    65         'expandSidebar'       => __( 'Expand Sidebar' ),
    66         /* translators: accessibility text */
    67         'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
    68     ),
    69     'installedThemes' => array_keys( $installed_themes ),
    70 ) );
     52        'l10n'            => array(
     53            'addNew'              => __( 'Add New Theme' ),
     54            'search'              => __( 'Search Themes' ),
     55            'searchPlaceholder'   => __( 'Search themes...' ), // placeholder (no ellipsis)
     56            'upload'              => __( 'Upload Theme' ),
     57            'back'                => __( 'Back' ),
     58            'error'               => sprintf(
     59                /* translators: %s: support forums URL */
     60                __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
     61                __( 'https://wordpress.org/support/' )
     62            ),
     63            'tryAgain'            => __( 'Try Again' ),
     64            'themesFound'         => __( 'Number of Themes found: %d' ),
     65            'noThemesFound'       => __( 'No themes found. Try a different search.' ),
     66            'collapseSidebar'     => __( 'Collapse Sidebar' ),
     67            'expandSidebar'       => __( 'Expand Sidebar' ),
     68            /* translators: accessibility text */
     69            'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
     70        ),
     71        'installedThemes' => array_keys( $installed_themes ),
     72    )
     73);
    7174
    7275wp_enqueue_script( 'theme' );
     
    8891$help_overview =
    8992    '<p>' . sprintf(
    90             /* translators: %s: Theme Directory URL */
     93        /* translators: %s: Theme Directory URL */
    9194            __( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
    92             __( 'https://wordpress.org/themes/' )
    93         ) . '</p>' .
     95        __( 'https://wordpress.org/themes/' )
     96    ) . '</p>' .
    9497    '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
    9598    '<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
    9699    '<p>' . sprintf(
    97             /* translators: %s: /wp-content/themes */
     100        /* translators: %s: /wp-content/themes */
    98101            __( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.' ),
    99             '<code>/wp-content/themes</code>'
    100         ) . '</p>';
    101 
    102 get_current_screen()->add_help_tab( array(
    103     'id'      => 'overview',
    104     'title'   => __('Overview'),
    105     'content' => $help_overview
    106 ) );
     102        '<code>/wp-content/themes</code>'
     103    ) . '</p>';
     104
     105get_current_screen()->add_help_tab(
     106    array(
     107        'id'      => 'overview',
     108        'title'   => __( 'Overview' ),
     109        'content' => $help_overview,
     110    )
     111);
    107112
    108113$help_installing =
    109     '<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' .
    110     '<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>';
    111 
    112 get_current_screen()->add_help_tab( array(
    113     'id'      => 'installing',
    114     'title'   => __('Previewing and Installing'),
    115     'content' => $help_installing
    116 ) );
     114    '<p>' . __( 'Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.' ) . '</p>' .
     115    '<p>' . __( 'To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.' ) . '</p>';
     116
     117get_current_screen()->add_help_tab(
     118    array(
     119        'id'      => 'installing',
     120        'title'   => __( 'Previewing and Installing' ),
     121        'content' => $help_installing,
     122    )
     123);
    117124
    118125get_current_screen()->set_help_sidebar(
    119     '<p><strong>' . __('For more information:') . '</strong></p>' .
    120     '<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes">Documentation on Adding New Themes</a>') . '</p>' .
    121     '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
     126    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     127    '<p>' . __( '<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes">Documentation on Adding New Themes</a>' ) . '</p>' .
     128    '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
    122129);
    123130
    124 include(ABSPATH . 'wp-admin/admin-header.php');
     131include( ABSPATH . 'wp-admin/admin-header.php' );
    125132
    126133?>
     
    358365wp_print_admin_notice_templates();
    359366
    360 include(ABSPATH . 'wp-admin/admin-footer.php');
     367include( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset for help on using the changeset viewer.