Changeset 12997
- Timestamp:
- 12/04/2023 02:47:09 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php
r12996 r12997 266 266 */ 267 267 function get_plugin_or_theme_from_email( $request, $validate_slugs = false ) { 268 $subject = $request->subject ?? ( $request->ticket->subject ?? '' ); 269 $email_id = $request->id ?? ( $request->ticket->id ?? 0 ); 268 $subject = $request->subject ?? ( $request->ticket->subject ?? '' ); 269 $email_id = $request->id ?? ( $request->ticket->id ?? 0 ); 270 $mailbox_id = $request->mailboxId ?? ( $request->mailbox->id ?? 0 ); 270 271 271 272 $possible = [ … … 281 282 /* 282 283 * Plugin reviews, match the format of either: 284 * 283 285 * "[WordPress Plugin Directory] {Type Of Email}: {Plugin Title}" 284 286 * "[WordPress Plugin Directory] {Type Of Email} - {Plugin Title}" 287 * "[Translated WordPress Plugin Directory] {Translated Type} - {Plugin Title} 288 * 289 * Because of translations, we can't be sure of the exact wording, so we'll just hope that it matches the general format. 290 * NOTE: \p{Pd} is Regex for a dash-like character, which includes hyphens and ndashes. 285 291 */ 286 292 if ( 287 preg_match( '!\[WordPress Plugin Directory\][^:]+: (?P<title>.+)$!i', $subject, $m ) || 288 preg_match( '!\[WordPress Plugin Directory\].+? - (?P<title>.+)$!i', $subject, $m ) 293 ( 294 'plugins' === get_mailbox_name( $mailbox_id ) && 295 ( 296 preg_match( '!\[[^]]+\][^:]+: (?P<title>.+)$!i', $subject, $m ) || 297 preg_match( '!\[[^]]+\].+? \p{Pd} (?P<title>.+)$!iu', $subject, $m ) 298 ) 299 ) || ( 300 // Same as above, but in non-plugins mailboxes using the English strings only. 301 preg_match( '!\[WordPress Plugin Directory\][^:]+: (?P<title>.+)$!i', $subject, $m ) || 302 preg_match( '!\[WordPress Plugin Directory\].+? \p{Pd} (?P<title>.+)$!iu', $subject, $m ) 303 ) 289 304 ) { 290 305 switch_to_blog( WPORG_PLUGIN_DIRECTORY_BLOGID );
Note: See TracChangeset
for help on using the changeset viewer.