bind_anti_eav_hooks(); } /** Adapter slug (matches wp.org plugin slug). */ public function plugin_slug(): string { return 'hivepress-social-links'; } /** Class probed for addon presence. */ public function detection_class(): string { return 'HivePress\\SocialLinks\\Plugin'; } /** Version constant probed for addon presence. */ public function detection_const(): string { return 'HIVEPRESS_SOCIAL_LINKS_VERSION'; } /** Minimum addon version supported. */ public function minimum_addon_version(): string { return '1.0.0'; } /** * Register the enabled social link fields to the Cold zone. * * @param TMDO_Schema_Registry $registry Schema registry singleton. */ public function on_register_fields( TMDO_Schema_Registry $registry ): void { $fields = array(); foreach ( $this->enabled_meta_keys() as $post_type => $keys ) { foreach ( $keys as $key ) { $fields[] = array( 'post_type' => $post_type, 'meta_key' => $key, 'zone' => 'cold', 'cache_group' => 'wpdo_cold_' . $post_type, 'cache_ttl' => HOUR_IN_SECONDS, ); } } $registry->register_many( $this->plugin_slug(), $fields ); } /** * Meta keys of the social links enabled in the addon settings. * * @return array> post_type => meta keys. */ private function enabled_meta_keys(): array { $keys = array(); foreach ( array( 'listing', 'vendor' ) as $model ) { foreach ( (array) get_option( 'hp_' . $model . '_social_links', array() ) as $name ) { $name = sanitize_key( (string) $name ); if ( '' !== $name ) { $keys[ 'hp_' . $model ][] = 'hp_' . $name; } } } return $keys; } /** * Doctor probe — cold zone uses cache; verify cache layer is reachable. * * @return array{ok:bool, message:string} */ public function doctor_check(): array { return array( 'ok' => true, 'message' => sprintf( 'hivepress-social-links: %d cold fields registered', array_sum( array_map( 'count', $this->enabled_meta_keys() ) ) ), ); } /** * 8-D self-score. */ public function suitability_score(): array { return $this->compose_score( array() ); } } } // end if ( ! class_exists )