Make WordPress Core

Ticket #54400: 54400.diff

File 54400.diff, 1.5 KB (added by johnjamesjacoby, 4 years ago)

Proof of concept...

  • src/wp-admin/plugins.php

     
    724724</h1>
    725725
    726726<?php
    727 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) {
     727if ( current_user_can( 'install_plugins' ) ) {
     728        $install_url = is_multisite() ? network_admin_url( 'plugin-install.php' ) : admin_url( 'plugin-install.php' );
    728729        ?>
    729         <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a>
     730        <a href="<?php echo esc_url( $install_url ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a>
    730731        <?php
    731732}
    732733
  • src/wp-admin/themes.php

     
    250250                <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
    251251        </h1>
    252252
    253         <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
    254                 <a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
     253        <?php if ( current_user_can( 'install_themes' ) ) :
     254                $install_url = is_multisite() ? network_admin_url( 'theme-install.php' ) : admin_url( 'theme-install.php' );
     255                ?>
     256                <a href="<?php echo esc_url( $install_url ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
    255257        <?php endif; ?>
    256258
    257259        <form class="search-form"></form>