id || ! str_contains( $screen->id, AdminSPA::PAGE_SLUG ) ) {
return;
}
try {
$container = Plugin::container();
if ( ! $container->has( SettingsStore::class ) ) {
return;
}
$settings = $container->get( SettingsStore::class );
if ( ! $settings instanceof SettingsStore ) {
return;
}
} catch ( \Throwable ) {
return;
}
$secret = (string) $settings->get( 'payments.stripe_secret_key' );
$pub = (string) $settings->get( 'payments.stripe_publishable_key' );
if ( LivePaymentGuard::using_test_keys( $secret, $pub ) ) {
printf(
'
';
echo '
' . esc_html__( 'Buildler', 'buildler' ) . '
';
echo '
' . esc_html__( 'Appointment booking for WordPress. Core engine is live; the full admin SPA arrives in a later milestone.', 'buildler' ) . '
';
echo '
' . esc_html__( 'Catalogue', 'buildler' ) . '
';
echo '
';
foreach ( $counts as $label => $n ) {
printf(
'- %s%s
',
esc_html( (string) $n ),
esc_html( ucfirst( $label ) )
);
}
echo '
';
if ( $demo_url ) {
echo '
' . esc_html__( 'Open booking demo page', 'buildler' ) . '
';
}
echo '
' . esc_html__( 'Browse REST API (bookline/v1)', 'buildler' ) . '
';
echo '
' . esc_html__( 'Active services', 'buildler' ) . '
';
if ( empty( $services ) ) {
echo '
' . esc_html__( 'No active services yet.', 'buildler' ) . '
';
} else {
echo '
| ID | ' . esc_html__( 'Name', 'buildler' ) . ' | ' . esc_html__( 'Status', 'buildler' ) . ' |
';
foreach ( $services as $row ) {
printf(
'| %s | %s | %s |
',
esc_html( (string) (int) $row['id'] ),
esc_html( (string) $row['name'] ),
esc_html( (string) $row['status'] )
);
}
echo '
';
}
echo '
' . esc_html__( 'Active agents', 'buildler' ) . '
';
if ( empty( $agents ) ) {
echo '
' . esc_html__( 'No active agents yet.', 'buildler' ) . '
';
} else {
echo '
| ID | ' . esc_html__( 'Name', 'buildler' ) . ' | ' . esc_html__( 'Timezone', 'buildler' ) . ' |
';
foreach ( $agents as $row ) {
printf(
'| %s | %s | %s |
',
esc_html( (string) (int) $row['id'] ),
esc_html( (string) $row['display_name'] ),
esc_html( (string) $row['timezone'] )
);
}
echo '
';
}
echo '
';
}
/**
* Count rows in a prefixed Bookline table.
*
* @param \wpdb $wpdb Database.
* @param string $prefix Table prefix including bookline_.
* @param string $table Table suffix.
* @param string $where Static WHERE clause without user input.
*/
private static function count_rows( \wpdb $wpdb, string $prefix, string $table, string $where ): int {
$sql = sprintf(
'SELECT COUNT(*) FROM `%s` WHERE %s',
esc_sql( $prefix . $table ),
$where
);
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared -- static dashboard counts with escaped table names.
return (int) $wpdb->get_var( $sql );
}
/**
* Build a SQL string with a single escaped table placeholder.
*
* @param string $prefix Table prefix including bookline_.
* @param string $table Table suffix.
* @param string $query Query containing one %s table placeholder.
*/
private static function sql( string $prefix, string $table, string $query ): string {
return sprintf( $query, esc_sql( $prefix . $table ) );
}
}