]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/plugins.php
WordPress 4.6.1
[autoinstalls/wordpress.git] / wp-admin / plugins.php
index 93aec79d78590a8e8c0f9135d19f862af0e1fb87..1d462381935d360336bf9bc84c7e90548b89a0fc 100644 (file)
@@ -10,7 +10,7 @@
 require_once( dirname( __FILE__ ) . '/admin.php' );
 
 if ( ! current_user_can('activate_plugins') )
-       wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
+       wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
 
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
 $pagenum = $wp_list_table->get_pagenum();
@@ -18,7 +18,7 @@ $pagenum = $wp_list_table->get_pagenum();
 $action = $wp_list_table->current_action();
 
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
-$s = isset($_REQUEST['s']) ? urlencode($_REQUEST['s']) : '';
+$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
 
 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
@@ -30,7 +30,7 @@ if ( $action ) {
        switch ( $action ) {
                case 'activate':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
 
                        if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
                                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
@@ -69,7 +69,7 @@ if ( $action ) {
 
                case 'activate-selected':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
 
                        check_admin_referer('bulk-plugins');
 
@@ -147,7 +147,7 @@ if ( $action ) {
 
                case 'error_scrape':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
 
                        check_admin_referer('plugin-activation-error_' . $plugin);
 
@@ -168,7 +168,7 @@ if ( $action ) {
 
                case 'deactivate':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
 
                        check_admin_referer('deactivate-plugin_' . $plugin);
 
@@ -193,7 +193,7 @@ if ( $action ) {
 
                case 'deactivate-selected':
                        if ( ! current_user_can('activate_plugins') )
-                               wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
 
                        check_admin_referer('bulk-plugins');
 
@@ -228,7 +228,7 @@ if ( $action ) {
 
                case 'delete-selected':
                        if ( ! current_user_can('delete_plugins') ) {
-                               wp_die(__('You do not have sufficient permissions to delete plugins for this site.'));
+                               wp_die(__('Sorry, you are not allowed to delete plugins for this site.'));
                        }
 
                        check_admin_referer('bulk-plugins');
@@ -256,14 +256,12 @@ if ( $action ) {
                                ?>
                        <div class="wrap">
                                <?php
-                                       $files_to_delete = $plugin_info = array();
+                                       $plugin_info = array();
                                        $have_non_network_plugins = false;
-                                       $plugin_translations = wp_get_installed_translations( 'plugins' );
                                        foreach ( (array) $plugins as $plugin ) {
                                                $plugin_slug = dirname( $plugin );
 
                                                if ( '.' == $plugin_slug ) {
-                                                       $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
                                                        if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
                                                                $plugin_info[ $plugin ] = $data;
                                                                $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
@@ -272,12 +270,6 @@ if ( $action ) {
                                                                }
                                                        }
                                                } else {
-                                                       // Locate all the files in that folder.
-                                                       $files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug );
-                                                       if ( $files ) {
-                                                               $files_to_delete = array_merge( $files_to_delete, $files );
-                                                       }
-
                                                        // Get plugins list from that folder.
                                                        if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
                                                                foreach ( $folder_plugins as $plugin_file => $data ) {
@@ -288,16 +280,6 @@ if ( $action ) {
                                                                        }
                                                                }
                                                        }
-
-                                                       // Add translation files.
-                                                       if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) {
-                                                               $translations = $plugin_translations[ $plugin_slug ];
-
-                                                               foreach ( $translations as $translation => $data ) {
-                                                                       $files_to_delete[] = $plugin_slug . '-' . $translation . '.po';
-                                                                       $files_to_delete[] = $plugin_slug . '-' . $translation . '.mo';
-                                                               }
-                                                       }
                                                }
                                        }
                                        $plugins_to_delete = count( $plugin_info );
@@ -321,11 +303,11 @@ if ( $action ) {
                                                foreach ( $plugin_info as $plugin ) {
                                                        if ( $plugin['is_uninstallable'] ) {
                                                                /* translators: 1: plugin name, 2: plugin author */
-                                                               echo '<li>', sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)' ), $plugin['Name'], $plugin['AuthorName'] ), '</li>';
+                                                               echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>';
                                                                $data_to_delete = true;
                                                        } else {
                                                                /* translators: 1: plugin name, 2: plugin author */
-                                                               echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $plugin['Name'], $plugin['AuthorName'] ), '</li>';
+                                                               echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>';
                                                        }
                                                }
                                                ?>
@@ -353,17 +335,6 @@ if ( $action ) {
                                <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
                                        <?php submit_button( __( 'No, return me to the plugin list' ), 'button', 'submit', false ); ?>
                                </form>
-
-                               <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
-                               <div id="files-list" style="display:none;">
-                                       <ul class="code">
-                                       <?php
-                                               foreach ( (array) $files_to_delete as $file ) {
-                                                       echo '<li>' . esc_html( str_replace( WP_PLUGIN_DIR, '', $file ) ) . '</li>';
-                                               }
-                                       ?>
-                                       </ul>
-                               </div>
                        </div>
                                <?php
                                require_once(ABSPATH . 'wp-admin/admin-footer.php');
@@ -400,12 +371,11 @@ get_current_screen()->add_help_tab( array(
 'title'                => __('Overview'),
 'content'      =>
        '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
+       '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
        '<p>' . sprintf(
-               /* translators: 1: Plugin Browser/Installer URL, 2: WordPress Plugin Directory URL 3: local plugin directory */
-               __( 'You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your %3$s directory. Once a plugin has been installed, you can activate it here.' ),
-               'plugin-install.php',
-               'https://wordpress.org/plugins/',
-               '<code>/wp-content/plugins</code>'
+               /* translators: %s: WordPress Plugin Directory URL */
+               __( 'If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s" target="_blank">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
+               'https://wordpress.org/plugins/'
        ) . '</p>'
 ) );
 get_current_screen()->add_help_tab( array(
@@ -510,9 +480,14 @@ if ( ! empty( $invalid ) ) {
 <h1><?php echo esc_html( $title );
 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
  <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
-<?php }
-if ( $s )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
+<?php
+}
+
+if ( strlen( $s ) ) {
+       /* translators: %s: search keywords */
+       printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( urldecode( $s ) ) );
+}
+?>
 </h1>
 
 <?php
@@ -533,7 +508,7 @@ do_action( 'pre_current_active_plugins', $plugins['all'] );
 
 <?php $wp_list_table->views(); ?>
 
-<form method="get">
+<form class="search-form search-plugins" method="get">
 <?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?>
 </form>
 
@@ -545,9 +520,12 @@ do_action( 'pre_current_active_plugins', $plugins['all'] );
 <?php $wp_list_table->display(); ?>
 </form>
 
+       <span class="spinner"></span>
 </div>
 
 <?php
 wp_print_request_filesystem_credentials_modal();
+wp_print_admin_notice_templates();
+wp_print_update_row_templates();
 
 include(ABSPATH . 'wp-admin/admin-footer.php');