' . esc_html( sprintf( /* translators: %s: human-readable time difference. */ __( 'Last full refresh: %s ago', 'agentic-commerce-llms-txt' ), human_time_diff( $last, time() ) ) ) . ''; } ?>
output_path(); $hook_only = ( null === $path || '' === $path ); $rel = $hook_only ? self::hook_label( $class ) : $path; $url = $hook_only ? '' : Lltxt_Cache::get_url( $path ); $last_w = $hook_only ? 0 : Lltxt_Cache::last_written( $path ); ?>
—'; } else { $mode = Lltxt_Cache::get_mode( $path ); $colors = array( Lltxt_Cache::MODE_PLUGIN => '#1a7f37', Lltxt_Cache::MODE_MERCHANT => '#9a6700', Lltxt_Cache::MODE_PINNED => '#0969da', ); $labels = array( Lltxt_Cache::MODE_PLUGIN => __( 'plugin-managed', 'agentic-commerce-llms-txt' ), Lltxt_Cache::MODE_MERCHANT => __( 'merchant-managed', 'agentic-commerce-llms-txt' ), Lltxt_Cache::MODE_PINNED => __( 'pinned', 'agentic-commerce-llms-txt' ), ); printf( '%s', esc_attr( $colors[ $mode ] ), esc_attr( $colors[ $mode ] ), esc_html( $labels[ $mode ] ) ); } ?>
output_path() : ''; if ( null === $path || '' === $path ) { return self::hook_label( $class ); } return '/' . $path; } /** * Label for hook-only emitters. * * @param string $class Emitter class. * @return string */ private static function hook_label( $class ) { return $class; } /** * Build the notice text shown after a Regenerate-All run found one or * more routes in a mode that blocks overwrites (pinned / merchant- * managed). Names the files so the merchant knows what to act on. * * @return string */ private static function skip_notice_text() { $skipped = get_transient( 'lltxt_last_skipped' ); delete_transient( 'lltxt_last_skipped' ); if ( ! is_array( $skipped ) || empty( $skipped ) ) { return __( 'Some files were skipped because they are pinned or merchant-managed.', 'agentic-commerce-llms-txt' ); } $pinned = array(); $merchant = array(); foreach ( $skipped as $path => $reason ) { if ( 'pinned' === $reason ) { $pinned[] = '/' . $path; } else { $merchant[] = '/' . $path; } } $lines = array( __( 'Refresh ran, but these files were left alone:', 'agentic-commerce-llms-txt' ) ); if ( $pinned ) { $lines[] = sprintf( /* translators: %s: comma-separated list of file paths. */ __( 'Pinned (unpin in Version Control): %s', 'agentic-commerce-llms-txt' ), implode( ', ', $pinned ) ); } if ( $merchant ) { $lines[] = sprintf( /* translators: %s: comma-separated list of file paths. */ __( 'Merchant-managed (use "Take over this file" above): %s', 'agentic-commerce-llms-txt' ), implode( ', ', $merchant ) ); } return implode( ' ', $lines ); } /** * Show the action notice. * * @return void */ private static function notice() { $code = isset( $_GET['lltxt_notice'] ) ? sanitize_key( wp_unslash( $_GET['lltxt_notice'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! $code ) { return; } $map = array( 'regen_all_ok' => array( 'success', __( 'All files regenerated.', 'agentic-commerce-llms-txt' ) ), 'regen_all_skipped' => array( 'warning', self::skip_notice_text() ), 'regen_partial' => array( 'warning', __( 'Files regenerated with some errors — see Diagnostics.', 'agentic-commerce-llms-txt' ) ), 'regen_one_ok' => array( 'success', __( 'File regenerated.', 'agentic-commerce-llms-txt' ) ), 'regen_one_err' => array( 'error', __( 'Could not regenerate that file — see Diagnostics.', 'agentic-commerce-llms-txt' ) ), 'take_over_ok' => array( 'success', __( 'File flagged plugin-managed. The next refresh will overwrite the on-disk copy.', 'agentic-commerce-llms-txt' ) ), 'restore_ok' => array( 'success', __( 'Your original file is back in place. The plugin will not refresh this route until you flip it back to plugin-managed.', 'agentic-commerce-llms-txt' ) ), 'restore_err' => array( 'error', __( 'Could not restore the backup — see the Diagnostics tab for details.', 'agentic-commerce-llms-txt' ) ), ); if ( ! isset( $map[ $code ] ) ) { return; } printf( '

%s

', esc_attr( $map[ $code ][0] ), esc_html( $map[ $code ][1] ) ); } }