license; if ( ! $license ) { return false; } return $license->is_valid(); } /** * Get available LLM providers. * * @return array */ public static function get_available_providers() { $providers = array( 'openai' => array( 'label' => __( 'OpenAI', 'ai-internal-links' ), 'models' => array( 'gpt-5.4' => 'GPT-5.4 (Flagship)', 'gpt-5-mini' => 'GPT-5 Mini (Fast & cheap)', 'gpt-5.2' => 'GPT-5.2', 'gpt-4o' => 'GPT-4o', 'gpt-4o-mini' => 'GPT-4o Mini', 'gpt-4-turbo' => 'GPT-4 Turbo', 'gpt-4' => 'GPT-4', ), 'premium' => false, ), ); /** * Filter available LLM providers. * Premium plugin will add more providers here. * * @since 1.0.0 * @param array $providers Available providers. */ return apply_filters( 'aiil_available_providers', $providers ); } /** * Get supported post types (where the AI Internal Links button appears). * * @return array */ public static function get_supported_post_types() { // Get post types from settings, default to 'post' and 'page'. $post_types = self::get_setting( 'post_types', array( 'post', 'page' ) ); /** * Filter supported post types. * Premium plugin can extend this. * * @since 1.0.0 * @param array $post_types Supported post types. */ return apply_filters( 'aiil_supported_post_types', $post_types ); } /** * Get linking post types (post types available as link targets). * * @return array */ public static function get_linking_post_types() { // Get linking post types from settings, fallback to post_types setting if not set. $post_types = self::get_setting( 'linking_post_types' ); // If not set, fallback to supported post types for backward compatibility. if ( empty( $post_types ) ) { $post_types = self::get_setting( 'post_types', array( 'post', 'page' ) ); } /** * Filter linking post types. * Premium plugin can extend this. * * @since 1.1.0 * @param array $post_types Linking post types. */ return apply_filters( 'aiil_linking_post_types', $post_types ); } /** * Log message. * * @param string $message Message to log. * @param string $level Log level (info, error, debug). */ public static function log( $message, $level = 'info' ) { if ( ! self::get_setting( 'enable_logging', false ) ) { return; } $upload_dir = wp_upload_dir(); $log_file = $upload_dir['basedir'] . '/ai-internal-links-logs/' . gmdate( 'Y-m-d' ) . '.log'; $timestamp = gmdate( 'Y-m-d H:i:s' ); $log_entry = sprintf( "[%s] [%s] %s\n", $timestamp, strtoupper( $level ), $message ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents file_put_contents( $log_file, $log_entry, FILE_APPEND ); } }