From a44c9f6441877856f257699237b7619534642ba3 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 22 Nov 2024 11:58:06 -0700 Subject: [PATCH 01/10] Migrate the Descriptive Text feature to Azure v4.0 --- includes/Classifai/Helpers.php | 2 +- .../Providers/Azure/ComputerVision.php | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/includes/Classifai/Helpers.php b/includes/Classifai/Helpers.php index df93c53c1..ca233973a 100644 --- a/includes/Classifai/Helpers.php +++ b/includes/Classifai/Helpers.php @@ -152,7 +152,7 @@ function computer_vision_max_filesize(): int { * * @return {int} Filtered filesize in bytes. */ - return apply_filters( 'classifai_computer_vision_max_filesize', 4 * MB_IN_BYTES ); // 4MB default. + return apply_filters( 'classifai_computer_vision_max_filesize', 20 * MB_IN_BYTES ); // 20MB default. } /** diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 961e05c4a..f6c46cf66 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -25,7 +25,7 @@ class ComputerVision extends Provider { /** * @var string URL fragment to the analyze API endpoint */ - protected $analyze_url = 'vision/v3.2/analyze'; + protected $analyze_url = 'computervision/imageanalysis:analyze?api-version=2024-02-01'; /** * ComputerVision constructor. @@ -443,30 +443,30 @@ public function generate_alt_tags( string $image_url, int $attachment_id ) { return $details; } - $captions = $details->description->captions ?? []; + $caption = isset( $details->captionResult ) ? (array) $details->captionResult : []; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase set_transient( 'classifai_azure_computer_vision_descriptive_text_latest_response', $details, DAY_IN_SECONDS * 30 ); /** - * Filter the captions returned from the API. + * Filter the caption returned from the API. * * @since 1.4.0 * @hook classifai_computer_vision_captions * - * @param {array} $captions The returned caption data. + * @param {array} $caption The returned caption data. * * @return {array} The filtered caption data. */ - $captions = apply_filters( 'classifai_computer_vision_captions', $captions ); + $caption = apply_filters( 'classifai_computer_vision_captions', $caption ); - // Process the returned captions to see if they pass the threshold. - if ( is_array( $captions ) && ! empty( $captions ) ) { + // Process the returned caption to see if it passes the threshold. + if ( is_array( $caption ) && ! empty( $caption ) ) { $settings = $feature->get_settings( static::ID ); $threshold = $settings['descriptive_confidence_threshold']; // Check the first caption to see if it passes the threshold. - if ( $captions[0]->confidence * 100 > $threshold ) { - $rtn = $captions[0]->text; + if ( $caption['confidence'] * 100 > $threshold ) { + $rtn = $caption['text']; } else { /** * Fires if there were no captions returned. @@ -474,14 +474,14 @@ public function generate_alt_tags( string $image_url, int $attachment_id ) { * @since 1.5.0 * @hook classifai_computer_vision_caption_failed * - * @param {array} $tags The caption data. + * @param {array} $caption The caption data. * @param {int} $threshold The caption_threshold setting. */ - do_action( 'classifai_computer_vision_caption_failed', $captions, $threshold ); + do_action( 'classifai_computer_vision_caption_failed', $caption, $threshold ); } - // Save all the results for later. - update_post_meta( $attachment_id, 'classifai_computer_vision_captions', $captions ); + // Save full results for later. + update_post_meta( $attachment_id, 'classifai_computer_vision_captions', $caption ); } return $rtn; @@ -674,14 +674,14 @@ protected function prep_api_url( \Classifai\Features\Feature $feature = null ): $api_features = []; if ( $feature instanceof DescriptiveTextGenerator && $feature->is_feature_enabled() && ! empty( $feature->get_alt_text_settings() ) ) { - $api_features[] = 'Description'; + $api_features[] = 'caption'; } if ( $feature instanceof ImageTagsGenerator && $feature->is_feature_enabled() ) { $api_features[] = 'Tags'; } - $endpoint = add_query_arg( 'visualFeatures', implode( ',', $api_features ), trailingslashit( $settings['endpoint_url'] ) . $this->analyze_url ); + $endpoint = add_query_arg( 'features', implode( ',', $api_features ), trailingslashit( $settings['endpoint_url'] ) . $this->analyze_url ); return $endpoint; } From 85c3325afee8cdef008eb474dbc871fc4bb772e2 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 22 Nov 2024 12:15:55 -0700 Subject: [PATCH 02/10] Migrate the Image Tagging feature to Azure v4.0 --- includes/Classifai/Providers/Azure/ComputerVision.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index f6c46cf66..c44aac7ad 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -540,7 +540,7 @@ public function generate_image_tags( string $image_url, int $attachment_id ) { return $details; } - $tags = $details->tags ?? []; + $tags = $details->tagsResult->values ?? []; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase set_transient( 'classifai_azure_computer_vision_image_tags_latest_response', $details, DAY_IN_SECONDS * 30 ); @@ -678,7 +678,7 @@ protected function prep_api_url( \Classifai\Features\Feature $feature = null ): } if ( $feature instanceof ImageTagsGenerator && $feature->is_feature_enabled() ) { - $api_features[] = 'Tags'; + $api_features[] = 'tags'; } $endpoint = add_query_arg( 'features', implode( ',', $api_features ), trailingslashit( $settings['endpoint_url'] ) . $this->analyze_url ); From 5f65b9328fb9dd3b0dc6c9530105cd8df8569af5 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 22 Nov 2024 14:55:00 -0700 Subject: [PATCH 03/10] Migrate the Image Text Extraction feature to Azure v4.0 --- .../Providers/Azure/ComputerVision.php | 80 +++++++++++++------ 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index c44aac7ad..7900f835d 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -377,23 +377,17 @@ public function smart_crop_image( array $metadata, int $attachment_id ) { * * @since 1.6.0 * - * @param array $metadata Attachment metadata. - * @param int $attachment_id Attachment ID. + * @param string $image_url URL of image to process. + * @param int $attachment_id Attachment ID. * @return string|WP_Error */ - public function ocr_processing( array $metadata = [], int $attachment_id = 0 ) { + public function ocr_processing( string $image_url, int $attachment_id = 0 ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return new WP_Error( 'invalid', esc_html__( 'This attachment can\'t be processed.', 'classifai' ) ); } $feature = new ImageTextExtraction(); - $settings = $feature->get_settings( static::ID ); - - if ( ! is_array( $metadata ) || ! is_array( $settings ) ) { - return new WP_Error( 'invalid', esc_html__( 'Invalid data found. Please check your settings and try again.', 'classifai' ) ); - } - - $should_ocr_scan = $feature->is_feature_enabled(); + $rtn = ''; /** * Filters whether to run OCR scanning on the current image. @@ -401,25 +395,61 @@ public function ocr_processing( array $metadata = [], int $attachment_id = 0 ) { * @since 1.6.0 * @hook classifai_should_ocr_scan_image * - * @param {bool} $should_ocr_scan Whether to run OCR scanning. The default value is set in ComputerVision settings. - * @param {array} $metadata Image metadata. - * @param {int} $attachment_id The attachment ID. + * @param {bool} $should_scan Whether to run OCR scanning. Defaults to feature being enabled. + * @param {string} $image_url URL of image to process. + * @param {int} $attachment_id The attachment ID. * * @return {bool} Whether to run OCR scanning. */ - if ( ! apply_filters( 'classifai_should_ocr_scan_image', $should_ocr_scan, $metadata, $attachment_id ) ) { + if ( ! apply_filters( 'classifai_should_ocr_scan_image', $feature->is_feature_enabled(), $image_url, $attachment_id ) ) { return ''; } - $image_url = wp_get_attachment_url( $attachment_id ); - $scan = $this->scan_image( $image_url, $feature ); + $details = $this->scan_image( $image_url, $feature ); - $ocr = new OCR( $settings, $scan ); - $response = $ocr->generate_ocr_data( $metadata, $attachment_id ); + if ( is_wp_error( $details ) ) { + return $details; + } - set_transient( 'classifai_azure_computer_vision_image_text_extraction_latest_response', $scan, DAY_IN_SECONDS * 30 ); + set_transient( 'classifai_azure_computer_vision_image_text_extraction_latest_response', $details, DAY_IN_SECONDS * 30 ); + + if ( isset( $details->readResult ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + $text = []; + + // Iterate down the chain to find the text we want. + foreach ( $details->readResult as $result ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + foreach ( $result as $block ) { + foreach ( $block as $lines ) { + foreach ( $lines as $line ) { + if ( isset( $line->text ) ) { + $text[] = $line->text; + } + } + } + } + } - return $response; + if ( ! empty( $text ) ) { + + /** + * Filter the text returned from the API. + * + * @since 1.6.0 + * @hook classifai_ocr_text + * + * @param {string} $text The returned text data. + * @param {object} $details The full scan results from the API. + * + * @return {string} The filtered text data. + */ + $rtn = apply_filters( 'classifai_ocr_text', implode( ' ', $text ), $details ); + + // Save all the results for later + update_post_meta( $attachment_id, 'classifai_computer_vision_ocr', $details ); + } + } + + return $rtn; } /** @@ -681,6 +711,10 @@ protected function prep_api_url( \Classifai\Features\Feature $feature = null ): $api_features[] = 'tags'; } + if ( $feature instanceof ImageTextExtraction && $feature->is_feature_enabled() ) { + $api_features[] = 'read'; + } + $endpoint = add_query_arg( 'features', implode( ',', $api_features ), trailingslashit( $settings['endpoint_url'] ) . $this->analyze_url ); return $endpoint; @@ -744,9 +778,6 @@ public function rest_endpoint_callback( $attachment_id, string $route_to_call = } switch ( $route_to_call ) { - case 'ocr': - return $this->ocr_processing( $metadata, $attachment_id ); - case 'crop': return $this->smart_crop_image( $metadata, $attachment_id ); } @@ -774,6 +805,9 @@ public function rest_endpoint_callback( $attachment_id, string $route_to_call = case 'descriptive_text': return $this->generate_alt_tags( $image_url, $attachment_id ); + case 'ocr': + return $this->ocr_processing( $image_url, $attachment_id ); + case 'tags': return $this->generate_image_tags( $image_url, $attachment_id ); } From 5d87ad6eab43919eeedbd5940c7a28040ff491fc Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 22 Nov 2024 15:06:14 -0700 Subject: [PATCH 04/10] Only process if an image matches the supported mime types. Get the largest image based on filesize and dimensions. Remove the OCR class as it is no longer needed --- .../Providers/Azure/ComputerVision.php | 47 ++- includes/Classifai/Providers/Azure/OCR.php | 323 ------------------ 2 files changed, 40 insertions(+), 330 deletions(-) delete mode 100644 includes/Classifai/Providers/Azure/OCR.php diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 7900f835d..1bad7fd99 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -15,7 +15,7 @@ use WP_Error; use function Classifai\computer_vision_max_filesize; -use function Classifai\get_largest_acceptable_image_url; +use function Classifai\get_largest_size_and_dimensions_image_url; use function Classifai\get_modified_image_source_url; class ComputerVision extends Provider { @@ -27,6 +27,22 @@ class ComputerVision extends Provider { */ protected $analyze_url = 'computervision/imageanalysis:analyze?api-version=2024-02-01'; + /** + * Image types to process. + * + * @var array + */ + private $image_types_to_process = [ + 'bmp', + 'gif', + 'jpeg', + 'png', + 'webp', + 'ico', + 'tiff', + 'mpo', + ]; + /** * ComputerVision constructor. * @@ -777,19 +793,36 @@ public function rest_endpoint_callback( $attachment_id, string $route_to_call = return new WP_Error( 'invalid', esc_html__( 'No valid metadata found.', 'classifai' ) ); } - switch ( $route_to_call ) { - case 'crop': - return $this->smart_crop_image( $metadata, $attachment_id ); + if ( 'crop' === $route_to_call ) { + return $this->smart_crop_image( $metadata, $attachment_id ); + } + + // Check if the image is of a type we can process. + $mime_type = get_post_mime_type( $attachment_id ); + $matched_extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) ); + $process = false; + + foreach ( $matched_extensions as $ext ) { + if ( in_array( $ext, $this->image_types_to_process, true ) ) { + $process = true; + break; + } + } + + if ( ! $process ) { + return new WP_Error( 'invalid', esc_html__( 'Image does not match a valid mime type.', 'classifai' ) ); } $image_url = get_modified_image_source_url( $attachment_id ); if ( empty( $image_url ) || ! filter_var( $image_url, FILTER_VALIDATE_URL ) ) { if ( isset( $metadata['sizes'] ) && is_array( $metadata['sizes'] ) ) { - $image_url = get_largest_acceptable_image_url( + $image_url = get_largest_size_and_dimensions_image_url( get_attached_file( $attachment_id ), wp_get_attachment_url( $attachment_id ), - $metadata['sizes'], + $metadata, + [ 50, 16000 ], + [ 50, 16000 ], computer_vision_max_filesize() ); } else { @@ -798,7 +831,7 @@ public function rest_endpoint_callback( $attachment_id, string $route_to_call = } if ( empty( $image_url ) ) { - return new WP_Error( 'error', esc_html__( 'Valid image size not found. Make sure the image is less than 4MB.', 'classifai' ) ); + return new WP_Error( 'error', esc_html__( 'Image does not meet size requirements. Please ensure it is at least 50x50 but less than 16000x16000 and smaller than 20MB.', 'classifai' ) ); } switch ( $route_to_call ) { diff --git a/includes/Classifai/Providers/Azure/OCR.php b/includes/Classifai/Providers/Azure/OCR.php deleted file mode 100644 index 5ee7b70be..000000000 --- a/includes/Classifai/Providers/Azure/OCR.php +++ /dev/null @@ -1,323 +0,0 @@ -settings = $settings; - $this->scan = $scan; - } - - /** - * Builds the API url. - * - * @since 1.6.0 - * - * @return string - */ - public function get_api_url(): string { - return sprintf( '%s%s', trailingslashit( $this->settings['endpoint_url'] ), static::API_PATH ); - } - - /** - * Returns whether OCR processing should be applied to the attachment - * - * @since 1.6.0 - * - * @param int $attachment_id Attachment ID. - * @return bool - */ - public function should_process( int $attachment_id ): bool { - $mime_type = get_post_mime_type( $attachment_id ); - $matched_extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) ); - $process = false; - - /** - * Filters the media types that should be processed - * - * @since 1.6.0 - * @hook classifai_ocr_approved_media_types - * - * @param {array} $media_types The media types to process. - * @param {int} $attachment_id The attachment ID. - * - * @return {array} Filtered media types. - */ - $approved_media_types = apply_filters( 'classifai_ocr_approved_media_types', $this->media_to_process, $attachment_id ); - - foreach ( $matched_extensions as $ext ) { - if ( in_array( $ext, $approved_media_types, true ) ) { - $process = true; - } - } - - // If we have a proper image and a previous image scan, check - // to see if we have proper tags set, with a high confidence - if ( $process && $this->scan && ! empty( $this->scan->tags ) && is_array( $this->scan->tags ) ) { - - /** - * Filters the tags we check for OCR processing - * - * @since 1.6.0 - * @hook classifai_ocr_tags - * - * @param {array} $tags Tags to look for. Default handwriting and text. - * @param {int} $attachment_id The attachment ID. - * @param {bool|object} $scan Previously run scan. - * - * @return {array} Filtered tags. - */ - $tags = apply_filters( 'classifai_ocr_tags', [ 'handwriting', 'text' ], $attachment_id, $this->scan ); - - /** - * Filters the tag confidence level for OCR processing - * - * @since 1.6.0 - * @hook classifai_ocr_tag_confidence - * - * @param {int} $confidence The minimum confidence level. Default 90. - * @param {int} $attachment_id The attachment ID. - * @param {bool|object} $scan Previously run scan. - * - * @return {int} Confidence level. - */ - $tag_confidence = apply_filters( 'classifai_ocr_tag_confidence', 90, $attachment_id, $this->scan ); - - foreach ( $this->scan->tags as $tag ) { - if ( in_array( $tag->name, $tags, true ) && $tag->confidence * 100 >= $tag_confidence ) { - $process = true; - break; - } - } - } - - /** - * Filters whether to run OCR processing on this media item - * - * @since 1.6.0 - * @hook classifai_ocr_should_process - * - * @param {bool} $process Whether to run OCR processing or not. - * @param {int} $attachment_id The attachment ID. - * @param {bool|object} $scan Previously run scan. - * - * @return {bool} Whether this attachment should have OCR processing. - */ - return apply_filters( 'classifai_ocr_should_process', $process, $attachment_id, $this->scan ); - } - - /** - * Get the OCR data - * - * @since 1.6.0 - * - * @param array $metadata Attachment metadata. - * @param integer $attachment_id Attachment ID. - * @return string|WP_Error - */ - public function generate_ocr_data( array $metadata, int $attachment_id ) { - $rtn = ''; - - if ( ! $this->should_process( $attachment_id ) ) { - return new WP_Error( 'process_error', esc_html__( 'Image does not meet processing requirements.', 'classifai' ), $metadata ); - } - - $url = get_largest_size_and_dimensions_image_url( - get_attached_file( $attachment_id ), - wp_get_attachment_url( $attachment_id ), - $metadata, - [ 50, 4200 ], - [ 50, 4200 ], - computer_vision_max_filesize() - ); - - // If a properly sized image isn't found, return - if ( ! $url ) { - return new WP_Error( 'size_error', esc_html__( 'Image does not meet size requirements. Please ensure it is at least 50x50 but less than 4200x4200 and smaller than 4MB.', 'classifai' ), $metadata ); - } - - $scan = $this->process( $url ); - - set_transient( 'classifai_azure_computer_vision_ocr_latest_response', $scan, DAY_IN_SECONDS * 30 ); - - if ( ! is_wp_error( $scan ) && isset( $scan->regions ) ) { - $text = []; - - // Iterate down the chain to find the text we want - foreach ( $scan->regions as $region ) { - foreach ( $region->lines as $lines ) { - foreach ( $lines->words as $word ) { - if ( isset( $word->text ) ) { - $text[] = $word->text; - } - } - } - } - - if ( ! empty( $text ) ) { - - /** - * Filter the text returned from the API. - * - * @since 1.6.0 - * @hook classifai_ocr_text - * - * @param {string} $text The returned text data. - * @param {object} $scan The full scan results from the API. - * - * @return {string} The filtered text data. - */ - $rtn = apply_filters( 'classifai_ocr_text', implode( ' ', $text ), $scan ); - - // Save all the results for later - update_post_meta( $attachment_id, 'classifai_computer_vision_ocr', $scan ); - } - } else { - $rtn = $scan; - } - - return $rtn; - } - - /** - * Run OCR processing using the Azure API - * - * @since 1.6.0 - * - * @param string $url Media URL. - * @return object|WP_Error - */ - public function process( string $url ) { - // Check if valid authentication is in place. - if ( empty( $this->settings ) || ( isset( $this->settings['authenticated'] ) && false === $this->settings['authenticated'] ) ) { - return new WP_Error( 'auth', esc_html__( 'Please set up valid authentication with Azure.', 'classifai' ) ); - } - - $response = wp_remote_post( - $this->get_api_url(), - [ - 'body' => wp_json_encode( - [ - 'url' => $url, - ] - ), - 'headers' => [ - 'Content-Type' => 'application/json', - 'Ocp-Apim-Subscription-Key' => $this->settings['api_key'], - ], - ] - ); - - /** - * Fires after the request to the ocr endpoint has run. - * - * @since 1.6.0 - * @hook classifai_ocr_after_request - * - * @param {array|WP_Error} Response data or a WP_Error if the request failed. - * @param {string} The attachment URL. - */ - do_action( 'classifai_ocr_after_request', $response, $url ); - - if ( ! is_wp_error( $response ) ) { - $body = json_decode( wp_remote_retrieve_body( $response ) ); - - if ( isset( $body->message ) ) { - $error_message = $body->message; - } elseif ( isset( $body->error->message ) ) { - $error_message = $body->error->message; - } else { - $error_message = false; - } - - if ( 200 !== wp_remote_retrieve_response_code( $response ) && $error_message ) { - /** - * Fires when the ocr API response did not succeed. - * - * @since 1.6.0 - * @hook classifai_ocr_unsuccessful_response - * - * @param {array|WP_Error} Response data or a WP_Error if the request failed. - * @param {string} The attachment URL. - */ - do_action( 'classifai_ocr_unsuccessful_response', $response, $url ); - - $rtn = new WP_Error( $body->code ?? 'error', $error_message, $body ); - } else { - $rtn = $body; - } - } else { - $rtn = $response; - } - - return $rtn; - } -} From 52087fe0e78cbd8f014a53ab6f8125bd45366114 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 26 Nov 2024 13:00:50 -0700 Subject: [PATCH 05/10] Change our recommended threshold from 55 back to 70 --- includes/Classifai/Admin/Notifications.php | 14 +++++++------- .../Classifai/Providers/Azure/ComputerVision.php | 4 ++-- .../provider-settings/azure-ai-vision.js | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/Classifai/Admin/Notifications.php b/includes/Classifai/Admin/Notifications.php index 501b7afc7..51493f3d2 100644 --- a/includes/Classifai/Admin/Notifications.php +++ b/includes/Classifai/Admin/Notifications.php @@ -116,8 +116,8 @@ public function render_activation_notice() { /** * Display a dismissable admin notice when a threshold may need updating. * - * We used to recommend thresholds between 70-75% but in the latest - * version of the AI Vision API, seems 55% is a better threshold. + * We used to recommend thresholds between 50-55% but in the latest + * version of the AI Vision API, seems 70% is a better threshold. */ public function thresholds_update_notice() { $features = [ @@ -143,7 +143,7 @@ public function thresholds_update_notice() { switch ( $feature_instance::ID ) { case DescriptiveTextGenerator::ID: $key = 'descriptive_confidence_threshold'; - $message = __( 'The previous recommended threshold for descriptive text generation was 75% but we find better results now at around 55%.', 'classifai' ); + $message = __( 'The previous recommended threshold for descriptive text generation was 55% but we find better results now at around 70%.', 'classifai' ); break; } @@ -152,8 +152,8 @@ public function thresholds_update_notice() { continue; } - // Don't show the notice if the threshold is already at 55% or lower. - if ( $key && isset( $settings[ $key ] ) && $settings[ $key ] <= 55 ) { + // Don't show the notice if the threshold is already at 70% or higher. + if ( $key && isset( $settings[ $key ] ) && $settings[ $key ] >= 70 ) { continue; } ?> @@ -164,9 +164,9 @@ public function thresholds_update_notice() { echo wp_kses_post( sprintf( // translators: %1$s: Feature specific message; %2$s: URL to Feature settings. - __( 'ClassifAI has updated to the v3.2 of the Azure AI Vision API. %1$s Click here to adjust those settings.', 'classifai' ), + __( 'ClassifAI has updated to the v4.0 of the Azure AI Vision API. %1$s Click here to adjust those settings.', 'classifai' ), esc_html( $message ), - esc_url( admin_url( "tools.php?page=classifai&tab=image_processing&feature=$name" ) ) + esc_url( admin_url( "tools.php?page=classifai#/image_processing/$name" ) ) ) ); ?> diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 1bad7fd99..96d6ce666 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -131,7 +131,7 @@ public function add_descriptive_text_generation_fields() { 'min' => 1, 'step' => 1, 'default_value' => $settings['descriptive_confidence_threshold'], - 'description' => esc_html__( 'Minimum confidence score for automatically added generated text, numeric value from 0-100. Recommended to be set to at least 55.', 'classifai' ), + 'description' => esc_html__( 'Minimum confidence score for automatically added generated text, numeric value from 0-100. Recommended to be set to at least 70.', 'classifai' ), 'class' => 'classifai-provider-field hidden provider-scope-' . static::ID, // Important to add this. ] ); @@ -180,7 +180,7 @@ public function get_default_provider_settings(): array { return array_merge( $common_settings, [ - 'descriptive_confidence_threshold' => 55, + 'descriptive_confidence_threshold' => 70, ] ); diff --git a/src/js/settings/components/provider-settings/azure-ai-vision.js b/src/js/settings/components/provider-settings/azure-ai-vision.js index f34a27e21..77957d154 100644 --- a/src/js/settings/components/provider-settings/azure-ai-vision.js +++ b/src/js/settings/components/provider-settings/azure-ai-vision.js @@ -78,7 +78,7 @@ export const AzureAIVisionSettings = ( { isConfigured = false } ) => { @@ -87,7 +87,7 @@ export const AzureAIVisionSettings = ( { isConfigured = false } ) => { type="number" value={ providerSettings.descriptive_confidence_threshold || - 55 + 70 } onChange={ ( value ) => onChange( { From e2348def0f21b9079c22063de705e346cee5cc2e Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 26 Nov 2024 13:14:13 -0700 Subject: [PATCH 06/10] If a caption is returned but the confidence score is lower than our threshold, output an error message instead of just discarding silently. Ensure the caption we save has the first letter uppercased. Ensure the values we want exist before using them --- includes/Classifai/Providers/Azure/ComputerVision.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 96d6ce666..3631df70a 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -510,10 +510,13 @@ public function generate_alt_tags( string $image_url, int $attachment_id ) { $settings = $feature->get_settings( static::ID ); $threshold = $settings['descriptive_confidence_threshold']; - // Check the first caption to see if it passes the threshold. - if ( $caption['confidence'] * 100 > $threshold ) { - $rtn = $caption['text']; + // Check the caption to see if it passes the threshold. + if ( isset( $caption['confidence'] ) && $caption['confidence'] * 100 > $threshold ) { + $rtn = ucfirst( $caption['text'] ?? '' ); } else { + /* translators: 1: Confidence score, 2: Threshold setting */ + $rtn = new WP_Error( 'threshold', sprintf( esc_html__( 'Caption confidence score is %1$d%% which is lower than your threshold setting of %2$d%%', 'classifai' ), $caption['confidence'] * 100, $threshold ) ); + /** * Fires if there were no captions returned. * From ebc9855e7b035b9b527f05fa35593e61c1a27f35 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 26 Nov 2024 13:50:28 -0700 Subject: [PATCH 07/10] Lock johnbillion/wp-compat to the v0.x branch to avoid conflict for now. Add E2E test fixes from 815 --- composer.json | 2 +- composer.lock | 469 ++++++++++-------- .../image-processing-microsoft-azure.test.js | 12 + tests/cypress/support/commands.js | 1 + 4 files changed, 264 insertions(+), 220 deletions(-) diff --git a/composer.json b/composer.json index 6fce92d6b..cfdfe46f9 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "szepeviktor/phpstan-wordpress": "dev-master", "phpstan/extension-installer": "1.4.x-dev", "php-stubs/wp-cli-stubs": "dev-master", - "johnbillion/wp-compat": "dev-trunk", + "johnbillion/wp-compat": "^0.3.0", "phpstan/phpstan-deprecation-rules": "1.2.x-dev" }, "scripts": { diff --git a/composer.lock b/composer.lock index 9681127d0..8d1191e08 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2f9c2cc632c25b6e192ec4d8273e23a7", + "content-hash": "b44b3587fbfe15fe794fcd4ce2a6f180", "packages": [ { "name": "aws/aws-crt-php", - "version": "v1.2.4", + "version": "v1.2.7", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2" + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/eb0c6e4e142224a10b08f49ebf87f32611d162b2", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", "shasum": "" }, "require": { @@ -56,22 +56,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.4" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" }, - "time": "2023-11-08T00:42:13+00:00" + "time": "2024-10-18T22:15:13+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.300.13", + "version": "3.330.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "b1eb7307d30ebcfa4e156971f658c2d177434db3" + "reference": "4ac43cc8356fb16a494c3631c8f39f6e7555f00a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b1eb7307d30ebcfa4e156971f658c2d177434db3", - "reference": "b1eb7307d30ebcfa4e156971f658c2d177434db3", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4ac43cc8356fb16a494c3631c8f39f6e7555f00a", + "reference": "4ac43cc8356fb16a494c3631c8f39f6e7555f00a", "shasum": "" }, "require": { @@ -101,7 +101,7 @@ "paragonie/random_compat": ">= 2", "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", "psr/cache": "^1.0", - "psr/simple-cache": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", "sebastian/comparator": "^1.2.3 || ^4.0", "yoast/phpunit-polyfills": "^1.0" }, @@ -124,7 +124,10 @@ ], "psr-4": { "Aws\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/data/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -151,9 +154,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.300.13" + "source": "https://github.com/aws/aws-sdk-php/tree/3.330.2" }, - "time": "2024-03-07T19:14:04+00:00" + "time": "2024-11-26T19:07:56+00:00" }, { "name": "composer/ca-bundle", @@ -161,24 +164,24 @@ "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd" + "reference": "3b1fc3f0be055baa7c6258b1467849c3e8204eb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/3ce240142f6d59b808dd65c1f52f7a1c252e6cfd", - "reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/3b1fc3f0be055baa7c6258b1467849c3e8204eb2", + "reference": "3b1fc3f0be055baa7c6258b1467849c3e8204eb2", "shasum": "" }, "require": { "ext-openssl": "*", "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "psr/log": "^1.0", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8 || ^9", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "default-branch": true, "type": "library", @@ -214,7 +217,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.4.1" + "source": "https://github.com/composer/ca-bundle/tree/1.5.3" }, "funding": [ { @@ -230,7 +233,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T10:16:52+00:00" + "time": "2024-11-04T10:15:26+00:00" }, { "name": "guzzlehttp/guzzle", @@ -238,18 +241,18 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -260,9 +263,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -270,6 +273,7 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, + "default-branch": true, "type": "library", "extra": { "bamarni-bin": { @@ -340,7 +344,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -356,7 +360,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", @@ -364,12 +368,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", "shasum": "" }, "require": { @@ -377,7 +381,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "default-branch": true, "type": "library", @@ -424,7 +428,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.4" }, "funding": [ { @@ -440,20 +444,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-10-17T10:06:22+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.x-dev", + "version": "2.7.x-dev", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -468,8 +472,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -541,7 +545,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -557,7 +561,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "mtdowling/jmespath.php", @@ -565,12 +569,12 @@ "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "b243cacd2a9803b4cbc259246aa5081208238c10" + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/b243cacd2a9803b4cbc259246aa5081208238c10", - "reference": "b243cacd2a9803b4cbc259246aa5081208238c10", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", "shasum": "" }, "require": { @@ -588,7 +592,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -622,9 +626,9 @@ ], "support": { "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/master" + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" }, - "time": "2023-11-30T16:26:47+00:00" + "time": "2024-09-04T18:46:31+00:00" }, { "name": "psr/http-client", @@ -681,23 +685,22 @@ }, { "name": "psr/http-factory", - "version": "dev-master", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "7037f4b0950474e9d1350e8df89b15f1842085f6" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/7037f4b0950474e9d1350e8df89b15f1842085f6", - "reference": "7037f4b0950474e9d1350e8df89b15f1842085f6", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -733,7 +736,7 @@ "support": { "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-09-22T11:16:44+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -839,12 +842,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { @@ -898,7 +901,7 @@ "type": "tidelift" } ], - "time": "2023-01-24T14:02:46+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -906,16 +909,16 @@ "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "2369cb908b33d7b7518cce042615de430142497f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2369cb908b33d7b7518cce042615de430142497f", + "reference": "2369cb908b33d7b7518cce042615de430142497f", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -963,7 +966,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/1.x" }, "funding": [ { @@ -979,7 +982,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-10T14:38:51+00:00" }, { "name": "ua-parser/uap-php", @@ -1182,32 +1185,32 @@ }, { "name": "automattic/vipwpcs", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd" + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", - "reference": "1b8960ebff9ea3eb482258a906ece4d1ee1e25fd", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/2b1d206d81b74ed999023cffd924f862ff2753c8", + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsextra": "^1.1.0", - "phpcsstandards/phpcsutils": "^1.0.8", - "sirbrillig/phpcs-variable-analysis": "^2.11.17", - "squizlabs/php_codesniffer": "^3.7.2", - "wp-coding-standards/wpcs": "^3.0" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.11", + "sirbrillig/phpcs-variable-analysis": "^2.11.18", + "squizlabs/php_codesniffer": "^3.9.2", + "wp-coding-standards/wpcs": "^3.1.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9", "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7 || ^8 || ^9" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -1232,7 +1235,7 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2023-09-05T11:01:05+00:00" + "time": "2024-05-10T20:31:09+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -1384,16 +1387,16 @@ }, { "name": "johnbillion/wp-compat", - "version": "dev-trunk", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/johnbillion/wp-compat.git", - "reference": "580cc09bdadd0922bd9de5d4e02fcc39c2ad342c" + "reference": "a72d20bb98f07088d602d1e412f908cd6901abf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnbillion/wp-compat/zipball/580cc09bdadd0922bd9de5d4e02fcc39c2ad342c", - "reference": "580cc09bdadd0922bd9de5d4e02fcc39c2ad342c", + "url": "https://api.github.com/repos/johnbillion/wp-compat/zipball/a72d20bb98f07088d602d1e412f908cd6901abf9", + "reference": "a72d20bb98f07088d602d1e412f908cd6901abf9", "shasum": "" }, "require": { @@ -1410,14 +1413,13 @@ "phpstan/phpstan-strict-rules": "1.6.0", "phpunit/phpunit": "^9.0", "roots/wordpress-core-installer": "1.100.0", - "roots/wordpress-full": "dev-main", + "roots/wordpress-full": "6.7-RC1", "wp-coding-standards/wpcs": "3.1.0" }, "suggest": { "phpstan/phpstan-deprecation-rules": "PHPStan rules for detecting usage of deprecated symbols", "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" }, - "default-branch": true, "type": "phpstan-extension", "extra": { "wordpress-install-dir": "vendor/wordpress/wordpress", @@ -1457,7 +1459,7 @@ "type": "github" } ], - "time": "2024-09-09T23:34:34+00:00" + "time": "2024-10-30T16:37:08+00:00" }, { "name": "myclabs/deep-copy", @@ -1465,12 +1467,12 @@ "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "2f5294676c802a62b0549f6bc8983f14294ce369" + "reference": "4764e040f8743e92b86c36f488f32d0265dd1dae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/2f5294676c802a62b0549f6bc8983f14294ce369", - "reference": "2f5294676c802a62b0549f6bc8983f14294ce369", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/4764e040f8743e92b86c36f488f32d0265dd1dae", + "reference": "4764e040f8743e92b86c36f488f32d0265dd1dae", "shasum": "" }, "require": { @@ -1518,20 +1520,20 @@ "type": "tidelift" } ], - "time": "2024-02-10T11:10:03+00:00" + "time": "2024-11-26T13:04:49+00:00" }, { "name": "nikic/php-parser", - "version": "dev-master", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -1542,9 +1544,8 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, - "default-branch": true, "bin": [ "bin/php-parse" ], @@ -1575,9 +1576,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", @@ -1700,16 +1701,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.6.0", + "version": "v6.7.1", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2" + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/86e8753e89d59849276dcdd91b9a7dd78bb4abe2", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/83448e918bf06d1ed3d67ceb6a985fc266a02fd1", + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1", "shasum": "" }, "require-dev": { @@ -1718,9 +1719,9 @@ "php": "^7.4 || ^8.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.4.1", - "phpstan/phpstan": "^1.10.49", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^9.5", - "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1", "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" }, "suggest": { @@ -1742,9 +1743,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.6.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.1" }, - "time": "2024-07-17T08:50:38+00:00" + "time": "2024-11-24T03:57:09+00:00" }, { "name": "php-stubs/wp-cli-stubs", @@ -1752,12 +1753,12 @@ "source": { "type": "git", "url": "https://github.com/php-stubs/wp-cli-stubs.git", - "reference": "dd9efeb1e1449a57fbdc80c967935659436716a3" + "reference": "f27ff9e8e29d7962cb070e58de70dfaf63183007" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wp-cli-stubs/zipball/dd9efeb1e1449a57fbdc80c967935659436716a3", - "reference": "dd9efeb1e1449a57fbdc80c967935659436716a3", + "url": "https://api.github.com/repos/php-stubs/wp-cli-stubs/zipball/f27ff9e8e29d7962cb070e58de70dfaf63183007", + "reference": "f27ff9e8e29d7962cb070e58de70dfaf63183007", "shasum": "" }, "require": { @@ -1787,9 +1788,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wp-cli-stubs/issues", - "source": "https://github.com/php-stubs/wp-cli-stubs/tree/master" + "source": "https://github.com/php-stubs/wp-cli-stubs/tree/v2.11.0" }, - "time": "2024-07-30T02:38:17+00:00" + "time": "2024-11-25T10:09:13+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1855,28 +1856,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -1906,22 +1907,37 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2022-10-25T01:46:02+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -1929,10 +1945,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -1961,9 +1977,24 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" }, { "name": "phpcsstandards/phpcsextra", @@ -1971,12 +2002,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "7384703f57a65879dc6fb5a0fc0dbe60fe2c1d8d" + "reference": "31ef149a1ee85ec0d355e58418d78d927e89d185" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/7384703f57a65879dc6fb5a0fc0dbe60fe2c1d8d", - "reference": "7384703f57a65879dc6fb5a0fc0dbe60fe2c1d8d", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/31ef149a1ee85ec0d355e58418d78d927e89d185", + "reference": "31ef149a1ee85ec0d355e58418d78d927e89d185", "shasum": "" }, "require": { @@ -2042,7 +2073,7 @@ "type": "open_collective" } ], - "time": "2024-03-04T02:11:33+00:00" + "time": "2024-11-11T18:03:33+00:00" }, { "name": "phpcsstandards/phpcsutils", @@ -2050,25 +2081,25 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "7883bd854d3a7594a1504fca79aacd3595dacd2d" + "reference": "9b2671b7342d2c8ad8ec78c8bdac45958d9de065" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/7883bd854d3a7594a1504fca79aacd3595dacd2d", - "reference": "7883bd854d3a7594a1504fca79aacd3595dacd2d", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/9b2671b7342d2c8ad8ec78c8bdac45958d9de065", + "reference": "9b2671b7342d2c8ad8ec78c8bdac45958d9de065", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.9.0 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.10.1 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcsstandards/phpcsdevcs": "^1.1.6", - "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" }, "default-branch": true, "type": "phpcodesniffer-standard", @@ -2131,7 +2162,7 @@ "type": "open_collective" } ], - "time": "2024-03-04T08:00:16+00:00" + "time": "2024-11-17T04:37:55+00:00" }, { "name": "phpstan/extension-installer", @@ -2188,12 +2219,12 @@ "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "eb78fe30b1adbc3294c306925f359bd83c311153" + "reference": "970117e7efeaafc9351796473f6fa75295f71914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/eb78fe30b1adbc3294c306925f359bd83c311153", - "reference": "eb78fe30b1adbc3294c306925f359bd83c311153", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/970117e7efeaafc9351796473f6fa75295f71914", + "reference": "970117e7efeaafc9351796473f6fa75295f71914", "shasum": "" }, "require": { @@ -2238,7 +2269,7 @@ "type": "github" } ], - "time": "2024-09-26T18:32:52+00:00" + "time": "2024-11-25T16:21:52+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -2293,31 +2324,31 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "0448d60087a382392a1b2a1abe434466e03dcc87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0448d60087a382392a1b2a1abe434466e03dcc87", + "reference": "0448d60087a382392a1b2a1abe434466e03dcc87", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -2326,7 +2357,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -2355,7 +2386,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" }, "funding": [ { @@ -2363,7 +2394,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-10-31T05:58:25+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2612,41 +2643,41 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5b92d2809fe6c9dbf892e8016df656f16ef157e1" + "reference": "5e58fee65c32a3eb5df82b1f5bc3a711cf7fa96f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5b92d2809fe6c9dbf892e8016df656f16ef157e1", - "reference": "5b92d2809fe6c9dbf892e8016df656f16ef157e1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5e58fee65c32a3eb5df82b1f5bc3a711cf7fa96f", + "reference": "5e58fee65c32a3eb5df82b1f5bc3a711cf7fa96f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -2707,7 +2738,7 @@ "type": "tidelift" } ], - "time": "2024-03-06T06:47:12+00:00" + "time": "2024-11-25T11:16:31+00:00" }, { "name": "sebastian/cli-parser", @@ -3515,12 +3546,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4" + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/20bdda85c7c585ab265c0c37ec052a019bae29c4", - "reference": "20bdda85c7c585ab265c0c37ec052a019bae29c4", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", + "reference": "ff553e7482dcee39fa4acc2b175d6ddeb0f7bc25", "shasum": "" }, "require": { @@ -3562,7 +3593,7 @@ "type": "github" } ], - "time": "2023-03-25T08:11:39+00:00" + "time": "2024-03-14T18:47:08+00:00" }, { "name": "sebastian/type", @@ -3679,12 +3710,12 @@ "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "b52d51ca3f224c4459a6ae686a0104e80fbfb7df" + "reference": "e9dae1311e8fc8d84ec33a4cc531f51777fa33ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/b52d51ca3f224c4459a6ae686a0104e80fbfb7df", - "reference": "b52d51ca3f224c4459a6ae686a0104e80fbfb7df", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/e9dae1311e8fc8d84ec33a4cc531f51777fa33ae", + "reference": "e9dae1311e8fc8d84ec33a4cc531f51777fa33ae", "shasum": "" }, "require": { @@ -3695,9 +3726,9 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0", "phpcsstandards/phpcsdevcs": "^1.1", "phpstan/phpstan": "^1.7", - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", "sirbrillig/phpcs-import-detection": "^1.1", - "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0@beta" + "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0" }, "default-branch": true, "type": "phpcodesniffer-standard", @@ -3730,7 +3761,7 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2024-03-04T15:42:00+00:00" + "time": "2024-11-23T21:14:27+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3738,12 +3769,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "e72c99b4785937d05f9790a95e41259dd8e9777c" + "reference": "392446832e44d74d85d3b7fc02193d8074831784" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/e72c99b4785937d05f9790a95e41259dd8e9777c", - "reference": "e72c99b4785937d05f9790a95e41259dd8e9777c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/392446832e44d74d85d3b7fc02193d8074831784", + "reference": "392446832e44d74d85d3b7fc02193d8074831784", "shasum": "" }, "require": { @@ -3811,7 +3842,7 @@ "type": "open_collective" } ], - "time": "2024-03-07T21:48:16+00:00" + "time": "2024-11-26T16:19:03+00:00" }, { "name": "symfony/polyfill-php73", @@ -3896,12 +3927,12 @@ "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "fdc31b2a37515acbe03069baf46489f88d0a4821" + "reference": "079942af95124e7e3bf95ab6ef2e006eba02e4e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/fdc31b2a37515acbe03069baf46489f88d0a4821", - "reference": "fdc31b2a37515acbe03069baf46489f88d0a4821", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/079942af95124e7e3bf95ab6ef2e006eba02e4e1", + "reference": "079942af95124e7e3bf95ab6ef2e006eba02e4e1", "shasum": "" }, "require": { @@ -3958,7 +3989,7 @@ "type": "github" } ], - "time": "2024-09-05T18:13:37+00:00" + "time": "2024-11-12T18:48:28+00:00" }, { "name": "theseer/tokenizer", @@ -4012,16 +4043,16 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", "shasum": "" }, "require": { @@ -4030,16 +4061,16 @@ "ext-tokenizer": "*", "ext-xmlreader": "*", "php": ">=5.4", - "phpcsstandards/phpcsextra": "^1.1.0", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.2" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", "phpcsstandards/phpcsdevtools": "^1.2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { "ext-iconv": "For improved results", @@ -4070,11 +4101,11 @@ }, "funding": [ { - "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "url": "https://opencollective.com/php_codesniffer", "type": "custom" } ], - "time": "2023-09-14T07:06:09+00:00" + "time": "2024-03-25T16:39:00+00:00" }, { "name": "yoast/phpunit-polyfills", @@ -4082,12 +4113,12 @@ "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "e3a5bad2c69c147fbde4b8ad83f422bac3b36153" + "reference": "36f2d3fe72766d45a2319eece04dce099cb72f37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/e3a5bad2c69c147fbde4b8ad83f422bac3b36153", - "reference": "e3a5bad2c69c147fbde4b8ad83f422bac3b36153", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/36f2d3fe72766d45a2319eece04dce099cb72f37", + "reference": "36f2d3fe72766d45a2319eece04dce099cb72f37", "shasum": "" }, "require": { @@ -4096,13 +4127,13 @@ }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", - "yoast/yoastcs": "^3.0.0" + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "yoast/yoastcs": "^3.1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -4137,23 +4168,23 @@ "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2024-03-04T17:15:33+00:00" + "time": "2024-11-18T19:20:35+00:00" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { - "ua-parser/uap-php": 20, - "szepeviktor/phpstan-wordpress": 20, - "phpstan/extension-installer": 20, "php-stubs/wp-cli-stubs": 20, - "johnbillion/wp-compat": 20 + "phpstan/extension-installer": 20, + "phpstan/phpstan-deprecation-rules": 20, + "szepeviktor/phpstan-wordpress": 20, + "ua-parser/uap-php": 20 }, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.4" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/tests/cypress/integration/image-processing/image-processing-microsoft-azure.test.js b/tests/cypress/integration/image-processing/image-processing-microsoft-azure.test.js index 1d0fd3af1..7bfa6ecca 100644 --- a/tests/cypress/integration/image-processing/image-processing-microsoft-azure.test.js +++ b/tests/cypress/integration/image-processing/image-processing-microsoft-azure.test.js @@ -205,12 +205,15 @@ describe( 'Image processing Tests', () => { cy.disableFeatureForRoles( 'feature_descriptive_text_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_tags_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_cropping', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_to_text_generator', [ 'administrator', ] ); @@ -223,12 +226,15 @@ describe( 'Image processing Tests', () => { cy.enableFeatureForRoles( 'feature_descriptive_text_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.enableFeatureForRoles( 'feature_image_tags_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.enableFeatureForRoles( 'feature_image_cropping', [ 'administrator', ] ); + cy.wait( 500 ); cy.enableFeatureForRoles( 'feature_image_to_text_generator', [ 'administrator', ] ); @@ -248,12 +254,15 @@ describe( 'Image processing Tests', () => { cy.disableFeatureForRoles( 'feature_descriptive_text_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_tags_generator', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_cropping', [ 'administrator', ] ); + cy.wait( 500 ); cy.disableFeatureForRoles( 'feature_image_to_text_generator', [ 'administrator', ] ); @@ -265,8 +274,11 @@ describe( 'Image processing Tests', () => { cy.enableFeatureForUsers( 'feature_descriptive_text_generator', [ 'admin', ] ); + cy.wait( 500 ); cy.enableFeatureForUsers( 'feature_image_tags_generator', [ 'admin' ] ); + cy.wait( 500 ); cy.enableFeatureForUsers( 'feature_image_cropping', [ 'admin' ] ); + cy.wait( 500 ); cy.enableFeatureForUsers( 'feature_image_to_text_generator', [ 'admin', ] ); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 4bc718ac9..40b187f84 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -188,6 +188,7 @@ Cypress.Commands.add( 'disableFeatureForRoles', ( feature, roles ) => { // Disable access for all users. cy.disableFeatureForUsers(); + cy.wait( 100 ); cy.saveFeatureSettings(); } ); From e3970f638dfb19f7077e7bf31b7bfa2373235bfa Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 26 Nov 2024 14:06:48 -0700 Subject: [PATCH 08/10] Fix unit tests with new threshold --- tests/Classifai/Azure/ComputerVisionTest.php | 2 +- tests/Classifai/Providers/Azure/ComputerVisionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Classifai/Azure/ComputerVisionTest.php b/tests/Classifai/Azure/ComputerVisionTest.php index 1abb424e1..ed32d9398 100644 --- a/tests/Classifai/Azure/ComputerVisionTest.php +++ b/tests/Classifai/Azure/ComputerVisionTest.php @@ -42,7 +42,7 @@ public function test_get_debug_information() { $this->assertEquals( [ 'Generate descriptive text' => '0, 0, 0', - 'Confidence threshold' => 55, + 'Confidence threshold' => 70, 'Latest response:' => 'N/A', ], $this->provider->get_debug_information( diff --git a/tests/Classifai/Providers/Azure/ComputerVisionTest.php b/tests/Classifai/Providers/Azure/ComputerVisionTest.php index e20a2e9c9..0b460795c 100644 --- a/tests/Classifai/Providers/Azure/ComputerVisionTest.php +++ b/tests/Classifai/Providers/Azure/ComputerVisionTest.php @@ -85,7 +85,7 @@ public function test_no_computer_vision_option_set() { 'endpoint_url' => '', 'api_key' => '', 'authenticated' => false, - 'descriptive_confidence_threshold' => 55, + 'descriptive_confidence_threshold' => 70, ], ] ); From 0b2c3d9f01f05b77d8cb2f7d2dff368ef75f8ff0 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 26 Nov 2024 15:29:58 -0700 Subject: [PATCH 09/10] Update the test data --- tests/cypress/plugins/functions.js | 9 +- tests/test-plugin/e2e-test-plugin.php | 4 +- tests/test-plugin/image_analyze.json | 242 ++++++++++++++++++-------- tests/test-plugin/ocr.json | 59 ------- 4 files changed, 171 insertions(+), 143 deletions(-) delete mode 100644 tests/test-plugin/ocr.json diff --git a/tests/cypress/plugins/functions.js b/tests/cypress/plugins/functions.js index 014016904..fbb9d8fa3 100644 --- a/tests/cypress/plugins/functions.js +++ b/tests/cypress/plugins/functions.js @@ -3,7 +3,6 @@ import * as chatgptData from '../../test-plugin/chatgpt.json'; import * as chatgptCustomExcerptData from '../../test-plugin/chatgpt-custom-excerpt-prompt.json'; import * as chatgptCustomTitleData from '../../test-plugin/chatgpt-custom-title-prompt.json'; import * as dalleData from '../../test-plugin/dalle.json'; -import * as ocrData from '../../test-plugin/ocr.json'; import * as whisperData from '../../test-plugin/whisper.json'; import * as imageData from '../../test-plugin/image_analyze.json'; import * as pdfData from '../../test-plugin/pdf.json'; @@ -99,7 +98,7 @@ export const getWhisperData = () => { */ export const getOCRData = () => { const words = []; - ocrData.regions.forEach( ( el ) => { + imageData.readResult.blocks.forEach( ( el ) => { el.lines.forEach( ( el2 ) => { el2.words.forEach( ( el3 ) => { words.push( el3.text ); @@ -116,10 +115,8 @@ export const getOCRData = () => { */ export const getImageData = () => { const data = { - altText: imageData.description.captions.filter( - ( el ) => el.confidence > 0.75 - )[ 0 ].text, - tags: imageData.tags + altText: imageData.captionResult.text, + tags: imageData.tagsResult.values .filter( ( el ) => el.confidence > 0.7 ) .map( ( el ) => el.name ), }; diff --git a/tests/test-plugin/e2e-test-plugin.php b/tests/test-plugin/e2e-test-plugin.php index 6753215d3..3659f1ffd 100644 --- a/tests/test-plugin/e2e-test-plugin.php +++ b/tests/test-plugin/e2e-test-plugin.php @@ -80,10 +80,8 @@ function classifai_test_mock_http_requests( $preempt, $parsed_args, $url ) { strpos( $url, 'https://e2e-test-azure-openai-embeddings.test/openai/deployments' ) !== false ) { $response = file_get_contents( __DIR__ . '/embeddings.json' ); - } elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/analyze' ) !== false ) { + } elseif ( strpos( $url, 'http://e2e-test-image-processing.test/computervision/imageanalysis:analyze?api-version=2024-02-01' ) !== false ) { $response = file_get_contents( __DIR__ . '/image_analyze.json' ); - } elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/ocr' ) !== false ) { - $response = file_get_contents( __DIR__ . '/ocr.json' ); } elseif ( strpos( $url, 'http://e2e-test-image-processing.test/vision/v3.2/generateThumbnail' ) !== false ) { $response = file_get_contents( __DIR__ . '../classifai/assets/img/icon256x256.png' ); } elseif ( strpos( $url, 'http://e2e-test-image-processing.test/pdf-read-result' ) !== false ) { diff --git a/tests/test-plugin/image_analyze.json b/tests/test-plugin/image_analyze.json index 5e0e58943..d2dbcb351 100644 --- a/tests/test-plugin/image_analyze.json +++ b/tests/test-plugin/image_analyze.json @@ -1,81 +1,173 @@ { - "tags": [ - { - "name": "text", - "confidence": 0.9854570031166077 - }, - { - "name": "design", - "confidence": 0.9676092863082886 - }, - { - "name": "screenshot", - "confidence": 0.9044408798217773 - }, - { - "name": "graphic", - "confidence": 0.8791931867599487 - }, - { - "name": "red", - "confidence": 0.8448371887207031 - }, - { - "name": "font", - "confidence": 0.8189171552658081 - }, - { - "name": "graphics", - "confidence": 0.7044017314910889 - }, - { - "name": "logo", - "confidence": 0.6639798283576965 - }, - { - "name": "typography", - "confidence": 0.6407877802848816 - }, - { - "name": "maroon", - "confidence": 0.6387392282485962 - }, - { - "name": "illustration", - "confidence": 0.6350329518318176 - }, - { - "name": "carmine", - "confidence": 0.6345877647399902 - }, - { - "name": "abstract", - "confidence": 0.624541163444519 - }, - { - "name": "vector graphics", - "confidence": 0.21607014536857605 - }, - { - "name": "clipart", - "confidence": 0.20682862401008606 - } - ], - "description": { - "tags": [ - "text" - ], - "captions": [ - { - "text": "text", - "confidence": 0.8448402285575867 + "modelVersion": "2023-10-01", + "metadata": { + "height": 250, + "width": 772 + }, + "tagsResult": { + "values": [ + { + "name": "text", + "confidence": 0.9854570031166077 + }, + { + "name": "design", + "confidence": 0.9676092863082886 + }, + { + "name": "screenshot", + "confidence": 0.9044408798217773 + }, + { + "name": "graphic", + "confidence": 0.8791931867599487 + }, + { + "name": "red", + "confidence": 0.8448371887207031 + }, + { + "name": "font", + "confidence": 0.8189171552658081 + }, + { + "name": "graphics", + "confidence": 0.7044017314910889 + }, + { + "name": "logo", + "confidence": 0.6639798283576965 + }, + { + "name": "typography", + "confidence": 0.6407877802848816 + }, + { + "name": "maroon", + "confidence": 0.6387392282485962 + }, + { + "name": "illustration", + "confidence": 0.6350329518318176 + }, + { + "name": "carmine", + "confidence": 0.6345877647399902 + }, + { + "name": "abstract", + "confidence": 0.624541163444519 + }, + { + "name": "vector graphics", + "confidence": 0.21607014536857605 + }, + { + "name": "clipart", + "confidence": 0.20682862401008606 } ] }, - "requestId": "50fdeac0-9ef5-4e81-9e05-d392d15907ca", - "metadata": { - "height": 250, - "width": 772, - "format": "Png" + "captionResult": { + "text": "Text", + "confidence": 0.8448402285575867 + }, + "readResult": { + "blocks": [ + { + "lines": [ + { + "text": "CLASSIFAI_", + "boundingPolygon": [ + { + "x": 193, + "y": 337 + }, + { + "x": 614, + "y": 348 + }, + { + "x": 617, + "y": 507 + }, + { + "x": 187, + "y": 510 + } + ], + "words": [ + { + "text": "CLASSIFAI_", + "boundingPolygon": [ + { + "x": 188, + "y": 337 + }, + { + "x": 600, + "y": 341 + }, + { + "x": 599, + "y": 511 + }, + { + "x": 187, + "y": 510 + } + ], + "confidence": 0.991 + } + ] + }, + { + "text": "Test", + "boundingPolygon": [ + { + "x": 193, + "y": 337 + }, + { + "x": 614, + "y": 348 + }, + { + "x": 617, + "y": 507 + }, + { + "x": 187, + "y": 510 + } + ], + "words": [ + { + "text": "Test", + "boundingPolygon": [ + { + "x": 188, + "y": 337 + }, + { + "x": 600, + "y": 341 + }, + { + "x": 599, + "y": 511 + }, + { + "x": 187, + "y": 510 + } + ], + "confidence": 0.991 + } + ] + } + ] + } + ] } } diff --git a/tests/test-plugin/ocr.json b/tests/test-plugin/ocr.json deleted file mode 100644 index 1b98a7e05..000000000 --- a/tests/test-plugin/ocr.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "language": "en", - "textAngle": 0.0, - "orientation": "Up", - "regions": [ - { - "boundingBox": "319,188,904,146", - "lines": [ - { - "boundingBox": "319,188,899,59", - "words": [ - { - "boundingBox": "319,188,250,48", - "text": "ClassifAI" - }, - { - "boundingBox": "588,188,180,59", - "text": "Brings" - }, - { - "boundingBox": "783,191,56,44", - "text": "Al" - }, - { - "boundingBox": "856,190,104,46", - "text": "and" - }, - { - "boundingBox": "979,188,239,48", - "text": "Machine" - } - ] - }, - { - "boundingBox": "320,275,903,59", - "words": [ - { - "boundingBox": "320,275,245,59", - "text": "Learning" - }, - { - "boundingBox": "582,275,245,48", - "text": "Services" - }, - { - "boundingBox": "841,281,56,42", - "text": "to" - }, - { - "boundingBox": "912,277,311,46", - "text": "WordPress" - } - ] - } - ] - } - ], - "modelVersion": "2021-04-01" -} From fdd80b55c31a4bc185cb05112912aa26bd354f11 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 27 Nov 2024 21:36:46 -0700 Subject: [PATCH 10/10] Fix extra spaces --- includes/Classifai/Providers/Azure/ComputerVision.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 3631df70a..c8be843ca 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -402,8 +402,8 @@ public function ocr_processing( string $image_url, int $attachment_id = 0 ) { return new WP_Error( 'invalid', esc_html__( 'This attachment can\'t be processed.', 'classifai' ) ); } - $feature = new ImageTextExtraction(); - $rtn = ''; + $feature = new ImageTextExtraction(); + $rtn = ''; /** * Filters whether to run OCR scanning on the current image.