Making WordPress.org

Ticket #2821: 2821.2.patch

File 2821.2.patch, 1.5 KB (added by SergeyBiryukov, 8 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

     
    8383                }
    8484
    8585                // Determine the plugin slug based on the name of the plugin in the main plugin file.
    86                 $this->plugin_slug = sanitize_title_with_dashes( $this->plugin['Name'] );
     86                $this->plugin_slug = remove_accents( $this->plugin['Name'] );
     87                $this->plugin_slug = preg_replace( '/[^a-z0-9 _.-]/i', '', $this->plugin_slug );
     88                $this->plugin_slug = sanitize_title_with_dashes( $this->plugin_slug );
    8789
     90                if ( ! $this->plugin_slug ) {
     91                        $error = __( 'The plugin has an unsupported name.', 'wporg-plugins' );
     92
     93                        /* translators: %s: 'Plugin Name:' */
     94                        return $error . ' ' . sprintf( __( 'Plugin names can only contain latin letters (A-z), numbers, spaces, and hyphens. Please change the %s line in your main plugin file and upload it again.', 'wporg-plugins' ),
     95                                esc_html( $this->plugin['Name'] ),
     96                                '<code>Plugin Name:</code>'
     97                        );
     98                }
     99
    88100                // Make sure it doesn't use a slug deemed not to be used by the public.
    89101                if ( $this->has_reserved_slug() ) {
    90102                        $error = __( 'The plugin has a reserved name.', 'wporg-plugins' );