Changeset 10431
- Timestamp:
- 11/06/2020 04:30:43 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
r10418 r10431 156 156 '<code>Theme Name:</code>', 157 157 '<code>style.css</code>', 158 __( 'https://codex.wordpress.org/Theme_Development#Theme_Style _Sheet', 'wporg-themes' )158 __( 'https://codex.wordpress.org/Theme_Development#Theme_Stylesheet', 'wporg-themes' ) 159 159 ); 160 160 … … 197 197 '<code>Description:</code>', 198 198 '<code>style.css</code>', 199 __( 'https://codex.wordpress.org/Theme_Development#Theme_Style _Sheet', 'wporg-themes' )199 __( 'https://codex.wordpress.org/Theme_Development#Theme_Stylesheet', 'wporg-themes' ) 200 200 ); 201 201 … … 210 210 '<code>Tags:</code>', 211 211 '<code>style.css</code>', 212 __( 'https://codex.wordpress.org/Theme_Development#Theme_Style _Sheet', 'wporg-themes' )212 __( 'https://codex.wordpress.org/Theme_Development#Theme_Stylesheet', 'wporg-themes' ) 213 213 ); 214 214 … … 223 223 '<code>Version:</code>', 224 224 '<code>style.css</code>', 225 __( 'https://codex.wordpress.org/Theme_Development#Theme_Style _Sheet', 'wporg-themes' )225 __( 'https://codex.wordpress.org/Theme_Development#Theme_Stylesheet', 'wporg-themes' ) 226 226 ); 227 227 … … 236 236 } 237 237 238 // Make sure we have version that is higher than any previously uploaded version of this theme. 238 // Version is greater than current version happens after authorship checks. 239 240 // Prevent duplicate URLs. 241 $themeuri = $this->theme->get( 'ThemeURI' ); 242 $authoruri = $this->theme->get( 'AuthorURI' ); 243 if ( !empty( $themeuri ) && !empty( $authoruri ) && $themeuri == $authoruri ) { 244 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' ); 245 } 246 247 // Check for child theme's parent in the directory (non-buddypress only) 248 if ( $this->theme->parent() && ! in_array( 'buddypress', $this->theme->get( 'Tags' ) ) && ! $this->is_parent_available() ) { 249 /* translators: %s: parent theme */ 250 return 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' ), 251 '<code>' . $this->theme->parent() . '</code>' 252 ); 253 } 254 255 // Generic text to suggest "Are you in the right place?" 256 $are_you_in_the_right_place = '<br>' . 257 __( 'The WordPress.org Theme Directory is for sharing a unique theme with others, duplicates are not allowed.', 'wporg-themes' ) . 258 '<br>' . 259 sprintf( 260 /* translators: %s: A link to https://wordpress.org/support/article/using-themes/ */ 261 __( "If you're attempting to install a theme on your website, <a href='%s'>please see this article</a>.", 'wporg-themes' ), 262 'https://wordpress.org/support/article/using-themes/' 263 ); 264 265 // Is there already a theme with the name name by a different author? 266 if ( ! empty( $this->theme_post ) && $this->theme_post->post_author != $this->author->ID ) { 267 /* translators: 1: theme slug, 2: style.css */ 268 return 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' ), 269 '<code>' . $this->theme_slug . '</code>', 270 '<code>style.css</code>' 271 ) . $are_you_in_the_right_place; 272 } 273 274 // Check if the ThemeURI is already in use by another theme by another author. 275 if ( empty( $this->theme_post ) && ! empty( $themeuri ) ) { 276 $theme_uri_matches = get_posts( [ 277 'post_type' => 'repopackage', 278 'post_status' => 'publish', 279 'meta_query' => [ 280 'theme_uri_search' => [ 281 'key' => '_theme_url', 282 'value' => '"' . $themeuri . '"', // Searching within a Serialized PHP value 283 'compare' => 'LIKE' 284 ], 285 ] 286 ] ); 287 $theme_owners = wp_list_pluck( $theme_uri_matches, 'post_author' ); 288 289 if ( $theme_owners && ! in_array( $this->author->ID, $theme_owners ) ) { 290 return sprintf( 291 /* translators: 1: theme name, 2: style.css */ 292 __( 'There is already a theme using the Theme URL %1$s by a different author. Please check the URI of your theme in %2$s and upload it again.', 'wporg-themes' ), 293 '<code>' . esc_html( $theme_uri ) . '</code>', 294 '<code>style.css</code>' 295 ) . $are_you_in_the_right_place; 296 } 297 } 298 299 // We know it's the correct author, now we can check if it's suspended. 300 if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) { 301 /* translators: %s: mailto link */ 302 return 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' ), 303 '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>' 304 ); 305 } 306 307 // Make sure we have version that is higher than any previously uploaded version of this theme. This check happens last to allow the non-author blocks to kick in. 239 308 if ( ! empty( $this->theme_post ) && ! version_compare( $this->theme->get( 'Version' ), $this->theme_post->max_version, '>' ) ) { 240 309 /* translators: 1: theme name, 2: theme version, 3: style.css */ … … 243 312 '<code>' . $this->theme_post->max_version . '</code>', 244 313 '<code>style.css</code>' 245 );246 }247 248 // Prevent duplicate URLs.249 $themeuri = $this->theme->get( 'ThemeURI' );250 $authoruri = $this->theme->get( 'AuthorURI' );251 if ( !empty( $themeuri ) && !empty( $authoruri ) && $themeuri == $authoruri ) {252 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' );253 }254 255 // Check for child theme's parent in the directory (non-buddypress only)256 if ( $this->theme->parent() && ! in_array( 'buddypress', $this->theme->get( 'Tags' ) ) && ! $this->is_parent_available() ) {257 /* translators: %s: parent theme */258 return 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' ),259 '<code>' . $this->theme->parent() . '</code>'260 );261 }262 263 // Is there already a theme with the name name by a different author?264 if ( ! empty( $this->theme_post ) && $this->theme_post->post_author != $this->author->ID ) {265 /* translators: 1: theme slug, 2: style.css */266 return 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' ),267 '<code>' . $this->theme_slug . '</code>',268 '<code>style.css</code>'269 );270 }271 272 // We know it's the correct author, now we can check if it's suspended.273 if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) {274 /* translators: %s: mailto link */275 return 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' ),276 '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>'277 314 ); 278 315 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/query-modifications.php
r10322 r10431 127 127 empty( $query->query_vars['author_name'] ) && 128 128 ! in_array( $query->query_vars['browse'], array( 'favorites', 'new', 'updated' ) ) && 129 empty( $query->query_vars['meta_query']['trac_sync_ticket_id'] ) // jobs/class-trac-sync.php - Always needs to find the post, and looks up via a meta search. 129 empty( $query->query_vars['meta_query']['trac_sync_ticket_id'] ) && // jobs/class-trac-sync.php - Always needs to find the post, and looks up via a meta search. 130 empty( $query->query_vars['meta_query']['theme_uri_search'] ) // class-wporg-themes-upload.php - Searching all known themes by meta value. 130 131 ) { 131 132 $query->query_vars['date_query']['recent_themes_only'] = array(
Note: See TracChangeset
for help on using the changeset viewer.