File-level sniffs like WordPress.Files.FileName are evaluated at the file level, not at code level. They require phpcs:ignore directives to be placed within the file-level docblock (/** ... */), not in code comments. Moved all 81 phpcs:ignore pragmas from code comments to the file-level docblocks. This applies to: - 79 class files with class-naming convention ignores - prautoblogger.php with strict-types docblock ignore - uninstall.php with strict-types docblock ignore
57 lines
1.4 KiB
PHP
Executable File
57 lines
1.4 KiB
PHP
Executable File
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* phpcs:ignore WordPress.Files.FileName.InvalidClassFileName -- class naming convention differs from WordPress standard
|
|
*
|
|
* 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';
|
|
}
|
|
}
|