Making WordPress.org


Ignore:
Timestamp:
04/05/2024 03:44:27 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Extract the trademark logic from the upload handler, into a generic class for use in the plugin directory.

See #5868, #6108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-upload.php

    r13109 r13460  
    143143        // Duplicated from Upload handler.
    144144        // Make sure it doesn't use a TRADEMARK protected slug.
    145         if ( false !== $upload_handler->has_trademarked_slug()  ) {
     145        $has_trademarked_slug = Trademarks::check_slug( $slug, wp_get_current_user() );
     146        if ( $has_trademarked_slug ) {
    146147            $error = __( 'That plugin slug includes a restricted term.', 'wporg-plugins' );
    147148
    148             if ( $upload_handler->has_trademarked_slug() === trim( $upload_handler->has_trademarked_slug(), '-' ) ) {
     149            if ( $has_trademarked_slug === trim( $has_trademarked_slug, '-' ) ) {
    149150                // Trademarks that do NOT end in "-" indicate slug cannot contain term at all.
    150151                $message = sprintf(
     
    152153                    __( 'Your chosen plugin slug - %1$s - contains the restricted term "%2$s", which cannot be used at all in your plugin permalink nor the display name.', 'wporg-plugins' ),
    153154                    '<code>' . $slug . '</code>',
    154                     trim( $upload_handler->has_trademarked_slug(), '-' )
     155                    '<code>' . trim( $has_trademarked_slug, '-' ) . '</code>'
    155156                );
    156157            } else {
     
    160161                    __( 'Your chosen plugin slug - %1$s - contains the restricted term "%2$s" and cannot be used to begin your permalink or display name. We disallow the use of certain terms in ways that are abused, or potentially infringe on and/or are misleading with regards to trademarks.', 'wporg-plugins' ),
    161162                    '<code>' . $slug . '</code>',
    162                     trim( $upload_handler->has_trademarked_slug(), '-' )
     163                    '<code>' . trim( $has_trademarked_slug, '-' ) . '</code>'
    163164                );
    164165            }
Note: See TracChangeset for help on using the changeset viewer.