Changeset 9050
- Timestamp:
- 07/16/2019 05:55:10 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r8976 r9050 26 26 public $readme_fields = array( 27 27 'tested', 28 'requires',29 'requires_php',30 28 'donate_link', 31 29 'license', … … 33 31 'upgrade_notice', 34 32 'screenshots', 33 34 // These headers are stored as post meta, but are handled separately. 35 // 'requires', 36 // 'requires_php', 35 37 ); 36 38 … … 40 42 'Name' => 'header_name', 41 43 'PluginURI' => 'header_plugin_uri', 42 'Version' => 'version',43 44 'Author' => 'header_author', 44 45 'AuthorURI' => 'header_author_uri', 45 46 'TextDomain' => 'header_textdomain', 47 48 // These headers are stored in these fields, but are handled separately. 49 // 'Version' => 'version', 50 // 'RequiresWP' => 'requires', 51 // 'RequiresPHP' => 'requires_php', 46 52 ); 47 53 … … 147 153 } 148 154 155 // Store the plugin headers we need. Note that 'Version', 'RequiresWP', and 'RequiresPHP' are handled below. 149 156 foreach ( $this->plugin_headers as $plugin_header => $meta_field ) { 150 if ( 'Version' == $plugin_header ) {151 continue; // We'll specifically update the latest version after everything is built.152 }153 157 update_post_meta( $plugin->ID, $meta_field, ( isset( $headers->$plugin_header ) ? wp_slash( $headers->$plugin_header ) : '' ) ); 154 158 } 155 159 156 update_post_meta( $plugin->ID, 'tagged_versions', wp_slash( $tagged_versions ) ); 157 update_post_meta( $plugin->ID, 'sections', wp_slash( array_keys( $readme->sections ) ) ); 160 // Update the Requires and Requires PHP fields, prefering those from the Plugin Headers. 161 // Unfortunately the value within $headers is not always a well-formed value. 162 $requires = $readme->requires; 163 $requires_php = $readme->requires_php; 164 if ( $headers->RequiresWP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresWP ) ) { 165 $requires = $headers->RequiresWP; 166 } 167 if ( $headers->RequiresPHP && preg_match( '!^[\d.]{3,}$!', $headers->RequiresPHP ) ) { 168 $requires_php = $headers->RequiresPHP; 169 } 170 171 update_post_meta( $plugin->ID, 'requires', wp_slash( $requires ) ); 172 update_post_meta( $plugin->ID, 'requires_php', wp_slash( $requires_php ) ); 173 update_post_meta( $plugin->ID, 'tagged_versions', wp_slash( $tagged_versions ) ); 174 update_post_meta( $plugin->ID, 'sections', wp_slash( array_keys( $readme->sections ) ) ); 158 175 update_post_meta( $plugin->ID, 'assets_screenshots', wp_slash( $assets['screenshot'] ) ); 159 update_post_meta( $plugin->ID, 'assets_icons', wp_slash( $assets['icon'] ) );160 update_post_meta( $plugin->ID, 'assets_banners', wp_slash( $assets['banner'] ) );161 update_post_meta( $plugin->ID, 'last_updated', wp_slash( $plugin->post_modified_gmt ) );162 update_post_meta( $plugin->ID, 'plugin_status', wp_slash( $plugin->post_status ) );176 update_post_meta( $plugin->ID, 'assets_icons', wp_slash( $assets['icon'] ) ); 177 update_post_meta( $plugin->ID, 'assets_banners', wp_slash( $assets['banner'] ) ); 178 update_post_meta( $plugin->ID, 'last_updated', wp_slash( $plugin->post_modified_gmt ) ); 179 update_post_meta( $plugin->ID, 'plugin_status', wp_slash( $plugin->post_status ) ); 163 180 164 181 // Calculate the 'plugin color' from the average color of the banner if provided. This is used for fallback icons. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-validator.php
r8469 r9050 86 86 '<code>' . number_format( $latest_wordpress_version - 0.1, 1 ) . '</code>' 87 87 ); 88 } elseif ( empty( $readme->requires ) ) {89 $warnings[] = sprintf(90 /* translators: %s: plugin header tag */91 __( 'The %s field is missing.', 'wporg-plugins' ),92 '<code>Requires at least</code>'93 );94 88 } 95 89 … … 120 114 '<code>7.0</code>' 121 115 ); 122 } elseif ( empty( $readme->requires_php ) ) {123 $warnings[] = sprintf(124 /* translators: %s: plugin header tag */125 __( 'The %s field is missing.', 'wporg-plugins' ),126 '<code>Requires PHP</code>'127 );128 116 } 117 129 118 if ( empty( $readme->stable_tag ) ) { 130 119 $warnings[] = sprintf( … … 152 141 153 142 // Notes. 143 if ( empty( $readme->requires ) ) { 144 $notes[] = sprintf( 145 /* translators: %s: plugin header tag */ 146 __( 'The %s field is missing. It should be defined here, or in your main plugin file.', 'wporg-plugins' ), 147 '<code>Requires at least</code>' 148 ); 149 } 150 151 if ( empty( $readme->requires_php ) ) { 152 $notes[] = sprintf( 153 /* translators: %s: plugin header tag */ 154 __( 'The %s field is missing. It should be defined here, or in your main plugin file.', 'wporg-plugins' ), 155 '<code>Requires PHP</code>' 156 ); 157 } 158 154 159 if ( empty( $readme->sections['faq'] ) ) { 155 160 $notes[] = sprintf( … … 159 164 ); 160 165 } 166 161 167 if ( empty( $readme->sections['changelog'] ) ) { 162 168 $notes[] = sprintf( … … 166 172 ); 167 173 } 174 168 175 if ( empty( $readme->upgrade_notice ) ) { 169 176 $notes[] = sprintf( … … 173 180 ); 174 181 } 182 175 183 if ( empty( $readme->screenshots ) ) { 176 184 $notes[] = sprintf( … … 180 188 ); 181 189 } 190 182 191 if ( empty( $readme->donate_link ) ) { 183 192 $notes[] = __( 'No donate link was found', 'wporg-plugins' );
Note: See TracChangeset
for help on using the changeset viewer.