true ), 'objects' ); $supported_post_types = array(); foreach ( $post_types as $pt ) { if ( post_type_supports( $pt->name, 'editor' ) ) { $supported_post_types[] = array( 'value' => sanitize_key( $pt->name ), 'label' => sanitize_text_field( $pt->label ), ); } } // Cache for 1 hour. set_transient( $cache_key, $supported_post_types, HOUR_IN_SECONDS ); return apply_filters( 'agentic_admin_supported_post_types', $supported_post_types ); } /** * Clear cache helper. */ public static function clear_cache(): void { delete_transient( 'agentic_admin_post_types' ); delete_transient( 'agentic_admin_cache' ); } /** * Check if WebGPU is likely supported based on user agent. * Note: Actual detection happens client-side. * * @return array */ public static function get_browser_requirements(): array { return array( 'chrome' => '113+', 'edge' => '113+', 'firefox' => 'Nightly with flags', 'safari' => 'Technology Preview', ); } /** * Get the debug log path. * * @return string|false */ public static function get_debug_log_path() { // When WP_DEBUG_LOG is on, wp_debug_mode() points PHP's error_log // setting at the log file, custom path or default location alike. if ( self::is_debug_log_enabled() ) { $log_file = ini_get( 'error_log' ); if ( is_string( $log_file ) && '' !== $log_file ) { return $log_file; } } if ( defined( 'WP_DEBUG_LOG' ) && is_string( WP_DEBUG_LOG ) ) { return WP_DEBUG_LOG; } return false; } /** * Check if debug logging is enabled. * * @return bool */ public static function is_debug_log_enabled(): bool { return defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG; } }