= $limit ) { if ( 'byoc' === Account::plan() ) { /* translators: 1: sends used, 2: plan limit. */ $issues[] = self::issue( 'quota_reached', 'error', sprintf( __( 'You have used %1$s of %2$s emails this month. SendFleet refuses further sends until the 1st (UTC). For a higher limit, email support@sendfleet.net with your monthly volume.', 'sendfleet' ), number_format_i18n( $used ), number_format_i18n( $limit ) ) ); } else { /* translators: 1: sends used, 2: plan limit. */ $issues[] = self::issue( 'quota_reached', 'error', sprintf( __( 'You have used %1$s of %2$s emails this month. SendFleet refuses further sends until the 1st (UTC) unless you upgrade.', 'sendfleet' ), number_format_i18n( $used ), number_format_i18n( $limit ) ) ); } } elseif ( $used >= 0.9 * $limit ) { /* translators: 1: sends used, 2: plan limit. */ $issues[] = self::issue( 'quota_near', 'warning', sprintf( __( 'You have used %1$s of %2$s emails this month.', 'sendfleet' ), number_format_i18n( $used ), number_format_i18n( $limit ) ) ); } } $next = Log::next_due(); if ( null !== $next && $next < time() - 15 * MINUTE_IN_SECONDS ) { $issues[] = self::issue( 'queue_stuck', 'warning', __( 'Queued emails have been waiting for more than 15 minutes. WP-Cron does not seem to run on this site; make sure it is not disabled without a system cron job calling wp-cron.php.', 'sendfleet' ) ); } usort( $issues, static function ( $a, $b ) { $order = array( 'error' => 0, 'warning' => 1, 'info' => 2, ); return $order[ $a['level'] ] - $order[ $b['level'] ]; } ); return $issues; } /** * Where wp_mail() is defined when something other than WordPress defines it. * * A plugin that redefines the pluggable function may never apply the * `pre_wp_mail` filter this plugin relies on. * * @return string Path relative to wp-content, or '' when core's own wp_mail() is in use. */ public static function wp_mail_override() { if ( ! function_exists( 'wp_mail' ) ) { return ''; } try { $file = wp_normalize_path( (string) ( new \ReflectionFunction( 'wp_mail' ) )->getFileName() ); } catch ( \ReflectionException $e ) { return ''; } if ( '' === $file || wp_normalize_path( ABSPATH . WPINC . '/pluggable.php' ) === $file ) { return ''; } $content = wp_normalize_path( WP_CONTENT_DIR ) . '/'; return 0 === strpos( $file, $content ) ? substr( $file, strlen( $content ) ) : wp_basename( $file ); } /** * Builds an issue entry. * * @param string $id Identifier. * @param string $level error, warning or info. * @param string $message Message. * @return array */ private static function issue( $id, $level, $message ) { return array( 'id' => $id, 'level' => $level, 'message' => $message, ); } }