234 | 234 | /* translators: %s: parent theme */ |
235 | 235 | 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' ), |
236 | 236 | '<code>' . $this->theme->parent() . '</code>' |
237 | 237 | ); |
238 | 238 | } |
239 | 239 | |
240 | 240 | // Is there already a theme with the name name by a different author? |
241 | 241 | if ( ! empty( $this->theme_post ) && $this->theme_post->post_author != $this->author->ID ) { |
242 | 242 | /* translators: 1: theme slug, 2: style.css */ |
243 | 243 | 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' ), |
244 | 244 | '<code>' . $this->theme_slug . '</code>', |
245 | 245 | '<code>style.css</code>' |
246 | 246 | ); |
247 | 247 | } |
248 | 248 | |
| 249 | // Check if the ThemeURI is already in use by another theme by another author. |
| 250 | if ( $theme_uri = $this->theme->get( 'ThemeURI' ) ) { |
| 251 | $theme_uris_matches = get_posts( array( |
| 252 | 'post_type' => 'repopackage', |
| 253 | 'post_status' => array( 'publish' ), |
| 254 | 'suppress_filters' => true, // This prevents the date-based query mods from running. |
| 255 | 'meta_query' => array( |
| 256 | array( |
| 257 | 'key' => '_theme_url', |
| 258 | 'value' => '"' . $theme_uri . '"', // Searching within a Serialized PHP value |
| 259 | 'compare' => 'LIKE' |
| 260 | ) |
| 261 | ) |
| 262 | ) ); |
| 263 | $theme_owners = wp_list_pluck( $theme_uris_matches, 'post_author' ); |
| 264 | |
| 265 | if ( $theme_owners && ! in_array( $this->author->ID, $theme_owners ) ) { |
| 266 | return sprintf( |
| 267 | __( 'There is already a theme using the Theme URL %s by a different author. TODO Please change ??? TODO', 'wporg-themes' ), |
| 268 | '<code>' . esc_html( $theme_uri ) . '</code>' |
| 269 | ); |
| 270 | } |
| 271 | } |
| 272 | |
249 | 273 | // We know it's the correct author, now we can check if it's suspended. |
250 | 274 | if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) { |
251 | 275 | /* translators: %s: mailto link */ |
252 | 276 | 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' ), |
253 | 277 | '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>' |
254 | 278 | ); |
255 | 279 | } |
256 | 280 | |
257 | 281 | // Don't send special themes through Theme Check. |
258 | 282 | if ( ! has_category( 'special-case-theme', $this->theme_post ) ) { |
259 | 283 | // Pass it through Theme Check and see how great this theme really is. |
260 | 284 | $result = $this->check_theme( $theme_files ); |
261 | 285 | |
262 | 286 | if ( ! $result ) { |
263 | 287 | /* translators: 1: Theme Check Plugin URL, 2: make.wordpress.org/themes */ |