Changeset 13462 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-trademarks.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/class-trademarks.php
r13460 r13462 171 171 * @param string $check The plugin name to check. 172 172 * @param array|WP_User|WP_Post $exceptions An array of exceptions to the trademark checks, or a WP_User or WP_Post object to fetch their exceptions. 173 * @return string|false The trademarked slug if found, false otherwise.173 * @return array|false The trademarked slug if found, false otherwise. 174 174 */ 175 175 public static function check( $check, $exceptions = [] ) { … … 188 188 * @param string $plugin_slug The slug-like-text to check. 189 189 * @param array|WP_User|WP_Post $exceptions An array of exceptions to the trademark checks, or a WP_User or WP_Post object to fetch their exceptions. 190 * @return string|false The trademarked slug if found, false otherwise.190 * @return array|false The trademarked slug if found, false otherwise. 191 191 */ 192 192 public static function check_slug( $plugin_slug, $exceptions = [] ) { … … 220 220 } 221 221 222 $has_trademarked_slug = false;222 $has_trademarked_slug = []; 223 223 224 224 foreach ( $trademarked_slugs as $trademark ) { … … 226 226 // Trademarks ending in "-" indicate slug cannot begin with that term. 227 227 if ( str_starts_with( $plugin_slug, $trademark ) ) { 228 $has_trademarked_slug = $trademark; 229 break; 228 $has_trademarked_slug[] = $trademark; 230 229 } 231 230 … … 246 245 247 246 // The term cannot exist anywhere in the plugin slug, and it's not a for-use exception. 248 $has_trademarked_slug = $trademark; 249 break; 247 $has_trademarked_slug[] = $trademark; 250 248 } 251 249 } … … 254 252 foreach ( $portmanteaus as $portmanteau ) { 255 253 if ( str_starts_with( $plugin_slug, $portmanteau ) ) { 256 $has_trademarked_slug = $portmanteau; 257 break; 254 $has_trademarked_slug[] = $portmanteau . '-'; // State that the portmanteau cannnot start the text. 258 255 } 259 256 } 260 257 261 return $has_trademarked_slug;258 return array_unique( $has_trademarked_slug ) ?: false; 262 259 } 263 260
Note: See TracChangeset
for help on using the changeset viewer.