Changeset 13462 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-upload.php
- Timestamp:
- 04/05/2024 04:55:33 AM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-upload.php
r13460 r13462 6 6 use WordPressdotorg\Plugin_Directory\API\Base; 7 7 use WordPressdotorg\Plugin_Directory\Shortcodes\Upload_Handler; 8 use WordPressdotorg\Plugin_Directory\Readme\Validator as Readme_Validator; 9 use WordPressdotorg\Plugin_Directory\Trademarks; 8 10 use WP_REST_Server; 9 11 use WP_Error; … … 141 143 } 142 144 143 // Duplicated from Upload handler.144 145 // Make sure it doesn't use a TRADEMARK protected slug. 145 146 $has_trademarked_slug = Trademarks::check_slug( $slug, wp_get_current_user() ); 146 147 if ( $has_trademarked_slug ) { 147 $error = __( 'That plugin slug includes a restricted term.', 'wporg-plugins' ); 148 149 if ( $has_trademarked_slug === trim( $has_trademarked_slug, '-' ) ) { 150 // Trademarks that do NOT end in "-" indicate slug cannot contain term at all. 151 $message = sprintf( 152 /* translators: 1: plugin slug, 2: trademarked term, 3: 'Plugin Name:', 4: plugin email address */ 153 __( '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' ), 154 '<code>' . $slug . '</code>', 155 '<code>' . trim( $has_trademarked_slug, '-' ) . '</code>' 156 ); 157 } else { 158 // Trademarks ending in "-" indicate slug cannot BEGIN with that term. 159 $message = sprintf( 160 /* translators: 1: plugin slug, 2: trademarked term, 3: 'Plugin Name:', 4: plugin email address */ 161 __( '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' ), 162 '<code>' . $slug . '</code>', 163 '<code>' . trim( $has_trademarked_slug, '-' ) . '</code>' 164 ); 165 } 166 167 return new WP_Error( 'trademarked_slug', $error . ' ' . $message ); 148 return new WP_Error( 149 'trademarked_slug', 150 Readme_Validator::instance()->translate_code_to_message( 151 'trademarked_slug', 152 [ 153 'trademark' => $has_trademarked_slug, 154 'context' => $slug 155 ] 156 ) 157 ); 168 158 } 169 159
Note: See TracChangeset
for help on using the changeset viewer.