Making WordPress.org

Changeset 5841


Ignore:
Timestamp:
08/25/2017 08:17:03 AM (7 years ago)
Author:
tellyworth
Message:

Plugin directory: soft launch support for Requires PHP header in readme.txt. Props @SergeyBiryukov

See #2952

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-custom-fields.php

    r2983 r5841  
    1515            'tested' => 'Tested With',
    1616            'requires' => 'Requires',
     17            'requires_php' => 'Requires PHP',
    1718            'donate_link' => 'Donate URL',
    1819            'header_plugin_uri' => 'Plugin URI',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php

    r5473 r5841  
    100100        $result['requires'] = get_post_meta( $post_id, 'requires', true ) ?: false;
    101101        $result['tested'] = get_post_meta( $post_id, 'tested', true ) ?: false;
     102        $result['requires_php'] = get_post_meta( $post_id, 'requires_php', true ) ?: false;
    102103        $result['compatibility'] = array();
    103104        $result['rating'] = ( get_post_meta( $post_id, 'rating', true ) ?: 0 ) * 20; // Stored as 0.0 ~ 5.0, API outputs as 0..100
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5725 r5841  
    365365        register_meta( 'post', 'requires', array(
    366366            'description'       => __( 'The minimum version of WordPress the plugin needs to run.', 'wporg-plugins' ),
     367            'single'            => true,
     368            // TODO 'sanitize_callback' => 'absint',
     369            'show_in_rest'      => true,
     370        ) );
     371
     372        register_meta( 'post', 'requires_php', array(
     373            'description'       => __( 'The minimum version of PHP the plugin needs to run.', 'wporg-plugins' ),
    367374            'single'            => true,
    368375            // TODO 'sanitize_callback' => 'absint',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r5449 r5841  
    2626        'tested',
    2727        'requires',
     28        'requires_php',
    2829        'donate_link',
    2930        'license',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-api-update-updater.php

    r5449 r5841  
    7272            'tested'          => get_post_meta( $post->ID, 'tested', true ),
    7373            'requires'        => get_post_meta( $post->ID, 'requires', true ),
     74            'requires_php'    => get_post_meta( $post->ID, 'requires_php', true ),
    7475            'upgrade_notice'  => '',
    7576            'last_updated'    => $post->post_modified,
     
    123124  `tested` varchar(128) NOT NULL DEFAULT '',
    124125  `requires` varchar(128) NOT NULL DEFAULT '',
     126  `requires_php` varchar(128) NOT NULL DEFAULT '',
    125127  `upgrade_notice` text,
    126128  `last_updated` datetime NOT NULL,
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

    r5565 r5841  
    3131     */
    3232    public $tested = '';
     33
     34    /**
     35     * @var string
     36     */
     37    public $requires_php = '';
    3338
    3439    /**
     
    118123        'requires'          => 'requires',
    119124        'requires at least' => 'requires',
     125        'requires php'      => 'requires_php',
    120126        'tags'              => 'tags',
    121127        'contributors'      => 'contributors',
     
    227233        if ( ! empty( $headers['tested'] ) ) {
    228234            $this->tested = $headers['tested'];
     235        }
     236        if ( ! empty( $headers['requires_php'] ) ) {
     237            $this->requires_php = $headers['requires_php'];
    229238        }
    230239        if ( ! empty( $headers['contributors'] ) ) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-validator.php

    r4261 r5841  
    7676            $warnings[] = sprintf( __( '%s is missing.', 'wporg-plugins' ), '<code>Tested up to</code>' );
    7777        }
     78        if ( empty( $readme->requires_php ) ) {
     79            /* Translators: Plugin header tag; */
     80            $warnings[] = sprintf( __( '%s is missing.', 'wporg-plugins' ), '<code>Requires PHP</code>' );
     81        }
    7882        if ( empty( $readme->stable_tag ) ) {
    7983            /* Translators: 1: Plugin header tag; 2: SVN directory; 3: Plugin header tag; */
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r5708 r5841  
    217217                    'tested'                   => $readme->tested,
    218218                    'requires'                 => $readme->requires,
     219                    'requires_php'             => $readme->requires_php,
    219220                    'stable_tag'               => $readme->stable_tag,
    220221                    'upgrade_notice'           => $readme->upgrade_notice,
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php

    r5383 r5841  
    2727        'reviews'           => false,
    2828        'requires'          => false,
     29        'requires_php'      => false,
    2930        'sections'          => false,
    3031        'short_description' => false,
     
    4647        'ratings'           => true,
    4748        'requires'          => true,               
     49        'requires_php'      => true,
    4850        'sections'          => true,
    4951        'tags'              => true,
     
    6365        'ratings'           => true,
    6466        'requires'          => true,               
     67        'requires_php'      => true,
    6568        'sections'          => true,
    6669        'short_description' => true,
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api-performance.php

    r5008 r5841  
    2525        'tested'            => true,
    2626        'requires'          => true,
     27        'requires_php'      => true,
    2728        'rating'            => true,
    2829        'ratings'           => true,
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api.php

    r4900 r5841  
    2424        'tested'            => true,
    2525        'requires'          => true,
     26        'requires_php'      => true,
    2627        'rating'            => true,
    2728        'ratings'           => true,
     
    242243            $this->assertAttributeInternalType( 'string', 'tested', $plugin_info, 'Tested should be a string' );
    243244        }
     245        $this->assertObjectHasAttribute( 'requires_php', $plugin_info, 'Requires PHP exists' );
    244246        $this->assertObjectHasAttribute( 'compatibility', $plugin_info, 'Compatibility exists' );
    245247        $this->assertAttributeInternalType( 'array', 'compatibility', $plugin_info, 'Compatibility should be an array' );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php

    r5566 r5841  
    5050            <li><?php printf( __( 'Active installs: %s', 'wporg-plugins' ), '<strong>' . Template::active_installs( false ) . '</strong>' ); ?></li>
    5151
    52             <?php if ( $requires = (string) get_post_meta( $post->ID, 'requires', true ) ) : ?>
     52            <?php if ( $requires = (string) get_post_meta( $post->ID, 'requires', true ) ) : ?>
    5353                <li><?php
    5454                _e( 'Requires WordPress Version:', 'wporg-plugins' );
    5555                echo '<strong>' . esc_html( $requires ) . '</strong>';
    5656                ?></li>
    57             <?php endif; ?>
    58 
    59 
     57            <?php endif; ?>
    6058
    6159            <?php if ( $tested_up_to = (string) get_post_meta( $post->ID, 'tested', true ) ) : ?>
    6260                <li><?php printf( __( 'Tested up to: %s', 'wporg-plugins' ), '<strong>' . $tested_up_to . '</strong>' ); ?></li>
     61            <?php endif; ?>
     62
     63            <?php if ( $requires_php = (string) get_post_meta( $post->ID, 'requires_php', true ) ) : ?>
     64                <li><?php
     65                _e( 'Requires PHP Version:', 'wporg-plugins' );
     66                echo '<strong>' . esc_html( $requires_php ) . '</strong>';
     67                ?></li>
    6368            <?php endif; ?>
    6469
Note: See TracChangeset for help on using the changeset viewer.