Making WordPress.org


Ignore:
Timestamp:
09/01/2016 01:53:28 AM (10 years ago)
Author:
dd32
Message:

Plugin Directory: Ingest the License and License URI readme fields on import for future use.

Related to #1944

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

    r3827 r3897  
    5151         */
    5252        public $short_description = '';
     53
     54        /**
     55         * @var string
     56         */
     57        public $license = '';
     58
     59        /**
     60         * @var string
     61         */
     62        public $license_uri = '';
    5363
    5464        /**
    … …  
    112122                'donate link'       => 'donate_link',
    113123                'stable tag'        => 'stable_tag',
     124                'license'           => 'license',
     125                'license uri'       => 'license_uri',
    114126        );
    115127
    … …  
    210222                if ( ! empty( $headers['donate_link'] ) ) {
    211223                        $this->donate_link = $headers['donate_link'];
     224                }
     225                if ( ! empty( $headers['license'] ) ) {
     226                        // Handle the many cases of "License: GPLv2 - http://..."
     227                        if ( empty( $headers['license_uri'] ) && preg_match( '!(https?://\S+)!i', $headers['license'], $url ) ) {
     228                                $headers['license_uri'] = $url[1];
     229                                $headers['license'] = trim( str_replace( $url[1], '', $headers['license'] ), " -*\t\n\r\n" );
     230                        }
     231                        $this->license = $headers['license'];
     232                }
     233                if ( ! empty( $headers['license_uri'] ) ) {
     234                        $this->license_uri = $headers['license_uri'];
    212235                }
    213236
Note: See TracChangeset for help on using the changeset viewer.