label. * @type array $cron WP-Cron status (SettingsPage::cron_status()). * @type array $brief Weekly brief configuration, last claim and safe scheduled outcome. * } */ // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included by View::render() inside a function, so these variables are local, not globals. use TurtleReport\Admin\Actions\FormActions; use TurtleReport\Policy\Schedule; defined( 'ABSPATH' ) || exit; if ( array_diff_key( isset( $args['job_failures'] ) && is_array( $args['job_failures'] ) ? $args['job_failures'] : array(), array( 'brief' => true ) ) ) { ?>

array(), 'schedules' => array(), 'intervals' => \TurtleReport\Policy\Schedule::interval_labels(), 'cron' => array( 'disabled' => false, 'next' => 0, 'late' => false, 'beat' => 0, 'stalled' => false, 'url' => '', ), 'defaults' => Schedule::normalize( array() ), 'slack' => array( 'configured' => false, 'hint' => '', ), 'brief' => array( 'next' => 0, 'to' => array(), ), ); $tly_s = $args['settings']; // One line under each folded section's title, so a closed section still says what it holds. $tly_brand = '' !== (string) $tly_s['brand_name'] ? (string) $tly_s['brand_name'] : (string) get_bloginfo( 'name' ); $tly_from = '' !== (string) $tly_s['email_from_name'] ? (string) $tly_s['email_from_name'] : $tly_brand; $tly_alertn = count( (array) $tly_s['alert_user_ids'] ) + count( (array) $tly_s['alert_emails'] ); $tly_aip = isset( $args['ai']['providers'][ $tly_s['ai_provider'] ] ) ? $args['ai']['providers'][ $tly_s['ai_provider'] ] : ( ! empty( $args['ai']['providers'] ) ? reset( $args['ai']['providers'] ) : null ); $tly_daysn = array( 1 => __( 'Monday', 'turtlereport' ), 2 => __( 'Tuesday', 'turtlereport' ), 3 => __( 'Wednesday', 'turtlereport' ), 4 => __( 'Thursday', 'turtlereport' ), 5 => __( 'Friday', 'turtlereport' ), 6 => __( 'Saturday', 'turtlereport' ), 7 => __( 'Sunday', 'turtlereport' ), ); $tly_mon = array( 'relaxed' === $tly_s['monitor_sensitivity'] ? __( 'Daily check on, drops of 30%+', 'turtlereport' ) : __( 'Daily check on, drops of 20%+', 'turtlereport' ) ); if ( $args['slack']['configured'] ) { $tly_mon[] = __( 'Slack connected', 'turtlereport' ); } if ( ! empty( $tly_s['brief_enabled'] ) ) { /* translators: 1: weekday, 2: time. */ $tly_mon[] = sprintf( __( 'weekly summary on %1$s at %2$s', 'turtlereport' ), $tly_daysn[ min( 7, max( 1, (int) $tly_s['brief_weekday'] ) ) ], wp_date( (string) get_option( 'time_format' ), (int) $tly_s['brief_hour'] * HOUR_IN_SECONDS, new DateTimeZone( 'UTC' ) ) ); } else { $tly_mon[] = __( 'weekly summary off', 'turtlereport' ); } $tly_sum = array( 'sender' => '' !== (string) $tly_s['email_reply_to'] /* translators: 1: sender name, 2: reply-to address. */ ? sprintf( __( 'From “%1$s” · replies go to %2$s', 'turtlereport' ), $tly_from, $tly_s['email_reply_to'] ) /* translators: %s: sender name. */ : sprintf( __( 'From “%s” · no reply-to address', 'turtlereport' ), $tly_from ), 'branding' => implode( ' · ', array( $tly_brand, $args['logo_url'] ? __( 'logo set', 'turtlereport' ) : __( 'no logo', 'turtlereport' ), /* translators: %s: colour, e.g. #0f6b50. */ sprintf( __( 'colour %s', 'turtlereport' ), (string) $tly_s['brand_color'] ), ( empty( $tly_s['credit_opt_in'] ) || $tly_s['hide_credit'] ) ? __( 'TurtleReport credit hidden', 'turtlereport' ) : __( 'TurtleReport credit shown', 'turtlereport' ), ) ), 'alerts' => ! empty( $tly_s['alerts_enabled'] ) ? ( $tly_alertn /* translators: %d: number of recipients. */ ? sprintf( _n( 'On · emails %d person when a connection breaks', 'On · emails %d people when a connection breaks', $tly_alertn, 'turtlereport' ), $tly_alertn ) : __( 'On · emails the site admin when a connection breaks', 'turtlereport' ) ) : __( 'Off', 'turtlereport' ), 'monitor' => ! empty( $tly_s['monitor_enabled'] ) ? implode( ' · ', $tly_mon ) : __( 'Daily check off', 'turtlereport' ), 'ai' => ! empty( $tly_s['ai_enabled'] ) && $tly_aip ? sprintf( /* translators: 1: AI provider, 2: model, 3: key state. */ __( 'On · %1$s · %2$s · %3$s', 'turtlereport' ), $tly_aip['label'], trim( (string) $tly_s['ai_model'] ) !== '' ? (string) $tly_s['ai_model'] : $tly_aip['default'], $tly_aip['configured'] ? __( 'key saved', 'turtlereport' ) : __( 'no key yet', 'turtlereport' ) ) : __( 'Off', 'turtlereport' ), 'performance' => ! empty( $tly_s['warm_cache'] ) ? __( 'Daily preloading on: each site\'s default report is fetched once a day', 'turtlereport' ) : __( 'Daily preloading off', 'turtlereport' ), ); $tly_d = $args['defaults']; /** * An hour as the site writes times, e.g. "8 am" or "08:00". * * @param int $hour 0–23. * @return string */ $tly_hour = static function ( $hour ) { // Whole hours only, so "8 am" (12-hour sites) or "08:00" (24-hour sites) keeps the picker narrow. $format = (string) get_option( 'time_format', 'H:i' ); $format = preg_match( '/[aA]/', $format ) ? 'g ' . ( false !== strpos( $format, 'A' ) ? 'A' : 'a' ) : 'H:i'; return wp_date( $format, (int) $hour * HOUR_IN_SECONDS, new DateTimeZone( 'UTC' ) ); }; /** * Day and time pickers for one schedule. The day list shows weekdays for * weekly schedules and days of the month otherwise (admin.js switches them). * * @param string $name Field name prefix, e.g. "schedules[abc]". * @param array $schedule frequency, weekday, monthday, hour. * @param string $id Unique part for element IDs. * @param bool $short Whether to use short weekday names. */ $tly_when = static function ( $name, array $schedule, $id, $short = false ) use ( &$tly_days, &$tly_days_short, $tly_hour ) { $weekly = Schedule::by_weekday( $schedule['frequency'] ); ?> __( 'Mon', 'turtlereport' ), 2 => __( 'Tue', 'turtlereport' ), 3 => __( 'Wed', 'turtlereport' ), 4 => __( 'Thu', 'turtlereport' ), 5 => __( 'Fri', 'turtlereport' ), 6 => __( 'Sat', 'turtlereport' ), 7 => __( 'Sun', 'turtlereport' ), ); $tly_days = array( 1 => __( 'Monday', 'turtlereport' ), 2 => __( 'Tuesday', 'turtlereport' ), 3 => __( 'Wednesday', 'turtlereport' ), 4 => __( 'Thursday', 'turtlereport' ), 5 => __( 'Friday', 'turtlereport' ), 6 => __( 'Saturday', 'turtlereport' ), 7 => __( 'Sunday', 'turtlereport' ), ); ?>