fix: resolve PR_Core_Settings_Renderer undefined constant fatal (v0.7.1) (#24)

Squash-merge of PR #24 — QA APPROVED (2026-06-17 SHA ad2b1d9a)

Agent-Session: 2026-06-17-phase1-vps-runner-deploy-500fixes
This commit is contained in:
peptiderepo
2026-06-17 13:16:33 +07:00
committed by GitHub
parent 6a8c43496e
commit a7a2bb2f6d
5 changed files with 229 additions and 20 deletions

View File

@@ -35,8 +35,8 @@ class PR_Core_Settings_Renderer {
<h1><?php esc_html_e( 'PR Core Settings', 'peptide-repo-core' ); ?></h1>
<form method="post" action="options.php">
<?php
settings_fields( self::OPTION_GROUP );
do_settings_sections( self::OPTION_GROUP );
settings_fields( PR_Core_Settings::OPTION_GROUP );
do_settings_sections( PR_Core_Settings::OPTION_GROUP );
submit_button();
?>
</form>
@@ -50,10 +50,10 @@ class PR_Core_Settings_Renderer {
* @return void
*/
public static function render_enabled_field(): void {
$enabled = (bool) get_option( self::RELATED_ENABLED, true );
$enabled = (bool) get_option( PR_Core_Settings::RELATED_ENABLED, true );
printf(
'<input type="checkbox" name="%s" value="1"%s /> %s',
esc_attr( self::RELATED_ENABLED ),
esc_attr( PR_Core_Settings::RELATED_ENABLED ),
checked( $enabled, true, false ),
esc_html__( 'Show related monographs on single peptide pages', 'peptide-repo-core' )
);
@@ -67,8 +67,8 @@ class PR_Core_Settings_Renderer {
public static function render_limit_field(): void {
printf(
'<input type="number" name="%s" value="%d" min="1" max="6" />',
esc_attr( self::RELATED_LIMIT ),
absint( get_option( self::RELATED_LIMIT, 3 ) )
esc_attr( PR_Core_Settings::RELATED_LIMIT ),
absint( get_option( PR_Core_Settings::RELATED_LIMIT, 3 ) )
);
echo '<p class="description">' . esc_html__( 'Number of articles to display (1-6). Default: 3.', 'peptide-repo-core' ) . '</p>';
}
@@ -88,8 +88,8 @@ class PR_Core_Settings_Renderer {
* @return void
*/
public static function render_cadence_field(): void {
$current = get_option( self::SCAN_CADENCE, 'weekly' );
echo '<select name="' . esc_attr( self::SCAN_CADENCE ) . '">';
$current = get_option( PR_Core_Settings::SCAN_CADENCE, 'weekly' );
echo '<select name="' . esc_attr( PR_Core_Settings::SCAN_CADENCE ) . '">';
foreach ( array(
'daily' => 'Daily',
'weekly' => 'Weekly',
@@ -106,7 +106,7 @@ class PR_Core_Settings_Renderer {
* @return void
*/
public static function render_threshold_field(): void {
printf( '<input type="number" name="%s" value="%d" min="1" />', esc_attr( self::DEFAULT_THRESHOLD ), absint( get_option( self::DEFAULT_THRESHOLD, 180 ) ) );
printf( '<input type="number" name="%s" value="%d" min="1" />', esc_attr( PR_Core_Settings::DEFAULT_THRESHOLD ), absint( get_option( PR_Core_Settings::DEFAULT_THRESHOLD, 180 ) ) );
}
/**
@@ -115,7 +115,7 @@ class PR_Core_Settings_Renderer {
* @return void
*/
public static function render_high_velocity_field(): void {
printf( '<input type="number" name="%s" value="%d" min="1" />', esc_attr( self::HIGH_VELOCITY_THRESHOLD ), absint( get_option( self::HIGH_VELOCITY_THRESHOLD, 60 ) ) );
printf( '<input type="number" name="%s" value="%d" min="1" />', esc_attr( PR_Core_Settings::HIGH_VELOCITY_THRESHOLD ), absint( get_option( PR_Core_Settings::HIGH_VELOCITY_THRESHOLD, 60 ) ) );
}
/**
@@ -126,8 +126,8 @@ class PR_Core_Settings_Renderer {
public static function render_email_field(): void {
printf(
'<input type="text" name="%s" value="%s" class="regular-text" placeholder="admin@example.com" />',
esc_attr( self::VERIFICATION_EMAIL ),
esc_attr( (string) get_option( self::VERIFICATION_EMAIL, '' ) )
esc_attr( PR_Core_Settings::VERIFICATION_EMAIL ),
esc_attr( (string) get_option( PR_Core_Settings::VERIFICATION_EMAIL, '' ) )
);
echo '<p class="description">' . esc_html__( 'Comma-separated. Leave blank to disable email digests.', 'peptide-repo-core' ) . '</p>';
}

View File

@@ -23,22 +23,22 @@ class PR_Core_Settings {
public const OPTION_GROUP = 'pr_core_settings';
/** @var string Option key: enable/disable related articles. */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const RELATED_ENABLED = 'pr_core_related_posts_enabled';
public const RELATED_ENABLED = 'pr_core_related_posts_enabled';
/** @var string Option key: related articles limit (1-6). */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const RELATED_LIMIT = 'pr_core_related_posts_limit';
public const RELATED_LIMIT = 'pr_core_related_posts_limit';
/** @var string Option key: WP-cron scan cadence. */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const SCAN_CADENCE = 'pr_core_scan_cadence';
public const SCAN_CADENCE = 'pr_core_scan_cadence';
/** @var string Option key: default staleness threshold in days. */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const DEFAULT_THRESHOLD = 'pr_core_default_threshold';
public const DEFAULT_THRESHOLD = 'pr_core_default_threshold';
/** @var string Option key: high-velocity staleness threshold in days. */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const HIGH_VELOCITY_THRESHOLD = 'pr_core_high_velocity_threshold';
public const HIGH_VELOCITY_THRESHOLD = 'pr_core_high_velocity_threshold';
/** @var string Option key: comma-separated notification email list. */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
private const VERIFICATION_EMAIL = 'pr_core_verification_email';
public const VERIFICATION_EMAIL = 'pr_core_verification_email';
/**
* Register the settings submenu page under Peptides.