- 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
56 lines
1.4 KiB
PHP
Executable File
56 lines
1.4 KiB
PHP
Executable File
<?php
|
|
// phpcs:ignore WordPress.Files.FileName.InvalidClassFileName -- class naming convention differs from WordPress standard
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Adds a metabox to posts showing PRAutoBlogger generation metadata.
|
|
*
|
|
* Only appears on posts that were generated by PRAutoBlogger (checked via
|
|
* _prautoblogger_generated post meta).
|
|
*
|
|
* Triggered by: PRAutoBlogger::register_admin_hooks() on `add_meta_boxes`.
|
|
* Dependencies: WordPress post meta API.
|
|
*
|
|
* @see class-prautoblogger.php — Registers the hook.
|
|
* @see core/class-publisher.php — Writes the metadata this class displays.
|
|
*/
|
|
class PRAutoBlogger_Post_Metabox {
|
|
|
|
/**
|
|
* Register the metabox for the post editor.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function on_register_metabox(): void {
|
|
$screen = get_current_screen();
|
|
if ( ! $screen || 'post' !== $screen->id ) {
|
|
return;
|
|
}
|
|
|
|
global $post;
|
|
if ( ! $post || '1' !== get_post_meta( $post->ID, '_prautoblogger_generated', true ) ) {
|
|
return;
|
|
}
|
|
|
|
add_meta_box(
|
|
'prautoblogger_generation_info',
|
|
__( 'PRAutoBlogger Generation Info', 'prautoblogger' ),
|
|
array( $this, 'render_metabox' ),
|
|
'post',
|
|
'side',
|
|
'default'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Render the generation metadata metabox.
|
|
*
|
|
* @param \WP_Post $post
|
|
*
|
|
* @return void
|
|
*/
|
|
public function render_metabox( \WP_Post $post ): void {
|
|
include PRAUTOBLOGGER_PLUGIN_DIR . 'templates/admin/metabox-generation-info.php';
|
|
}
|
|
}
|