diff --git a/includes/core/class-prv-admin-page-css.php b/includes/core/class-prv-admin-page-css.php index fdf80a5..aceb0e3 100644 --- a/includes/core/class-prv-admin-page-css.php +++ b/includes/core/class-prv-admin-page-css.php @@ -109,7 +109,7 @@ class PRV_Admin_Page_Css { } /** - * v0.3.0 additions: subnav, costs, call-log, drawer components. + * V0.3.0 additions: subnav, costs, call-log, drawer components. * * @return string */ diff --git a/includes/core/class-prv-admin-page.php b/includes/core/class-prv-admin-page.php index 3115535..f752368 100644 --- a/includes/core/class-prv-admin-page.php +++ b/includes/core/class-prv-admin-page.php @@ -198,7 +198,9 @@ class PRV_Admin_Page { ) ); echo '

'; - } /** + } + + /** * Return the combined CSS string for all PR Vision admin screens. * * Delegates to PRV_Admin_Page_Css to keep this class under 300 lines. diff --git a/includes/core/class-prv-call-drawer-renderer.php b/includes/core/class-prv-call-drawer-renderer.php index c8d822c..8431ac4 100644 --- a/includes/core/class-prv-call-drawer-renderer.php +++ b/includes/core/class-prv-call-drawer-renderer.php @@ -67,7 +67,7 @@ class PRV_Call_Drawer_Renderer { * * Side effects: Outputs HTML. * - * @param array $meta Call metadata row. + * @param array $meta Call metadata row. * @param array|null $io I/O record or null (pruned/missing). * * @return void @@ -198,13 +198,9 @@ class PRV_Call_Drawer_Renderer { ) ); echo ''; - } elseif ( $is_legacy ) { - // Already shown in prompt section; no duplicate. - } elseif ( $is_pruned ) { - // Already shown. - } elseif ( $has_io && isset( $io['response_text'] ) && '' !== $io['response_text'] ) { + } elseif ( ! $is_legacy && ! $is_pruned && $has_io && isset( $io['response_text'] ) && '' !== $io['response_text'] ) { echo '
' . esc_html( $io['response_text'] ) . '
'; - } else { + } elseif ( ! $is_error && ! $is_legacy && ! $is_pruned ) { echo '

—

'; } echo ''; @@ -263,7 +259,7 @@ class PRV_Call_Drawer_Renderer { * * @return void */ - private function render_inline_script(): void { + private function render_inline_script(): void { PRV_Call_Drawer_Script::render( wp_create_nonce( PRV_Call_Detail_Ajax::NONCE_ACTION ), admin_url( 'admin-ajax.php' ) diff --git a/includes/core/class-prv-call-log-query.php b/includes/core/class-prv-call-log-query.php index 74cf58d..9fb472c 100644 --- a/includes/core/class-prv-call-log-query.php +++ b/includes/core/class-prv-call-log-query.php @@ -51,22 +51,24 @@ class PRV_Call_Log_Query { list( $where_sql, $where_args ) = $this->build_where( $filters ); // Count query. - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared $total = (int) $wpdb->get_var( $wpdb->prepare( - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared "SELECT COUNT(*) FROM {$table} {$where_sql}", ...$where_args ) ); + // phpcs:enable $pages = $total > 0 ? (int) ceil( $total / self::PAGE_SIZE ) : 1; // Data query. - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching + $data_args = $where_args; + $data_args[] = self::PAGE_SIZE; + $data_args[] = $offset; + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared $rows = $wpdb->get_results( $wpdb->prepare( - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared "SELECT id, visibility_row, run_id, peptide_slug, model, intent_label, tokens_in, tokens_out, cost_usd, latency_ms, cited, http_status, captured_at, config_version @@ -74,12 +76,11 @@ class PRV_Call_Log_Query { {$where_sql} ORDER BY captured_at DESC LIMIT %d OFFSET %d", - ...$where_args, - self::PAGE_SIZE, - $offset + ...$data_args ), ARRAY_A ); + // phpcs:enable return array( 'rows' => is_array( $rows ) ? $rows : array(), diff --git a/includes/core/class-prv-cost-rollup-query.php b/includes/core/class-prv-cost-rollup-query.php index e979241..220c982 100644 --- a/includes/core/class-prv-cost-rollup-query.php +++ b/includes/core/class-prv-cost-rollup-query.php @@ -148,10 +148,9 @@ class PRV_Cost_Rollup_Query { $group_col = 'run_id'; } - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared $rows = $wpdb->get_results( $wpdb->prepare( - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared "SELECT {$group_col} AS group_key, COUNT(*) AS calls, COALESCE(SUM(cost_usd),0) AS total_cost, @@ -169,6 +168,7 @@ class PRV_Cost_Rollup_Query { ), ARRAY_A ); + // phpcs:enable $result = array(); foreach ( (array) $rows as $row ) { diff --git a/includes/core/class-prv-costs-renderer.php b/includes/core/class-prv-costs-renderer.php index 099f124..8bde12a 100644 --- a/includes/core/class-prv-costs-renderer.php +++ b/includes/core/class-prv-costs-renderer.php @@ -120,10 +120,22 @@ class PRV_Costs_Renderer { */ public function render_subnav( string $active ): void { $tabs = array( - 'dashboard' => array( 'label' => __( 'Dashboard', 'pr-vision' ), 'slug' => 'pr-vision' ), - 'costs' => array( 'label' => __( 'Costs', 'pr-vision' ), 'slug' => 'pr-vision-costs' ), - 'calls' => array( 'label' => __( 'Call Log', 'pr-vision' ), 'slug' => 'pr-vision-calls' ), - 'settings' => array( 'label' => __( 'Settings', 'pr-vision' ), 'slug' => 'pr-vision-settings' ), + 'dashboard' => array( + 'label' => __( 'Dashboard', 'pr-vision' ), + 'slug' => 'pr-vision', + ), + 'costs' => array( + 'label' => __( 'Costs', 'pr-vision' ), + 'slug' => 'pr-vision-costs', + ), + 'calls' => array( + 'label' => __( 'Call Log', 'pr-vision' ), + 'slug' => 'pr-vision-calls', + ), + 'settings' => array( + 'label' => __( 'Settings', 'pr-vision' ), + 'slug' => 'pr-vision-settings', + ), ); echo '