Changeset 10024
- Timestamp:
- 07/07/2020 04:06:13 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r9806 r10024 182 182 } 183 183 184 // Plugins need descriptions. 184 185 if ( ! $this->plugin['Description'] ) { 185 186 $error = __( 'Error: The plugin has no description.', 'wporg-plugins' ); … … 193 194 } 194 195 196 // Plugins need versions. 195 197 if ( ! $this->plugin['Version'] ) { 196 198 $error = __( 'Error: The plugin has no version.', 'wporg-plugins' ); … … 204 206 } 205 207 208 // Versions should be NUMBERS. 206 209 if ( preg_match( '|[^\d\.]|', $this->plugin['Version'] ) ) { 207 210 $error = __( 'Error: Plugin versions are expected to be numbers.', 'wporg-plugins' ); … … 215 218 216 219 // Prevent duplicate URLs. 220 // This is part of how the API looks for updates, so having them different helps prevent conflicts. 217 221 if ( ! empty( $this->plugin['PluginURI'] ) && ! empty( $this->plugin['AuthorURI'] ) && $this->plugin['PluginURI'] == $this->plugin['AuthorURI'] ) { 218 222 $error = __( 'Error: Your plugin and author URIs are the same.', 'wporg-plugins' ); … … 242 246 } 243 247 248 // Check for a valid readme. 244 249 $readme = $this->find_readme_file(); 245 // Check for a valid readme.246 250 if ( empty( $readme ) ) { 247 251 $error = __( 'Error: The plugin has no readme.', 'wporg-plugins' ); … … 405 409 // Reserved names. 406 410 'jquery', 411 'wordpress', 412 // common submissions by people trying to upload locally. 413 'akismet-anti-spam', 407 414 'site-kit-by-google', 408 'wordpress',409 415 'yoast-seo', 410 416 ); … … 424 430 'advanced-custom-fields-', 425 431 'adwords-', 432 'akismet-', 426 433 'amazon-', 427 434 'android-', 428 435 'apple-', 436 'aws-', 437 'bbpress-', 429 438 'bing-', 439 'buddypress-', 430 440 'contact-form-7-', 431 441 'divi-', … … 454 464 'whatsapp', 455 465 'whats-app', 456 'woocommerce', 466 'watson', 467 'windows-', 468 'woocommerce', // technically ending with '-for-woocommerce' is allowed. 469 'woo-commerce', 457 470 'woo-', 458 471 'wordpress', 472 'yahoo-', 459 473 'yoast', 460 474 'youtube-', … … 463 477 // Domains from which exceptions would be accepted. 464 478 $trademark_exceptions = array( 465 'yoast.com' => array( 'yoast' ), 466 'automattic.com' => array( 'wordpress', 'woo', 'woocommerce' ), 479 'yoast.com' => array( 'yoast' ), 480 'automattic.com' => array( 'akismet', 'jetpack', 'wordpress', 'woo', 'woo-', 'woocommerce' ), 481 'facebook.com' => array( 'facebook', 'whatsapp', 'instagram' ), 482 'support.microsoft.com' => array( 'bing-', 'microsoft-' ), 483 'microsoft.com' => array( 'bing-', 'microsoft-' ), 484 ); 485 486 // Trademarks that are allowed as 'for-whatever' ONLY. 487 $for_use_exceptions = array( 488 'woocommerce', 467 489 ); 468 490 … … 483 505 } 484 506 507 // check for 'for-TRADEMARK' exceptions. 508 if ( $has_trademarked_slug && in_array( $has_trademarked_slug, $for_use_exceptions ) ) { 509 $for_trademark = '-for-' . $has_trademarked_slug; 510 // At this point we might be okay, but there's one more check. 511 if ( $for_trademark === substr( $this->plugin_slug, -1 * strlen( $for_trademark ) ) ) { 512 // Yes the slug ENDS with 'for-TRADEMARK'. 513 $has_trademarked_slug = false; 514 } 515 } 516 485 517 // Get the user email domain. 486 $user_email_domain= explode( '@', wp_get_current_user()->user_email, 2 );518 list( ,$user_email_domain ) = explode( '@', wp_get_current_user()->user_email, 2 ); 487 519 488 520 // If email domain is on our list of possible exceptions, we have an extra check. 489 if ( array_key_exists( $user_email_domain[1], $trademark_exceptions ) ) {521 if ( $has_trademarked_slug && array_key_exists( $user_email_domain, $trademark_exceptions ) ) { 490 522 // If $has_trademarked_slug is in the array for that domain, they can use the term. 491 if ( in_array( $has_trademarked_slug, $trademark_exceptions[ $user_email_domain [1]] ) ) {523 if ( in_array( $has_trademarked_slug, $trademark_exceptions[ $user_email_domain ] ) ) { 492 524 $has_trademarked_slug = false; 493 525 }
Note: See TracChangeset
for help on using the changeset viewer.