- Added phpcs:ignore for class file naming convention (79 violations) WordPress.Files.FileName.InvalidClassFileName is a known architectural issue — class files use short names without prautoblogger- prefix - Added phpcs:ignore for ->prepare() table interpolation (56 violations) WordPress.DB.PreparedSQL.InterpolatedNotPrepared: dynamic table names (prab_generation_logs, prab_cost_logs) require interpolation; ->prepare() does not support table name placeholders, only column values - Fixed file-level docblock positioning (2 violations) prautoblogger.php and uninstall.php: moved declare(strict_types=1) before file docblock per PHP best practices
48 lines
1.3 KiB
PHP
Executable File
48 lines
1.3 KiB
PHP
Executable File
<?php
|
|
// phpcs:ignore WordPress.Files.FileName.InvalidClassFileName -- class naming convention differs from WordPress standard
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Admin page displaying cost dashboard, content scores, and generation history.
|
|
*
|
|
* Shows: monthly spend, daily cost chart, spend by pipeline stage, budget
|
|
* utilization, top/bottom performing posts, and recent generation logs.
|
|
*
|
|
* Triggered by: PRAutoBlogger::register_admin_hooks() on `admin_menu`.
|
|
* Dependencies: PRAutoBlogger_Cost_Tracker.
|
|
*
|
|
* @see class-prautoblogger.php — Registers the hook.
|
|
* @see core/class-cost-tracker.php — Provides cost data.
|
|
*/
|
|
class PRAutoBlogger_Metrics_Page {
|
|
|
|
/**
|
|
* Register the metrics submenu page under PRAutoBlogger.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function on_register_menu(): void {
|
|
add_submenu_page(
|
|
'prautoblogger-settings',
|
|
__( 'Metrics & Costs', 'prautoblogger' ),
|
|
__( 'Metrics & Costs', 'prautoblogger' ),
|
|
'manage_options',
|
|
'prautoblogger-metrics',
|
|
array( $this, 'render_page' )
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Render the metrics page.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function render_page(): void {
|
|
if ( ! current_user_can( 'manage_options' ) ) {
|
|
return;
|
|
}
|
|
|
|
include PRAUTOBLOGGER_PLUGIN_DIR . 'templates/admin/metrics-page.php';
|
|
}
|
|
}
|