Changeset 11168
- Timestamp:
- 08/09/2021 02:21:50 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php
r11150 r11168 161 161 * Runs various tests, creates Trac ticket, repopackage post, and saves the files to the SVN repo. 162 162 * 163 * @return stringFailure or success message.163 * @return mixed Failure or success message. 164 164 */ 165 165 public function process_upload( $file_upload ) { … … 188 188 } 189 189 190 $style_errors = array(); 191 190 192 // Do we have a readme.txt? Fetch extra data from there too. 191 193 $this->readme = $this->get_readme_data( $theme_files ); … … 197 199 if ( ! $this->has_screenshot( $theme_files ) ) { 198 200 /* translators: 1: screenshot.png, 2: screenshot.jpg */ 199 returnsprintf( __( 'The zip file must include a file named %1$s or %2$s.', 'wporg-themes' ),201 $style_errors[] = sprintf( __( 'The zip file must include a file named %1$s or %2$s.', 'wporg-themes' ), 200 202 '<code>screenshot.png</code>', 201 203 '<code>screenshot.jpg</code>' … … 224 226 ); 225 227 226 return$error;228 $style_errors[] = $error; 227 229 } 228 230 … … 230 232 if ( false !== strpos( $this->theme_slug, 'wordpress' ) || preg_match( '/\btheme\b/i', $this->theme_slug ) ) { 231 233 /* translators: 1: 'WordPress', 2: 'theme' */ 232 returnsprintf( __( 'You cannot use %1$s or %2$s in your theme name.', 'wporg-themes' ),234 $style_errors[] = sprintf( __( 'You cannot use %1$s or %2$s in your theme name.', 'wporg-themes' ), 233 235 'WordPress', 234 236 'theme' … … 243 245 if ( $this->has_reserved_slug() ) { 244 246 /* translators: 1: theme slug, 2: style.css */ 245 returnsprintf( __( 'Sorry, the theme name %1$s is reserved for use by WordPress Core. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ),247 $style_errors[] = sprintf( __( 'Sorry, the theme name %1$s is reserved for use by WordPress Core. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ), 246 248 '<code>' . $this->theme_slug . '</code>', 247 249 '<code>style.css</code>' … … 263 265 ); 264 266 265 return$error;267 $style_errors[] = $error; 266 268 } 267 269 … … 276 278 ); 277 279 278 return$error;280 $style_errors[] = $error; 279 281 } 280 282 … … 289 291 ); 290 292 291 return $error; 292 } 293 294 if ( preg_match( '|[^\d\.]|', $this->theme->get( 'Version' ) ) ) { 293 $style_errors[] = $error; 294 295 } else if ( preg_match( '|[^\d\.]|', $this->theme->get( 'Version' ) ) ) { 295 296 /* translators: %s: style.css */ 296 returnsprintf( __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in %s and upload your theme again.', 'wporg-themes' ),297 $style_errors[] = sprintf( __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in %s and upload your theme again.', 'wporg-themes' ), 297 298 '<code>style.css</code>' 298 299 ); … … 305 306 $authoruri = $this->theme->get( 'AuthorURI' ); 306 307 if ( !empty( $themeuri ) && !empty( $authoruri ) && $themeuri == $authoruri ) { 307 return__( 'Duplicate theme and author URLs. A theme URL is a page/site that provides details about this specific theme. An author URL is a page/site that provides information about the author of the theme. You aren’t required to provide both, so pick the one that best applies to your URL.', 'wporg-themes' );308 $style_errors[] = __( 'Duplicate theme and author URLs. A theme URL is a page/site that provides details about this specific theme. An author URL is a page/site that provides information about the author of the theme. You aren’t required to provide both, so pick the one that best applies to your URL.', 'wporg-themes' ); 308 309 } 309 310 … … 311 312 if ( $this->theme->parent() && ! in_array( 'buddypress', $this->theme->get( 'Tags' ) ) && ! $this->is_parent_available() ) { 312 313 /* translators: %s: parent theme */ 313 returnsprintf( __( 'There is no theme called %s in the directory. For child themes, you must use a parent theme that already exists in the directory.', 'wporg-themes' ),314 $style_errors[] = sprintf( __( 'There is no theme called %s in the directory. For child themes, you must use a parent theme that already exists in the directory.', 'wporg-themes' ), 314 315 '<code>' . $this->theme->parent() . '</code>' 315 316 ); … … 342 343 if ( ! $is_allowed_to_upload_for_theme ) { 343 344 /* translators: 1: theme slug, 2: style.css */ 344 returnsprintf( __( 'There is already a theme called %1$s by a different author. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ),345 $style_errors[] = sprintf( __( 'There is already a theme called %1$s by a different author. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ), 345 346 '<code>' . $this->theme_slug . '</code>', 346 347 '<code>style.css</code>' … … 365 366 366 367 if ( $theme_owners && ! in_array( $this->author->ID, $theme_owners ) ) { 367 returnsprintf(368 $style_errors[] = sprintf( 368 369 /* translators: 1: theme name, 2: style.css */ 369 370 __( 'There is already a theme using the Theme URL %1$s by a different author. Please check the URL of your theme in %2$s and upload it again.', 'wporg-themes' ), … … 377 378 if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) { 378 379 /* translators: %s: mailto link */ 379 returnsprintf( __( 'This theme is suspended from the Theme Repository and it can’t be updated. If you have any questions about this please contact %s.', 'wporg-themes' ),380 $style_errors[] = sprintf( __( 'This theme is suspended from the Theme Repository and it can’t be updated. If you have any questions about this please contact %s.', 'wporg-themes' ), 380 381 '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>' 381 382 ); … … 385 386 if ( ! empty( $this->theme_post ) && ! version_compare( $this->theme->get( 'Version' ), $this->theme_post->max_version, '>' ) ) { 386 387 /* translators: 1: theme name, 2: theme version, 3: style.css */ 387 returnsprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in %3$s, then upload your zip file again.', 'wporg-themes' ),388 $style_errors[] = sprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in %3$s, then upload your zip file again.', 'wporg-themes' ), 388 389 $this->theme->display( 'Name' ), 389 390 '<code>' . $this->theme_post->max_version . '</code>', 390 391 '<code>style.css</code>' 391 392 ); 393 } 394 395 // If we had any issues with information in the style.css, exit early. 396 if ( ! empty( $style_errors ) ) { 397 return $style_errors; 392 398 } 393 399 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
r10806 r11168 50 50 51 51 if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-themes-upload' ) && 'upload' === $_POST['action'] ) { 52 $message = wporg_themes_process_upload();52 $messages = wporg_themes_process_upload(); 53 53 54 if ( ! empty( $message ) ) { 55 $notice = "<div class='notice notice-warning'><p>{$message}</p></div>"; 54 if ( ! empty( $messages ) ) { 55 $notice_content = ""; 56 57 if ( is_array( $messages ) ) { 58 foreach ( $messages as $message){ 59 $notice_content .= "<li>{$message}</li>"; 60 } 61 } else { 62 $notice_content = "<li>{$messages}</li>"; 63 } 64 65 $notice = "<h2>" . esc_html__( 'Upload Errors', 'wporg-themes' ) . "</h2><div class='notice notice-error notice-large'><ul>{$notice_content}</ul></div>"; 56 66 } 57 67 }
Note: See TracChangeset
for help on using the changeset viewer.