status, Assumptions::CONTENT_EXCLUDED_STATUSES, true ) ) { return array(); } $out = array(); $subject = $c->type . ' ' . $c->id; $ref = $ctx->referenceDate; if ( '' !== $ref ) { $date = self::onOrAfter( $c->postModified, $ref ) ? $c->postModified : ( self::onOrAfter( $c->postDate, $ref ) ? $c->postDate : '' ); if ( '' !== $date ) { $out[] = Finding::make( 'content_recent', $subject, array( $c->type, (string) $c->id, $c->title, (string) $c->authorId, $date ) ); } } $hit = self::marker( $c->content, $ctx ); if ( null !== $hit ) { // Up to 3 excerpts around distinct occurrences of the markers (D-09). $excerpt = Text::excerptsAround( $c->content, array_merge( Assumptions::CONTENT_MARKERS, Assumptions::JSON_ESCAPED_MARKERS, array( 'type, (string) $c->id, $c->title, $hit[0] ), $excerpt ); } if ( '' !== $ref && null !== $c->authorRegistered && self::onOrAfter( $c->authorRegistered, $ref ) ) { $out[] = Finding::make( 'content_author_recent', $subject, array( $c->type, (string) $c->id, $c->title, (string) $c->authorId, $c->authorRegistered, $ref ) ); } return $out; } private static function onOrAfter( string $datetime, string $ref ): bool { return '' !== $datetime && strcmp( substr( $datetime, 0, 10 ), $ref ) >= 0; } /** * First marker of CONTENT_MARKERS, or an iframe whose src is on another host. * * @return array{0:string,1:int}|null */ private static function marker( string $content, Context $ctx ) { $hit = Text::firstMarker( $content, array_merge( Assumptions::CONTENT_MARKERS, Assumptions::JSON_ESCAPED_MARKERS ) ); if ( null !== $hit ) { return $hit; } foreach ( Patterns::iframeSources( $content ) as $src ) { $host = Text::hostOf( $src ); if ( '' !== $host && ! Text::isSiteHost( $host, $ctx->siteHosts ) ) { $pos = strpos( $content, $src ); return array( '