Making WordPress.org

Ticket #2952: 2952.patch

File 2952.patch, 11.7 KB (added by SergeyBiryukov, 8 years ago)
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-custom-fields.php

     
    1414                        'stable_tag' => 'Stable Tag',
    1515                        'tested' => 'Tested With',
    1616                        'requires' => 'Requires',
     17                        'minimum_php' => 'Minimum PHP',
    1718                        'donate_link' => 'Donate URL',
    1819                        'header_plugin_uri' => 'Plugin URI',
    1920                        'header_author' => 'Plugin Author',
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php

     
    9999
    100100                $result['requires'] = get_post_meta( $post_id, 'requires', true ) ?: false;
    101101                $result['tested'] = get_post_meta( $post_id, 'tested', true ) ?: false;
     102                $result['minimum_php'] = get_post_meta( $post_id, 'minimum_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
    104105                $result['ratings'] = array_map( 'intval', (array) get_post_meta( $post_id, 'ratings', true ) );
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

     
    367367                        'show_in_rest'      => true,
    368368                ) );
    369369
     370                register_meta( 'post', 'minimum_php', array(
     371                        'description'       => __( 'The minimum version of PHP the plugin needs to run.', 'wporg-plugins' ),
     372                        'single'            => true,
     373                        // TODO 'sanitize_callback' => 'absint',
     374                        'show_in_rest'      => true,
     375                ) );
     376
    370377                register_meta( 'post', 'stable_tag', array(
    371378                        'description'       => __( 'Stable version of the plugin', 'wporg-plugins' ),
    372379                        'single'            => true,
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

     
    2525        public $readme_fields = array(
    2626                'tested',
    2727                'requires',
     28                'minimum_php',
    2829                'donate_link',
    2930                'license',
    3031                'license_uri',
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-api-update-updater.php

     
    7171                        'plugin_name_san' => sanitize_title_with_dashes( get_post_meta( $post->ID, 'header_name', true ) ),
    7272                        'tested'          => get_post_meta( $post->ID, 'tested', true ),
    7373                        'requires'        => get_post_meta( $post->ID, 'requires', true ),
     74                        'minimum_php'     => get_post_meta( $post->ID, 'minimum_php', true ),
    7475                        'upgrade_notice'  => '',
    7576                        'last_updated'    => $post->post_modified,
    7677                );
     
    122123  `plugin_name_san` varchar(255) NOT NULL DEFAULT '',
    123124  `tested` varchar(128) NOT NULL DEFAULT '',
    124125  `requires` varchar(128) NOT NULL DEFAULT '',
     126  `minimum_php` varchar(128) NOT NULL DEFAULT '',
    125127  `upgrade_notice` text,
    126128  `last_updated` datetime NOT NULL,
    127129  PRIMARY KEY (`plugin_id`),
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

     
    3232        public $tested = '';
    3333
    3434        /**
     35         * @var string
     36         */
     37        public $minimum_php = '';
     38
     39        /**
    3540         * @var array
    3641         */
    3742        public $contributors = array();
     
    117122                'tested up to'      => 'tested',
    118123                'requires'          => 'requires',
    119124                'requires at least' => 'requires',
     125                'minimum php'       => 'minimum_php',
    120126                'tags'              => 'tags',
    121127                'contributors'      => 'contributors',
    122128                'donate link'       => 'donate_link',
     
    227233                if ( ! empty( $headers['tested'] ) ) {
    228234                        $this->tested = $headers['tested'];
    229235                }
     236                if ( ! empty( $headers['minimum_php'] ) ) {
     237                        $this->minimum_php = $headers['minimum_php'];
     238                }
    230239                if ( ! empty( $headers['contributors'] ) ) {
    231240                        $this->contributors = explode( ',', $headers['contributors'] );
    232241                        $this->contributors = array_map( 'trim', $this->contributors );
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-validator.php

     
    7575                        /* Translators: Plugin header tag; */
    7676                        $warnings[] = sprintf( __( '%s is missing.', 'wporg-plugins' ), '<code>Tested up to</code>' );
    7777                }
     78                if ( empty( $readme->minimum_php ) ) {
     79                        /* Translators: Plugin header tag; */
     80                        $warnings[] = sprintf( __( '%s is missing.', 'wporg-plugins' ), '<code>Minimum PHP</code>' );
     81                }
    7882                if ( empty( $readme->stable_tag ) ) {
    7983                        /* Translators: 1: Plugin header tag; 2: SVN directory; 3: Plugin header tag; */
    8084                        $warnings[] = sprintf( __( '%1$s is missing.  Hint: If you treat %2$s as stable, put %3$s.', 'wporg-plugins' ), '<code>Stable tag</code>', '<code>/trunk/</code>', '<code>Stable tag: trunk</code>' );
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

     
    215215                                'meta_input'   => array(
    216216                                        'tested'                   => $readme->tested,
    217217                                        'requires'                 => $readme->requires,
     218                                        'minimum_php'              => $readme->minimum_php,
    218219                                        'stable_tag'               => $readme->stable_tag,
    219220                                        'upgrade_notice'           => $readme->upgrade_notice,
    220221                                        'contributors'             => $readme->contributors,
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php

     
    2222                'homepage'          => false,
    2323                'icons'             => false,
    2424                'last_updated'      => false,
     25                'minimum_php'       => false,
    2526                'rating'            => false,
    2627                'ratings'           => false,
    2728                'reviews'           => false,
     
    4243                'donate_link'       => true,
    4344                'homepage'          => true,
    4445                'last_updated'      => true,
     46                'minimum_php'       => true,
    4547                'rating'            => true,
    4648                'ratings'           => true,
    4749                'requires'          => true,                           
     
    5961                'donate_link'       => true,
    6062                'homepage'          => true,
    6163                'last_updated'      => true,
     64                'minimum_php'       => true,
    6265                'rating'            => true,
    6366                'ratings'           => true,
    6467                'requires'          => true,                           
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api-performance.php

     
    2424                'sections'          => true,
    2525                'tested'            => true,
    2626                'requires'          => true,
     27                'minimum_php'       => true,
    2728                'rating'            => true,
    2829                'ratings'           => true,
    2930                'downloaded'        => true,
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api.php

     
    2323                'sections'          => true,
    2424                'tested'            => true,
    2525                'requires'          => true,
     26                'minimum_php'       => true,
    2627                'rating'            => true,
    2728                'ratings'           => true,
    2829                'downloaded'        => true,
     
    241242                        $this->assertObjectHasAttribute( 'tested', $plugin_info, 'Tested exists' );
    242243                        $this->assertAttributeInternalType( 'string', 'tested', $plugin_info, 'Tested should be a string' );
    243244                }
     245                $this->assertObjectHasAttribute( 'minimum_php', $plugin_info, 'Minimum PHP exists' );
    244246                $this->assertObjectHasAttribute( 'compatibility', $plugin_info, 'Compatibility exists' );
    245247                $this->assertAttributeInternalType( 'array', 'compatibility', $plugin_info, 'Compatibility should be an array' );
    246248
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php

     
    4949                        </li>
    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; ?>
     57                        <?php endif; ?>
    5858
    59 
    60 
    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>
    6361                        <?php endif; ?>
    6462
     63                        <?php if ( $minimum_php = (string) get_post_meta( $post->ID, 'minimum_php', true ) ) : ?>
     64                                <li><?php
     65                                _e( 'Minimum PHP Version:', 'wporg-plugins' );
     66                                echo '<strong>' . esc_html( $minimum_php ) . '</strong>';
     67                                ?></li>
     68                        <?php endif; ?>
     69
    6570                        <?php if ( $tags = get_the_term_list( $post->ID, 'plugin_tags', '<div class="tags">', '', '</div>' ) ) : ?>
    6671                                <li class="clear"><?php
    6772                                        $terms = get_the_terms( $post, 'plugin_tags' );