From dc720e3407141c14b5218ae9467d558fa81e2bc5 Mon Sep 17 00:00:00 2001 From: dkotter Date: Thu, 11 Jan 2024 16:22:23 +0000 Subject: [PATCH] Release: (0f6b46e) Merge branch 'develop' into trunk --- autoload.php | 12 +- classifai.php | 4 +- config.php | 2 +- includes/Classifai/Admin/BulkActions.php | 58 ++++- includes/Classifai/Admin/DebugInfo.php | 2 +- includes/Classifai/Admin/Onboarding.php | 11 +- .../Classifai/Admin/PreviewClassifierData.php | 5 +- includes/Classifai/Admin/SavePostHandler.php | 4 +- includes/Classifai/Admin/Update.php | 2 +- includes/Classifai/Admin/UserProfile.php | 5 + includes/Classifai/Blocks.php | 4 +- .../recommended-content-block/register.php | 12 +- .../Classifai/Command/ClassifaiCommand.php | 59 ++--- .../Classifai/Command/RSSImporterCommand.php | 1 - includes/Classifai/Plugin.php | 3 +- includes/Classifai/PostClassifier.php | 1 - .../Providers/Azure/ComputerVision.php | 2 +- includes/Classifai/Providers/Azure/OCR.php | 1 - .../Providers/Azure/Personalizer.php | 16 +- .../Providers/Azure/SmartCropping.php | 1 - .../Providers/Azure/TextToSpeech.php | 25 +- .../Classifai/Providers/OpenAI/APIRequest.php | 1 - .../Classifai/Providers/OpenAI/ChatGPT.php | 2 +- includes/Classifai/Providers/OpenAI/DallE.php | 5 +- .../OpenAI/EmbeddingCalculations.php | 7 +- .../Classifai/Providers/OpenAI/Embeddings.php | 15 +- .../Classifai/Providers/OpenAI/OpenAI.php | 20 +- .../Classifai/Providers/OpenAI/Tokenizer.php | 1 - .../Classifai/Providers/OpenAI/Whisper.php | 4 +- .../Providers/OpenAI/Whisper/Transcribe.php | 1 - .../Providers/OpenAI/Whisper/Whisper.php | 1 - includes/Classifai/Providers/Provider.php | 2 +- includes/Classifai/Providers/Watson/NLU.php | 18 +- .../Classifai/Services/ImageProcessing.php | 1 - .../Classifai/Services/LanguageProcessing.php | 2 +- includes/Classifai/Services/Personalizer.php | 2 +- includes/Classifai/Services/Service.php | 5 +- .../Classifai/Taxonomy/CategoryTaxonomy.php | 1 - .../Classifai/Taxonomy/ConceptTaxonomy.php | 1 - .../Classifai/Taxonomy/EntityTaxonomy.php | 1 - .../Classifai/Taxonomy/KeywordTaxonomy.php | 1 - .../Classifai/Taxonomy/TaxonomyFactory.php | 3 +- includes/Classifai/Watson/APIRequest.php | 1 - includes/Classifai/Watson/Classifier.php | 1 - includes/Classifai/Watson/Normalizer.php | 1 - languages/classifai.pot | 240 +++++++++--------- readme.txt | 2 +- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +- vendor/composer/autoload_static.php | 8 +- vendor/composer/installed.php | 4 +- 51 files changed, 293 insertions(+), 300 deletions(-) diff --git a/autoload.php b/autoload.php index 8f2cb4fbf..5ea902fbf 100644 --- a/autoload.php +++ b/autoload.php @@ -58,23 +58,23 @@ public function add_namespace( $prefix, $base_dir, $prepend = false ) { /** * Loads the class file for a given class name. * - * @param string $class The fully-qualified class name. + * @param string $classname The fully-qualified class name. * @return mixed The mapped file name on success, or boolean false on * failure. */ - public function load_class( $class ) { + public function load_class( $classname ) { // the current namespace prefix - $prefix = $class; + $prefix = $classname; // work backwards through the namespace names of the fully-qualified // class name to find a mapped file name - while ( false !== $pos = strrpos( $prefix, '\\' ) ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition + while ( false !== $pos = strrpos( $prefix, '\\' ) ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition, WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition // retain the trailing namespace separator in the prefix - $prefix = substr( $class, 0, $pos + 1 ); + $prefix = substr( $classname, 0, $pos + 1 ); // the rest is the relative class name - $relative_class = substr( $class, $pos + 1 ); + $relative_class = substr( $classname, $pos + 1 ); // try to load a mapped file for the prefix and relative class $mapped_file = $this->load_mapped_file( $prefix, $relative_class ); diff --git a/classifai.php b/classifai.php index f30b02482..daa46115f 100644 --- a/classifai.php +++ b/classifai.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/10up/classifai * Update URI: https://classifaiplugin.com * Description: Enhance your WordPress content with Artificial Intelligence and Machine Learning services. - * Version: 2.5.0 + * Version: 2.5.1 * Requires at least: 6.1 * Requires PHP: 7.4 * Author: 10up @@ -37,7 +37,7 @@ function classifai_site_meets_php_requirements() { if ( ! classifai_site_meets_php_requirements() ) { add_action( 'admin_notices', - function() { + function () { ?>

diff --git a/config.php b/config.php index 5de1c7668..4050f7991 100644 --- a/config.php +++ b/config.php @@ -4,7 +4,7 @@ * declared here instead of a Class. */ -$plugin_version = '2.5.0'; +$plugin_version = '2.5.1'; if ( file_exists( __DIR__ . '/.commit' ) ) { $plugin_version .= '-' . file_get_contents( __DIR__ . '/.commit' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents diff --git a/includes/Classifai/Admin/BulkActions.php b/includes/Classifai/Admin/BulkActions.php index 03fe96fd8..b9e2c2789 100644 --- a/includes/Classifai/Admin/BulkActions.php +++ b/includes/Classifai/Admin/BulkActions.php @@ -7,6 +7,8 @@ use Classifai\Providers\OpenAI\Embeddings; use Classifai\Providers\OpenAI\Whisper; use Classifai\Providers\OpenAI\Whisper\Transcribe; +use Classifai\Providers\Watson\NLU; + use function Classifai\get_post_types_for_language_settings; use function Classifai\get_supported_post_types; use function Classifai\get_tts_supported_post_types; @@ -55,6 +57,11 @@ public function can_register() { */ private $text_to_speech; + /** + * @var \Classifai\Providers\Watson\NLU + */ + private $ibm_watson_nlu; + /** * Register the actions needed. */ @@ -72,12 +79,33 @@ public function register_language_processing_hooks() { $this->chat_gpt = new ChatGPT( false ); $this->embeddings = new Embeddings( false ); $this->text_to_speech = new TextToSpeech( false ); + $this->ibm_watson_nlu = new NLU( false ); $embeddings_post_types = []; - $nlu_post_types = get_supported_post_types(); - $text_to_speech_post_types = get_tts_supported_post_types(); + $nlu_post_types = []; + $text_to_speech_post_types = []; $chat_gpt_post_types = []; + // Set up the NLU post types if the feature is enabled. Otherwise clear. + if ( + $this->ibm_watson_nlu && + $this->ibm_watson_nlu->is_feature_enabled( 'content_classification' ) + ) { + $nlu_post_types = get_supported_post_types(); + } else { + $this->ibm_watson_nlu = null; + } + + // Set up the NLU post types if the feature is enabled. Otherwise clear. + if ( + $this->text_to_speech && + $this->text_to_speech->is_feature_enabled( 'content_classification' ) + ) { + $text_to_speech_post_types = get_tts_supported_post_types(); + } else { + $this->text_to_speech = null; + } + // Set up the save post handler if we have any post types. if ( ! empty( $nlu_post_types ) || ! empty( $text_to_speech_post_types ) ) { $this->save_post_handler = new SavePostHandler(); @@ -100,11 +128,6 @@ public function register_language_processing_hooks() { $this->embeddings = null; } - // Clear our TextToSpeech handler if no post types are set up. - if ( empty( $text_to_speech_post_types ) ) { - $this->text_to_speech = null; - } - // Merge our post types together and make them unique. $post_types = array_unique( array_merge( $chat_gpt_post_types, $embeddings_post_types, $nlu_post_types, $text_to_speech_post_types ) ); @@ -147,15 +170,24 @@ public function register_bulk_actions( $bulk_actions ) { $nlu_post_types = get_supported_post_types(); if ( - ! empty( $nlu_post_types ) || - ( is_a( $this->embeddings, '\Classifai\Providers\OpenAI\Embeddings' ) && ! empty( $this->embeddings->supported_post_types() ) ) + ( + is_a( $this->ibm_watson_nlu, '\Classifai\Providers\Watson\NLU' ) && + $this->ibm_watson_nlu->is_feature_enabled( 'content_classification' ) && + ! empty( $nlu_post_types ) + ) || + ( + is_a( $this->embeddings, '\Classifai\Providers\OpenAI\Embeddings' ) && + $this->embeddings->is_feature_enabled( 'classification' ) && + ! empty( $this->embeddings->supported_post_types() ) + ) ) { $bulk_actions['classify'] = __( 'Classify', 'classifai' ); } if ( is_a( $this->chat_gpt, '\Classifai\Providers\OpenAI\ChatGPT' ) && - in_array( get_current_screen()->post_type, array_keys( get_post_types_for_language_settings() ), true ) + in_array( get_current_screen()->post_type, array_keys( get_post_types_for_language_settings() ), true ) && + $this->chat_gpt->is_feature_enabled( 'excerpt_generation' ) ) { $bulk_actions['generate_excerpt'] = __( 'Generate excerpt', 'classifai' ); } @@ -221,7 +253,10 @@ public function bulk_action_handler( $redirect_to, $doaction, $post_ids ) { foreach ( $post_ids as $post_id ) { if ( 'classify' === $doaction ) { // Handle NLU classification. - if ( is_a( $this->save_post_handler, '\Classifai\Admin\SavePostHandler' ) ) { + if ( + is_a( $this->ibm_watson_nlu, '\Classifai\Providers\Watson\NLU' ) && + is_a( $this->save_post_handler, '\Classifai\Admin\SavePostHandler' ) + ) { $action = 'classified'; $this->save_post_handler->classify( $post_id ); } @@ -454,5 +489,4 @@ public function register_media_row_action( $actions, $post ) { return $actions; } - } diff --git a/includes/Classifai/Admin/DebugInfo.php b/includes/Classifai/Admin/DebugInfo.php index c967a5d30..cf9132a60 100644 --- a/includes/Classifai/Admin/DebugInfo.php +++ b/includes/Classifai/Admin/DebugInfo.php @@ -75,7 +75,7 @@ public function add_classifai_debug_information( $information ) { $fields = []; } - $validate_field = function( $field ) { + $validate_field = function ( $field ) { if ( ! is_array( $field ) ) { return false; } diff --git a/includes/Classifai/Admin/Onboarding.php b/includes/Classifai/Admin/Onboarding.php index be329cca8..9caab2777 100644 --- a/includes/Classifai/Admin/Onboarding.php +++ b/includes/Classifai/Admin/Onboarding.php @@ -328,14 +328,14 @@ public function handle_step_submission() { * Sanitize variables using sanitize_text_field and wp_unslash. Arrays are cleaned recursively. * Non-scalar values are ignored. * - * @param string|array $var Data to sanitize. + * @param string|array $data Data to sanitize. * @return string|array */ - public function classifai_sanitize( $var ) { - if ( is_array( $var ) ) { - return array_map( array( $this, 'classifai_sanitize' ), $var ); + public function classifai_sanitize( $data ) { + if ( is_array( $data ) ) { + return array_map( array( $this, 'classifai_sanitize' ), $data ); } else { - return is_scalar( $var ) ? sanitize_text_field( wp_unslash( $var ) ) : $var; + return is_scalar( $data ) ? sanitize_text_field( wp_unslash( $data ) ) : $data; } } @@ -663,5 +663,4 @@ public function get_configured_features() { return $configured_features; } - } diff --git a/includes/Classifai/Admin/PreviewClassifierData.php b/includes/Classifai/Admin/PreviewClassifierData.php index 7f090464c..42f9ea6c5 100644 --- a/includes/Classifai/Admin/PreviewClassifierData.php +++ b/includes/Classifai/Admin/PreviewClassifierData.php @@ -105,7 +105,7 @@ public function filter_classify_preview_data( $classified_data ) { if ( 'categories' === $feature ) { $classified_data[ $feature ] = array_filter( $classified_data[ $feature ], - function( $item ) use ( $taxonomy ) { + function ( $item ) use ( $taxonomy ) { $keep = false; $parts = explode( '/', $item['label'] ); $parts = array_filter( $parts ); @@ -128,7 +128,7 @@ function( $item ) use ( $taxonomy ) { $classified_data[ $feature ] = array_filter( $classified_data[ $feature ], - function( $item ) use ( $taxonomy, $key ) { + function ( $item ) use ( $taxonomy, $key ) { $name = $item['text']; if ( 'keyword' === $key ) { $name = preg_replace( '#^[a-z]+ ([A-Z].*)$#', '$1', $name ); @@ -148,4 +148,3 @@ function( $item ) use ( $taxonomy, $key ) { return $classified_data; } } - diff --git a/includes/Classifai/Admin/SavePostHandler.php b/includes/Classifai/Admin/SavePostHandler.php index a3faf50f1..e4af86613 100644 --- a/includes/Classifai/Admin/SavePostHandler.php +++ b/includes/Classifai/Admin/SavePostHandler.php @@ -2,8 +2,8 @@ namespace Classifai\Admin; -use \Classifai\Providers\Azure\TextToSpeech; -use \Classifai\Watson\Normalizer; +use Classifai\Providers\Azure\TextToSpeech; +use Classifai\Watson\Normalizer; use function Classifai\get_classification_mode; /** diff --git a/includes/Classifai/Admin/Update.php b/includes/Classifai/Admin/Update.php index 69b0d2530..04c8e224a 100644 --- a/includes/Classifai/Admin/Update.php +++ b/includes/Classifai/Admin/Update.php @@ -59,7 +59,7 @@ public function init() { ); $this->updater->addResultFilter( - function( $plugin_info, $http_response = null ) { + function ( $plugin_info ) { $plugin_info->icons = array( 'svg' => CLASSIFAI_PLUGIN_URL . 'assets/img/icon.svg', ); diff --git a/includes/Classifai/Admin/UserProfile.php b/includes/Classifai/Admin/UserProfile.php index 1c9e36b16..cd33df529 100644 --- a/includes/Classifai/Admin/UserProfile.php +++ b/includes/Classifai/Admin/UserProfile.php @@ -148,6 +148,11 @@ public function get_allowed_features( $user_id ) { continue; } foreach ( $provider_features as $feature => $feature_name ) { + // Check if feature is enabled. + if ( ! $provider_class->is_enabled( $feature ) ) { + continue; + } + $access_control = new AccessControl( $provider_class, $feature ); // Check if feature has user based opt-out enabled. diff --git a/includes/Classifai/Blocks.php b/includes/Classifai/Blocks.php index 785e80d05..8cb370512 100644 --- a/includes/Classifai/Blocks.php +++ b/includes/Classifai/Blocks.php @@ -15,8 +15,8 @@ * @return void */ function setup() { - $n = function( $function ) { - return __NAMESPACE__ . "\\$function"; + $n = function ( $function_name ) { + return __NAMESPACE__ . "\\$function_name"; }; add_action( 'enqueue_block_assets', $n( 'blocks_styles' ) ); diff --git a/includes/Classifai/Blocks/recommended-content-block/register.php b/includes/Classifai/Blocks/recommended-content-block/register.php index 0dbfad283..0522cac03 100644 --- a/includes/Classifai/Blocks/recommended-content-block/register.php +++ b/includes/Classifai/Blocks/recommended-content-block/register.php @@ -7,15 +7,15 @@ namespace Classifai\Blocks\RecommendedContentBlock; -use function Classifai\get_asset_info; use Classifai\Providers\Azure\Personalizer; +use function Classifai\get_asset_info; /** * Register the block */ function register() { - $n = function( $function ) { - return __NAMESPACE__ . "\\$function"; + $n = function ( $function_name ) { + return __NAMESPACE__ . "\\$function_name"; }; $personalizer = new Personalizer( false ); @@ -48,13 +48,11 @@ function register() { /** * Render callback method for the block * - * @param array $attributes The blocks attributes. - * @param string $content Data returned from InnerBlocks.Content. - * @param array $block Block information such as context. + * @param array $attributes The blocks attributes. * * @return string The rendered block markup. */ -function render_block_callback( $attributes, $content, $block ) { +function render_block_callback( $attributes ) { // Render block in Gutenberg Editor. if ( defined( 'REST_REQUEST' ) && \REST_REQUEST ) { $personalizer = new Personalizer( false ); diff --git a/includes/Classifai/Command/ClassifaiCommand.php b/includes/Classifai/Command/ClassifaiCommand.php index bc677063c..92193535a 100644 --- a/includes/Classifai/Command/ClassifaiCommand.php +++ b/includes/Classifai/Command/ClassifaiCommand.php @@ -106,7 +106,6 @@ public function post( $args = [], $opts = [] ) { } else { \WP_CLI::log( 'No posts to classify.' ); } - } /** @@ -301,11 +300,11 @@ public function text_to_speech( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::log( sprintf( 'Error while processing item ID %s: %s', $post_id, $result->get_error_message() ) ); - $errors ++; + ++$errors; } } - $count ++; + ++$count; } $this->inmemory_cleanup(); @@ -314,7 +313,7 @@ public function text_to_speech( $args = [], $opts = [] ) { \WP_CLI::log( sprintf( 'Batch %d is done, proceeding to next batch', $paged ) ); } - $paged ++; + ++$paged; } while ( $total ); } else { // If no post type is specified, we have to have a list of post IDs. @@ -332,7 +331,7 @@ public function text_to_speech( $args = [], $opts = [] ) { // Ensure we have a valid post ID. if ( ! get_post( $post_id ) ) { \WP_CLI::log( sprintf( 'Item ID %d does not exist', $post_id ) ); - $errors ++; + ++$errors; continue; } @@ -340,7 +339,7 @@ public function text_to_speech( $args = [], $opts = [] ) { $post_type = get_post_type( $post_id ); if ( ! $post_type || ! in_array( $post_type, $allowed_post_types, true ) ) { \WP_CLI::log( sprintf( 'The "%s" post type is not enabled for Text to Speech processing', $post_type ) ); - $errors ++; + ++$errors; continue; } @@ -349,12 +348,12 @@ public function text_to_speech( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::log( sprintf( 'Error while processing item ID %s: %s', $post_id, $result->get_error_message() ) ); - $errors ++; + ++$errors; } } $progress_bar->tick(); - $count ++; + ++$count; } $progress_bar->finish(); @@ -432,7 +431,7 @@ public function transcribe_audio( $args = [], $opts = [] ) { $transcribe = new Transcribe( $attachment_id, $settings ); if ( ! $this->should_transcribe_attachment( $attachment, $attachment_id, $transcribe, (bool) $opts['force'] ) ) { - $errors ++; + ++$errors; continue; } @@ -441,12 +440,12 @@ public function transcribe_audio( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %s: %s', $attachment_id, $result->get_error_message() ), false ); - $errors ++; + ++$errors; } } $progress_bar->tick(); - $count ++; + ++$count; } $progress_bar->finish(); @@ -484,7 +483,7 @@ public function transcribe_audio( $args = [], $opts = [] ) { $transcribe = new Transcribe( $attachment_id, $settings ); if ( ! $this->should_transcribe_attachment( $attachment, (int) $attachment_id, $transcribe, (bool) $opts['force'] ) ) { - $errors ++; + ++$errors; continue; } @@ -493,11 +492,11 @@ public function transcribe_audio( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %s: %s', $attachment_id, $result->get_error_message() ), false ); - $errors ++; + ++$errors; } } - $count ++; + ++$count; } $this->inmemory_cleanup(); @@ -506,7 +505,7 @@ public function transcribe_audio( $args = [], $opts = [] ) { \WP_CLI::log( sprintf( 'Batch %d is done, proceeding to next batch', $paged ) ); } - $paged ++; + ++$paged; } while ( $total ); } @@ -613,7 +612,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { // Don't process if an item has an existing excerpt and we aren't forcing it. if ( '' !== trim( $post->post_excerpt ) && ! $opts['force'] ) { \WP_CLI::log( sprintf( 'Item ID %d has an existing excerpt and the force option hasn\'t been set. Skipping...', $post->ID ) ); - $skipped ++; + ++$skipped; continue; } @@ -621,7 +620,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %d: %s', $post->ID, $result->get_error_message() ), false ); - $errors ++; + ++$errors; continue; } @@ -637,7 +636,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { ); } - $count ++; + ++$count; } $this->inmemory_cleanup(); @@ -646,7 +645,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { \WP_CLI::log( sprintf( 'Batch %d is done, proceeding to next batch', $paged ) ); } - $paged ++; + ++$paged; } while ( $total ); } else { // If no post type is specified, we have to have a list of post IDs. @@ -666,7 +665,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { // Don't process if an item has an existing excerpt and we aren't forcing it. if ( $post && '' !== trim( $post->post_excerpt ) && ! $opts['force'] ) { \WP_CLI::log( sprintf( 'Item ID %d has an existing excerpt and the force option hasn\'t been set. Skipping...', $post_id ) ); - $skipped ++; + ++$skipped; continue; } @@ -674,7 +673,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %d: %s', $post_id, $result->get_error_message() ), false ); - $errors ++; + ++$errors; continue; } @@ -691,7 +690,7 @@ public function generate_excerpt( $args = [], $opts = [] ) { } $progress_bar->tick(); - $count ++; + ++$count; } $progress_bar->finish(); @@ -913,7 +912,6 @@ public function crop( $args = [], $opts = [] ) { } else { \WP_CLI::error( "Cropped $total_success images, $total_errors errors." ); } - } /** @@ -1005,11 +1003,11 @@ public function embeddings( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %s', $post_id ), false ); - $errors ++; + ++$errors; } } - $count ++; + ++$count; } $this->inmemory_cleanup(); @@ -1018,7 +1016,7 @@ public function embeddings( $args = [], $opts = [] ) { \WP_CLI::log( sprintf( 'Batch %d is done, proceeding to next batch', $paged ) ); } - $paged ++; + ++$paged; } while ( $total ); } else { // If no post type is specified, we have to have a list of post IDs. @@ -1036,7 +1034,7 @@ public function embeddings( $args = [], $opts = [] ) { // Ensure we have a valid post ID. if ( ! get_post( $post_id ) ) { \WP_CLI::error( sprintf( 'Item ID %d does not exist', $post_id ), false ); - $errors ++; + ++$errors; continue; } @@ -1044,7 +1042,7 @@ public function embeddings( $args = [], $opts = [] ) { $post_type = get_post_type( $post_id ); if ( ! $post_type || ! in_array( $post_type, $allowed_post_types, true ) ) { \WP_CLI::error( sprintf( 'The "%s" post type is not enabled for OpenAI Embeddings processing', $post_type ), false ); - $errors ++; + ++$errors; continue; } @@ -1053,12 +1051,12 @@ public function embeddings( $args = [], $opts = [] ) { if ( is_wp_error( $result ) ) { \WP_CLI::error( sprintf( 'Error while processing item ID %s', $post_id ), false ); - $errors ++; + ++$errors; } } $progress_bar->tick(); - $count ++; + ++$count; } $progress_bar->finish(); @@ -1229,7 +1227,6 @@ private function print( $output, $post_id ) { \WP_CLI::warning( "Failed to classify $post_id: " . $output->get_error_message() ); } } - } try { diff --git a/includes/Classifai/Command/RSSImporterCommand.php b/includes/Classifai/Command/RSSImporterCommand.php index a841f43af..ba7251f41 100644 --- a/includes/Classifai/Command/RSSImporterCommand.php +++ b/includes/Classifai/Command/RSSImporterCommand.php @@ -229,5 +229,4 @@ public function get_url_meta( $url ) { return $response; } } - } diff --git a/includes/Classifai/Plugin.php b/includes/Classifai/Plugin.php index c45544f02..66b72eb7d 100644 --- a/includes/Classifai/Plugin.php +++ b/includes/Classifai/Plugin.php @@ -163,10 +163,9 @@ public function add_privacy_policy_content() { /** * Enqueue the admin scripts. * - * @param string $hook_suffix The current admin page. * @since 2.4.0 Use get_asset_info to get the asset version and dependencies. */ - public function enqueue_admin_assets( $hook_suffix ) { + public function enqueue_admin_assets() { $user_profile = new Admin\UserProfile(); $allowed_features = $user_profile->get_allowed_features( get_current_user_id() ); diff --git a/includes/Classifai/PostClassifier.php b/includes/Classifai/PostClassifier.php index 8f3290552..2b9ca40db 100644 --- a/includes/Classifai/PostClassifier.php +++ b/includes/Classifai/PostClassifier.php @@ -180,5 +180,4 @@ public function get_features() { return $features; } - } diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 1a8f16dcc..95db60be1 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -158,7 +158,7 @@ public function add_ocr_data_to_api_response() { 'attachment', 'classifai_has_ocr', [ - 'get_callback' => function( $params ) { + 'get_callback' => function ( $params ) { return ! empty( get_post_meta( $params['id'], 'classifai_computer_vision_ocr', true ) ); }, 'schema' => [ diff --git a/includes/Classifai/Providers/Azure/OCR.php b/includes/Classifai/Providers/Azure/OCR.php index 2cccfc89a..998d88a3d 100644 --- a/includes/Classifai/Providers/Azure/OCR.php +++ b/includes/Classifai/Providers/Azure/OCR.php @@ -364,5 +364,4 @@ public function process( string $url ) { return $rtn; } - } diff --git a/includes/Classifai/Providers/Azure/Personalizer.php b/includes/Classifai/Providers/Azure/Personalizer.php index 3b82d8652..53474f175 100644 --- a/includes/Classifai/Providers/Azure/Personalizer.php +++ b/includes/Classifai/Providers/Azure/Personalizer.php @@ -330,14 +330,14 @@ public function get_recommended_content( $attributes ) { $exclude = $attributes['excludeId']; $actions = array_filter( $actions, - function( $ele ) use ( $exclude ) { + function ( $ele ) use ( $exclude ) { return $ele['id'] && absint( $ele['id'] ) !== absint( $exclude ); } ); } $action_ids = array_map( - function( $ele ) { + function ( $ele ) { return $ele['id']; }, $actions @@ -423,20 +423,20 @@ public function render_recommended_content( $attributes ) { // Sort ranking by probability. usort( $ranking, - function( $a, $b ) { + function ( $a, $b ) { return $a->probability - $b->probability; } ); $recommended_ids = array_map( - function( $ele ) { + function ( $ele ) { return absint( $ele->id ); }, $ranking ); $recommended_ids = array_filter( $recommended_ids, - function( $ele ) use ( $rewarded_post ) { + function ( $ele ) use ( $rewarded_post ) { return $ele && absint( $ele ) !== absint( $rewarded_post ); } ); @@ -652,11 +652,11 @@ protected function get_user_agent_features() { /** * Get array of words from string. Words as key of array. * - * @param string $string String to get words from. + * @param string $text String of text to get words from. * @return array */ - protected function get_string_words( $string ) { - $str_array = preg_split( '/\s+/', $string ); + protected function get_string_words( $text ) { + $str_array = preg_split( '/\s+/', $text ); $words = array(); foreach ( $str_array as $str ) { $words[ $str ] = 1; diff --git a/includes/Classifai/Providers/Azure/SmartCropping.php b/includes/Classifai/Providers/Azure/SmartCropping.php index c46f86419..e4d0b553e 100644 --- a/includes/Classifai/Providers/Azure/SmartCropping.php +++ b/includes/Classifai/Providers/Azure/SmartCropping.php @@ -382,4 +382,3 @@ public function request_cropped_thumbnail( $data ) { return new \WP_Error( 'classifai_smart_cropping_failed', 'A Smart Cropping error occurred.' ); } } - diff --git a/includes/Classifai/Providers/Azure/TextToSpeech.php b/includes/Classifai/Providers/Azure/TextToSpeech.php index 36e27e71e..7b962e016 100644 --- a/includes/Classifai/Providers/Azure/TextToSpeech.php +++ b/includes/Classifai/Providers/Azure/TextToSpeech.php @@ -566,11 +566,11 @@ public function add_synthesize_speech_meta_to_rest_api() { $supported_post_types, 'classifai_synthesize_speech', array( - 'get_callback' => function( $object ) { - $audio_id = get_post_meta( $object['id'], self::AUDIO_ID_KEY, true ); + 'get_callback' => function ( $data ) { + $audio_id = get_post_meta( $data['id'], self::AUDIO_ID_KEY, true ); if ( - ( $this->get_audio_generation_initial_state( $object['id'] ) && ! $audio_id ) || - ( $this->get_audio_generation_subsequent_state( $object['id'] ) && $audio_id ) + ( $this->get_audio_generation_initial_state( $data['id'] ) && ! $audio_id ) || + ( $this->get_audio_generation_subsequent_state( $data['id'] ) && $audio_id ) ) { return true; } else { @@ -588,18 +588,18 @@ public function add_synthesize_speech_meta_to_rest_api() { $supported_post_types, 'classifai_display_generated_audio', array( - 'get_callback' => function( $object ) { + 'get_callback' => function ( $data ) { // Default to display the audio if available. - if ( metadata_exists( 'post', $object['id'], self::DISPLAY_GENERATED_AUDIO ) ) { - return (bool) get_post_meta( $object['id'], self::DISPLAY_GENERATED_AUDIO, true ); + if ( metadata_exists( 'post', $data['id'], self::DISPLAY_GENERATED_AUDIO ) ) { + return (bool) get_post_meta( $data['id'], self::DISPLAY_GENERATED_AUDIO, true ); } return true; }, - 'update_callback' => function( $value, $object ) { + 'update_callback' => function ( $value, $data ) { if ( $value ) { - delete_post_meta( $object->ID, self::DISPLAY_GENERATED_AUDIO ); + delete_post_meta( $data->ID, self::DISPLAY_GENERATED_AUDIO ); } else { - update_post_meta( $object->ID, self::DISPLAY_GENERATED_AUDIO, false ); + update_post_meta( $data->ID, self::DISPLAY_GENERATED_AUDIO, false ); } }, 'schema' => [ @@ -613,8 +613,8 @@ public function add_synthesize_speech_meta_to_rest_api() { $supported_post_types, 'classifai_post_audio_id', array( - 'get_callback' => function( $object ) { - $post_audio_id = get_post_meta( $object['id'], self::AUDIO_ID_KEY, true ); + 'get_callback' => function ( $data ) { + $post_audio_id = get_post_meta( $data['id'], self::AUDIO_ID_KEY, true ); return (int) $post_audio_id; }, 'schema' => [ @@ -751,7 +751,6 @@ public function render_meta_box( $post ) { api_key; } - } diff --git a/includes/Classifai/Providers/OpenAI/ChatGPT.php b/includes/Classifai/Providers/OpenAI/ChatGPT.php index 2bd946e9a..feb64e526 100644 --- a/includes/Classifai/Providers/OpenAI/ChatGPT.php +++ b/includes/Classifai/Providers/OpenAI/ChatGPT.php @@ -1137,7 +1137,7 @@ function ( $prompt ) { $prompts = array_map( function ( $prompt ) use ( &$has_default ) { - $default = $prompt['default'] && ! $has_default; + $default = isset( $prompt['default'] ) && $prompt['default'] && ! $has_default; if ( $default ) { $has_default = true; diff --git a/includes/Classifai/Providers/OpenAI/DallE.php b/includes/Classifai/Providers/OpenAI/DallE.php index b61aae527..75e830fc1 100644 --- a/includes/Classifai/Providers/OpenAI/DallE.php +++ b/includes/Classifai/Providers/OpenAI/DallE.php @@ -7,11 +7,10 @@ use Classifai\Providers\Provider; use Classifai\Providers\OpenAI\APIRequest; +use WP_Error; use function Classifai\get_asset_info; use function Classifai\render_disable_feature_link; -use WP_Error; - class DallE extends Provider { use \Classifai\Providers\OpenAI\OpenAI; @@ -574,7 +573,7 @@ public function get_roles() { $roles = get_editable_roles() ?? []; $roles = array_filter( $roles, - function( $role ) { + function ( $role ) { return isset( $role['capabilities'], $role['capabilities']['upload_files'] ) && $role['capabilities']['upload_files']; } ); diff --git a/includes/Classifai/Providers/OpenAI/EmbeddingCalculations.php b/includes/Classifai/Providers/OpenAI/EmbeddingCalculations.php index 7d41b162e..81b039cde 100644 --- a/includes/Classifai/Providers/OpenAI/EmbeddingCalculations.php +++ b/includes/Classifai/Providers/OpenAI/EmbeddingCalculations.php @@ -26,7 +26,7 @@ public function similarity( array $source_embedding = [], array $compare_embeddi // Get the combined average between the two embeddings. $combined_average = array_sum( array_map( - function( $x, $y ) { + function ( $x, $y ) { return (float) $x * (float) $y; }, $source_embedding, @@ -37,7 +37,7 @@ function( $x, $y ) { // Get the average of the source embedding. $source_average = array_sum( array_map( - function( $x ) { + function ( $x ) { return pow( (float) $x, 2 ); }, $source_embedding @@ -47,7 +47,7 @@ function( $x ) { // Get the average of the compare embedding. $compare_average = array_sum( array_map( - function( $x ) { + function ( $x ) { return pow( (float) $x, 2 ); }, $compare_embedding @@ -60,5 +60,4 @@ function( $x ) { // Ensure we are within the range of 0 to 1.0. return max( 0, min( abs( (float) $distance ), 1.0 ) ); } - } diff --git a/includes/Classifai/Providers/OpenAI/Embeddings.php b/includes/Classifai/Providers/OpenAI/Embeddings.php index d6415fd47..f4dfbd137 100644 --- a/includes/Classifai/Providers/OpenAI/Embeddings.php +++ b/includes/Classifai/Providers/OpenAI/Embeddings.php @@ -11,9 +11,9 @@ use Classifai\Providers\OpenAI\EmbeddingCalculations; use Classifai\Providers\Watson\NLU; use Classifai\Watson\Normalizer; +use WP_Error; use function Classifai\get_asset_info; use function Classifai\language_processing_features_enabled; -use WP_Error; class Embeddings extends Provider { @@ -616,7 +616,7 @@ private function get_terms( array $embedding = [] ) { 'label' => get_term( $term_id )->name, 'score' => $similarity, ]; - $term_added++; + ++$term_added; } // Only add the number of terms specified in settings. @@ -624,7 +624,7 @@ private function get_terms( array $embedding = [] ) { $terms = array_slice( $terms, 0, $number_to_add, true ); } - $index++; + ++$index; } return $result; @@ -886,13 +886,13 @@ public function add_process_content_meta_to_rest_api() { $supported_post_types, 'classifai_process_content', [ - 'get_callback' => function( $object ) { - $process_content = get_post_meta( $object['id'], '_classifai_process_content', true ); + 'get_callback' => function ( $data ) { + $process_content = get_post_meta( $data['id'], '_classifai_process_content', true ); return ( 'no' === $process_content ) ? 'no' : 'yes'; }, - 'update_callback' => function ( $value, $object ) { + 'update_callback' => function ( $value, $data ) { $value = ( 'no' === $value ) ? 'no' : 'yes'; - return update_post_meta( $object->ID, '_classifai_process_content', $value ); + return update_post_meta( $data->ID, '_classifai_process_content', $value ); }, 'schema' => [ 'type' => 'string', @@ -994,5 +994,4 @@ public function save_metabox( $post_id ) { update_post_meta( $post_id, '_classifai_process_content', 'yes' ); } } - } diff --git a/includes/Classifai/Providers/OpenAI/OpenAI.php b/includes/Classifai/Providers/OpenAI/OpenAI.php index 149542263..8e4e27b4c 100644 --- a/includes/Classifai/Providers/OpenAI/OpenAI.php +++ b/includes/Classifai/Providers/OpenAI/OpenAI.php @@ -13,11 +13,11 @@ trait OpenAI { /** - * OpenAI completions URL + * OpenAI model URL * * @var string */ - protected $completions_url = 'https://api.openai.com/v1/completions'; + protected $model_url = 'https://api.openai.com/v1/models'; /** * Add our OpenAI API settings field. @@ -32,7 +32,7 @@ protected function setup_api_fields( string $default_api_key = '' ) { add_settings_section( $this->get_option_name(), $this->provider_service_name, - function() { + function () { printf( wp_kses( /* translators: %1$s is replaced with the OpenAI sign up URL */ @@ -139,18 +139,7 @@ protected function authenticate_credentials( string $api_key = '' ) { // Make request to ensure credentials work. $request = new APIRequest( $api_key ); - $response = $request->post( - $this->completions_url, - [ - 'body' => wp_json_encode( - [ - 'model' => 'ada', - 'prompt' => 'hi', - 'max_tokens' => 1, - ] - ), - ] - ); + $response = $request->get( $this->model_url ); return ! is_wp_error( $response ) ? true : $response; } @@ -293,5 +282,4 @@ public function get_supported_taxonomies() { return $taxonomies; } - } diff --git a/includes/Classifai/Providers/OpenAI/Tokenizer.php b/includes/Classifai/Providers/OpenAI/Tokenizer.php index 0b74f4cb4..58314af4b 100644 --- a/includes/Classifai/Providers/OpenAI/Tokenizer.php +++ b/includes/Classifai/Providers/OpenAI/Tokenizer.php @@ -130,5 +130,4 @@ public function trim_content( string $content = '', int $max_tokens = 0 ) { return trim( $trimmed_content ); } - } diff --git a/includes/Classifai/Providers/OpenAI/Whisper.php b/includes/Classifai/Providers/OpenAI/Whisper.php index 55dd45d4f..331fb6741 100644 --- a/includes/Classifai/Providers/OpenAI/Whisper.php +++ b/includes/Classifai/Providers/OpenAI/Whisper.php @@ -7,9 +7,8 @@ use Classifai\Providers\Provider; use Classifai\Providers\OpenAI\Whisper\Transcribe; -use function Classifai\clean_input; - use WP_Error; +use function Classifai\clean_input; class Whisper extends Provider { @@ -337,5 +336,4 @@ public function get_provider_debug_information( $settings = null, $configured = __( 'Latest response', 'classifai' ) => $this->get_formatted_latest_response( get_transient( 'classifai_openai_whisper_latest_response' ) ), ]; } - } diff --git a/includes/Classifai/Providers/OpenAI/Whisper/Transcribe.php b/includes/Classifai/Providers/OpenAI/Whisper/Transcribe.php index 449585826..33cf185b2 100644 --- a/includes/Classifai/Providers/OpenAI/Whisper/Transcribe.php +++ b/includes/Classifai/Providers/OpenAI/Whisper/Transcribe.php @@ -141,5 +141,4 @@ public function add_transcription( string $text = '' ) { return $text; } } - } diff --git a/includes/Classifai/Providers/OpenAI/Whisper/Whisper.php b/includes/Classifai/Providers/OpenAI/Whisper/Whisper.php index 97b126245..5a11a11ea 100644 --- a/includes/Classifai/Providers/OpenAI/Whisper/Whisper.php +++ b/includes/Classifai/Providers/OpenAI/Whisper/Whisper.php @@ -82,5 +82,4 @@ public function should_process( int $attachment_id ) { return $process; } - } diff --git a/includes/Classifai/Providers/Provider.php b/includes/Classifai/Providers/Provider.php index cd75a66c0..25ad651a6 100644 --- a/includes/Classifai/Providers/Provider.php +++ b/includes/Classifai/Providers/Provider.php @@ -638,7 +638,7 @@ abstract public function get_provider_debug_information(); * * @return mixed */ - public function rest_endpoint_callback( $post_id, $route_to_call, $args = [] ) { + public function rest_endpoint_callback( $post_id, $route_to_call, $args = [] ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed return null; } diff --git a/includes/Classifai/Providers/Watson/NLU.php b/includes/Classifai/Providers/Watson/NLU.php index 12665eb63..3073d62a3 100644 --- a/includes/Classifai/Providers/Watson/NLU.php +++ b/includes/Classifai/Providers/Watson/NLU.php @@ -9,12 +9,12 @@ use Classifai\Admin\PreviewClassifierData; use Classifai\Providers\Provider; use Classifai\Taxonomy\TaxonomyFactory; +use WP_Error; use function Classifai\get_plugin_settings; use function Classifai\get_post_types_for_language_settings; use function Classifai\get_post_statuses_for_language_settings; use function Classifai\get_asset_info; use function Classifai\get_classification_mode; -use WP_Error; class NLU extends Provider { @@ -298,7 +298,7 @@ public function setup_fields_sections() { add_settings_section( $this->get_option_name(), $this->provider_service_name, - function() { + function () { printf( wp_kses( /* translators: %1$s is the link to register for an IBM Cloud account, %2$s is the link to setup the NLU service */ @@ -334,7 +334,6 @@ function() { ); echo '

'; } - }, $this->get_option_name() ); @@ -394,7 +393,7 @@ protected function do_credentials_section() { add_settings_field( 'toggle', '', - function() { + function () { printf( '%s', $this->use_username_password() @@ -904,7 +903,7 @@ public function get_provider_debug_information( $settings = null, $configured = $settings_post_types = $settings['post_types'] ?? []; $post_types = array_filter( array_keys( $settings_post_types ), - function( $post_type ) use ( $settings_post_types ) { + function ( $post_type ) use ( $settings_post_types ) { return 1 === intval( $settings_post_types[ $post_type ] ); } ); @@ -1051,13 +1050,13 @@ public function add_process_content_meta_to_rest_api() { $supported_post_types, 'classifai_process_content', array( - 'get_callback' => function( $object ) { - $process_content = get_post_meta( $object['id'], '_classifai_process_content', true ); + 'get_callback' => function ( $data ) { + $process_content = get_post_meta( $data['id'], '_classifai_process_content', true ); return ( 'no' === $process_content ) ? 'no' : 'yes'; }, - 'update_callback' => function ( $value, $object ) { + 'update_callback' => function ( $value, $data ) { $value = ( 'no' === $value ) ? 'no' : 'yes'; - return update_post_meta( $object->ID, '_classifai_process_content', $value ); + return update_post_meta( $data->ID, '_classifai_process_content', $value ); }, 'schema' => [ 'type' => 'string', @@ -1102,5 +1101,4 @@ public function is_enabled( string $feature ) { /** This filter is documented in includes/Classifai/Providers/Provider.php */ return apply_filters( "classifai_is_{$feature}_enabled", $is_enabled, $settings ); } - } diff --git a/includes/Classifai/Services/ImageProcessing.php b/includes/Classifai/Services/ImageProcessing.php index 57765e514..f61f4fab1 100644 --- a/includes/Classifai/Services/ImageProcessing.php +++ b/includes/Classifai/Services/ImageProcessing.php @@ -392,5 +392,4 @@ public function custom_fields_edit( $form_fields ) { unset( $form_fields['watson-entity'] ); return $form_fields; } - } diff --git a/includes/Classifai/Services/LanguageProcessing.php b/includes/Classifai/Services/LanguageProcessing.php index 901ee291e..38f02324a 100644 --- a/includes/Classifai/Services/LanguageProcessing.php +++ b/includes/Classifai/Services/LanguageProcessing.php @@ -6,10 +6,10 @@ namespace Classifai\Services; use Classifai\Admin\SavePostHandler; -use function Classifai\find_provider_class; use WP_REST_Server; use WP_REST_Request; use WP_Error; +use function Classifai\find_provider_class; class LanguageProcessing extends Service { diff --git a/includes/Classifai/Services/Personalizer.php b/includes/Classifai/Services/Personalizer.php index 1dde8e015..b9c11e477 100644 --- a/includes/Classifai/Services/Personalizer.php +++ b/includes/Classifai/Services/Personalizer.php @@ -5,10 +5,10 @@ namespace Classifai\Services; -use function Classifai\find_provider_class; use WP_REST_Server; use WP_REST_Request; use WP_Error; +use function Classifai\find_provider_class; class Personalizer extends Service { diff --git a/includes/Classifai/Services/Service.php b/includes/Classifai/Services/Service.php index bc8f1a4ad..37fe90af5 100644 --- a/includes/Classifai/Services/Service.php +++ b/includes/Classifai/Services/Service.php @@ -5,8 +5,8 @@ namespace Classifai\Services; -use function Classifai\find_provider_class; use WP_Error; +use function Classifai\find_provider_class; abstract class Service { @@ -253,7 +253,7 @@ public function add_service_debug_information( $debug_information ) { * @since 1.4.0 */ public function get_service_debug_information() { - $make_line = function( $provider ) { + $make_line = function ( $provider ) { return [ 'label' => sprintf( '%s: %s', $this->get_display_name(), $provider->get_provider_name() ), 'value' => $provider->get_provider_debug_information(), @@ -284,5 +284,4 @@ public function check_term_permissions( string $tax = '' ) { return true; } - } diff --git a/includes/Classifai/Taxonomy/CategoryTaxonomy.php b/includes/Classifai/Taxonomy/CategoryTaxonomy.php index 51278dbd1..4c562213c 100644 --- a/includes/Classifai/Taxonomy/CategoryTaxonomy.php +++ b/includes/Classifai/Taxonomy/CategoryTaxonomy.php @@ -44,5 +44,4 @@ public function get_visibility() { return \Classifai\get_feature_enabled( 'category' ) && \Classifai\get_feature_taxonomy( 'category' ) === $this->get_name(); } - } diff --git a/includes/Classifai/Taxonomy/ConceptTaxonomy.php b/includes/Classifai/Taxonomy/ConceptTaxonomy.php index c900f107c..3363e548b 100644 --- a/includes/Classifai/Taxonomy/ConceptTaxonomy.php +++ b/includes/Classifai/Taxonomy/ConceptTaxonomy.php @@ -44,5 +44,4 @@ public function get_visibility() { return \Classifai\get_feature_enabled( 'concept' ) && \Classifai\get_feature_taxonomy( 'concept' ) === $this->get_name(); } - } diff --git a/includes/Classifai/Taxonomy/EntityTaxonomy.php b/includes/Classifai/Taxonomy/EntityTaxonomy.php index f743f4561..e91f0e419 100644 --- a/includes/Classifai/Taxonomy/EntityTaxonomy.php +++ b/includes/Classifai/Taxonomy/EntityTaxonomy.php @@ -44,5 +44,4 @@ public function get_visibility() { return \Classifai\get_feature_enabled( 'entity' ) && \Classifai\get_feature_taxonomy( 'entity' ) === $this->get_name(); } - } diff --git a/includes/Classifai/Taxonomy/KeywordTaxonomy.php b/includes/Classifai/Taxonomy/KeywordTaxonomy.php index 4d5fe3ac9..9c0fed4b2 100644 --- a/includes/Classifai/Taxonomy/KeywordTaxonomy.php +++ b/includes/Classifai/Taxonomy/KeywordTaxonomy.php @@ -44,5 +44,4 @@ public function get_visibility() { return \Classifai\get_feature_enabled( 'keyword' ) && \Classifai\get_feature_taxonomy( 'keyword' ) === $this->get_name(); } - } diff --git a/includes/Classifai/Taxonomy/TaxonomyFactory.php b/includes/Classifai/Taxonomy/TaxonomyFactory.php index 289c61659..72cc8ec14 100644 --- a/includes/Classifai/Taxonomy/TaxonomyFactory.php +++ b/includes/Classifai/Taxonomy/TaxonomyFactory.php @@ -96,7 +96,7 @@ public function build( $taxonomy ) { return $instance; } else { - throw new \Exception( "Mapping not found for Taxonomy: $taxonomy " ); + throw new \Exception( esc_html( "Mapping not found for Taxonomy: $taxonomy " ) ); } } @@ -118,5 +118,4 @@ public function exists( $taxonomy ) { public function get_supported_taxonomies() { return array_keys( $this->mapping ); } - } diff --git a/includes/Classifai/Watson/APIRequest.php b/includes/Classifai/Watson/APIRequest.php index f448ffc9e..c3d36de3c 100644 --- a/includes/Classifai/Watson/APIRequest.php +++ b/includes/Classifai/Watson/APIRequest.php @@ -153,5 +153,4 @@ public function add_headers( &$options ) { $options['headers']['Accept'] = 'application/json'; $options['headers']['Content-Type'] = 'application/json'; } - } diff --git a/includes/Classifai/Watson/Classifier.php b/includes/Classifai/Watson/Classifier.php index 8ca5197f6..22291d608 100644 --- a/includes/Classifai/Watson/Classifier.php +++ b/includes/Classifai/Watson/Classifier.php @@ -124,5 +124,4 @@ public function get_body( $text, $options = [] ) { return wp_json_encode( $options ); } - } diff --git a/includes/Classifai/Watson/Normalizer.php b/includes/Classifai/Watson/Normalizer.php index b24d84d4a..a2c1ccaf7 100644 --- a/includes/Classifai/Watson/Normalizer.php +++ b/includes/Classifai/Watson/Normalizer.php @@ -74,5 +74,4 @@ public function normalize_content( $post_content, $post_title = '', $post_id = f return $post_content; } - } diff --git a/languages/classifai.pot b/languages/classifai.pot index 6c5283005..43a9dfb80 100644 --- a/languages/classifai.pot +++ b/languages/classifai.pot @@ -1,14 +1,14 @@ -# Copyright (C) 2023 10up +# Copyright (C) 2024 10up # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: ClassifAI 2.5.0\n" +"Project-Id-Version: ClassifAI 2.5.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/classifai\n" -"POT-Creation-Date: 2023-12-13 15:16:19+00:00\n" +"POT-Creation-Date: 2024-01-11 16:22:16+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "X-Generator: node-wp-i18n 1.2.7\n" @@ -49,72 +49,72 @@ msgid "" "install the stable version of ClassifAI instead." msgstr "" -#: includes/Classifai/Admin/BulkActions.php:153 -#: includes/Classifai/Admin/BulkActions.php:405 +#: includes/Classifai/Admin/BulkActions.php:184 +#: includes/Classifai/Admin/BulkActions.php:440 msgid "Classify" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:160 -#: includes/Classifai/Admin/BulkActions.php:414 +#: includes/Classifai/Admin/BulkActions.php:192 +#: includes/Classifai/Admin/BulkActions.php:449 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:278 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:333 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:660 msgid "Generate excerpt" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:168 -#: includes/Classifai/Admin/BulkActions.php:423 +#: includes/Classifai/Admin/BulkActions.php:200 +#: includes/Classifai/Admin/BulkActions.php:458 #: includes/Classifai/Providers/Azure/TextToSpeech.php:78 msgid "Text to speech" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:188 +#: includes/Classifai/Admin/BulkActions.php:220 msgid "Scan image" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:192 +#: includes/Classifai/Admin/BulkActions.php:224 msgid "Smart crop" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:196 -#: includes/Classifai/Providers/OpenAI/Whisper.php:152 +#: includes/Classifai/Admin/BulkActions.php:228 +#: includes/Classifai/Providers/OpenAI/Whisper.php:151 msgid "Transcribe audio" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:332 +#: includes/Classifai/Admin/BulkActions.php:367 msgid "Classified" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:336 +#: includes/Classifai/Admin/BulkActions.php:371 msgid "Excerpts generated for" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:340 +#: includes/Classifai/Admin/BulkActions.php:375 msgid "Text to speech conversion done for" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:344 +#: includes/Classifai/Admin/BulkActions.php:379 msgid "Scanned" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:348 +#: includes/Classifai/Admin/BulkActions.php:383 msgid "Cropped" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:352 +#: includes/Classifai/Admin/BulkActions.php:387 msgid "Transcribed" msgstr "" -#: includes/Classifai/Admin/BulkActions.php:358 +#: includes/Classifai/Admin/BulkActions.php:393 #. translators: %1$s: action, %2$s: number of posts, %3$s: post type msgid "%1$s %2$s %3$s." msgid_plural "%1$s %2$s %3$ss." msgstr[0] "" msgstr[1] "" -#: includes/Classifai/Admin/BulkActions.php:451 -#: includes/Classifai/Providers/OpenAI/Whisper.php:149 -#: includes/Classifai/Providers/OpenAI/Whisper.php:199 +#: includes/Classifai/Admin/BulkActions.php:486 +#: includes/Classifai/Providers/OpenAI/Whisper.php:148 +#: includes/Classifai/Providers/OpenAI/Whisper.php:198 msgid "Transcribe" msgstr "" @@ -200,7 +200,7 @@ msgstr "" #: includes/Classifai/Admin/SavePostHandler.php:407 #: includes/Classifai/Providers/Azure/TextToSpeech.php:706 -#: includes/Classifai/Providers/Watson/NLU.php:993 +#: includes/Classifai/Providers/Watson/NLU.php:992 msgid "Post" msgstr "" @@ -219,12 +219,12 @@ msgid "Opt out of using the %s feature." msgstr "" #: includes/Classifai/Admin/templates/classifai-header.php:27 -#: includes/Classifai/Plugin.php:239 +#: includes/Classifai/Plugin.php:238 msgid "Settings" msgstr "" #: includes/Classifai/Admin/templates/classifai-header.php:36 -#: includes/Classifai/Plugin.php:234 +#: includes/Classifai/Plugin.php:233 msgid "Set up" msgstr "" @@ -334,26 +334,26 @@ msgid "" "like language processing, image processing, and content recommendations." msgstr "" -#: includes/Classifai/Plugin.php:190 +#: includes/Classifai/Plugin.php:189 msgid "API Password" msgstr "" -#: includes/Classifai/Plugin.php:191 +#: includes/Classifai/Plugin.php:190 #: includes/Classifai/Providers/Azure/ComputerVision.php:975 #: includes/Classifai/Providers/Azure/Personalizer.php:152 #: includes/Classifai/Providers/Azure/TextToSpeech.php:179 #: includes/Classifai/Providers/OpenAI/OpenAI.php:78 -#: includes/Classifai/Providers/Watson/NLU.php:383 +#: includes/Classifai/Providers/Watson/NLU.php:382 msgid "API Key" msgstr "" -#: includes/Classifai/Plugin.php:192 -#: includes/Classifai/Providers/Watson/NLU.php:402 +#: includes/Classifai/Plugin.php:191 +#: includes/Classifai/Providers/Watson/NLU.php:401 msgid "Use an API Key instead?" msgstr "" -#: includes/Classifai/Plugin.php:193 -#: includes/Classifai/Providers/Watson/NLU.php:401 +#: includes/Classifai/Plugin.php:192 +#: includes/Classifai/Providers/Watson/NLU.php:400 msgid "Use a username/password instead?" msgstr "" @@ -366,8 +366,8 @@ msgid "Enables ability to select which roles can access this feature." msgstr "" #: includes/Classifai/Providers/AccessControl.php:230 -#: includes/Classifai/Providers/OpenAI/DallE.php:404 -#: includes/Classifai/Providers/OpenAI/Whisper.php:336 +#: includes/Classifai/Providers/OpenAI/DallE.php:403 +#: includes/Classifai/Providers/OpenAI/Whisper.php:335 msgid "Allowed roles" msgstr "" @@ -661,9 +661,9 @@ msgstr "" #: includes/Classifai/Providers/Azure/Personalizer.php:779 #: includes/Classifai/Providers/Azure/TextToSpeech.php:454 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:659 -#: includes/Classifai/Providers/OpenAI/DallE.php:402 +#: includes/Classifai/Providers/OpenAI/DallE.php:401 #: includes/Classifai/Providers/OpenAI/Embeddings.php:360 -#: includes/Classifai/Providers/OpenAI/Whisper.php:334 +#: includes/Classifai/Providers/OpenAI/Whisper.php:333 msgid "Authenticated" msgstr "" @@ -671,13 +671,13 @@ msgstr "" #: includes/Classifai/Providers/OpenAI/ChatGPT.php:659 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:660 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:663 +#: includes/Classifai/Providers/OpenAI/DallE.php:401 #: includes/Classifai/Providers/OpenAI/DallE.php:402 -#: includes/Classifai/Providers/OpenAI/DallE.php:403 #: includes/Classifai/Providers/OpenAI/Embeddings.php:360 #: includes/Classifai/Providers/OpenAI/Embeddings.php:361 +#: includes/Classifai/Providers/OpenAI/Whisper.php:333 #: includes/Classifai/Providers/OpenAI/Whisper.php:334 -#: includes/Classifai/Providers/OpenAI/Whisper.php:335 -#: includes/Classifai/Providers/Watson/NLU.php:915 +#: includes/Classifai/Providers/Watson/NLU.php:914 #: includes/Classifai/Services/ServicesManager.php:324 msgid "yes" msgstr "" @@ -686,13 +686,13 @@ msgstr "" #: includes/Classifai/Providers/OpenAI/ChatGPT.php:659 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:660 #: includes/Classifai/Providers/OpenAI/ChatGPT.php:663 +#: includes/Classifai/Providers/OpenAI/DallE.php:401 #: includes/Classifai/Providers/OpenAI/DallE.php:402 -#: includes/Classifai/Providers/OpenAI/DallE.php:403 #: includes/Classifai/Providers/OpenAI/Embeddings.php:360 #: includes/Classifai/Providers/OpenAI/Embeddings.php:361 +#: includes/Classifai/Providers/OpenAI/Whisper.php:333 #: includes/Classifai/Providers/OpenAI/Whisper.php:334 -#: includes/Classifai/Providers/OpenAI/Whisper.php:335 -#: includes/Classifai/Providers/Watson/NLU.php:915 +#: includes/Classifai/Providers/Watson/NLU.php:914 #: includes/Classifai/Services/ServicesManager.php:324 msgid "no" msgstr "" @@ -700,8 +700,8 @@ msgstr "" #: includes/Classifai/Providers/Azure/ComputerVision.php:1325 #: includes/Classifai/Providers/Azure/Personalizer.php:780 #: includes/Classifai/Providers/Azure/TextToSpeech.php:455 -#: includes/Classifai/Providers/Watson/NLU.php:355 -#: includes/Classifai/Providers/Watson/NLU.php:916 +#: includes/Classifai/Providers/Watson/NLU.php:354 +#: includes/Classifai/Providers/Watson/NLU.php:915 msgid "API URL" msgstr "" @@ -923,15 +923,15 @@ msgstr "" msgid "Controls the display of the audio player on the front-end." msgstr "" -#: includes/Classifai/Providers/Azure/TextToSpeech.php:898 +#: includes/Classifai/Providers/Azure/TextToSpeech.php:897 msgid "Play audio" msgstr "" -#: includes/Classifai/Providers/Azure/TextToSpeech.php:898 +#: includes/Classifai/Providers/Azure/TextToSpeech.php:897 msgid "Pause audio" msgstr "" -#: includes/Classifai/Providers/Azure/TextToSpeech.php:917 +#: includes/Classifai/Providers/Azure/TextToSpeech.php:916 msgid "Listen to this" msgstr "" @@ -1091,10 +1091,10 @@ msgid "Allowed roles (resize)" msgstr "" #: includes/Classifai/Providers/OpenAI/ChatGPT.php:668 -#: includes/Classifai/Providers/OpenAI/DallE.php:407 +#: includes/Classifai/Providers/OpenAI/DallE.php:406 #: includes/Classifai/Providers/OpenAI/Embeddings.php:366 -#: includes/Classifai/Providers/OpenAI/Whisper.php:337 -#: includes/Classifai/Providers/Watson/NLU.php:920 +#: includes/Classifai/Providers/OpenAI/Whisper.php:336 +#: includes/Classifai/Providers/Watson/NLU.php:919 msgid "Latest response" msgstr "" @@ -1134,134 +1134,134 @@ msgid "" "your settings." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:48 -#: includes/Classifai/Providers/OpenAI/DallE.php:156 -#: includes/Classifai/Providers/OpenAI/DallE.php:219 -#: includes/Classifai/Providers/OpenAI/DallE.php:403 +#: includes/Classifai/Providers/OpenAI/DallE.php:47 +#: includes/Classifai/Providers/OpenAI/DallE.php:155 +#: includes/Classifai/Providers/OpenAI/DallE.php:218 +#: includes/Classifai/Providers/OpenAI/DallE.php:402 msgid "Generate images" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:53 +#: includes/Classifai/Providers/OpenAI/DallE.php:52 msgid "OpenAI DALL·E" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:56 +#: includes/Classifai/Providers/OpenAI/DallE.php:55 msgid "Image generation" msgstr "" +#: includes/Classifai/Providers/OpenAI/DallE.php:82 #: includes/Classifai/Providers/OpenAI/DallE.php:83 -#: includes/Classifai/Providers/OpenAI/DallE.php:84 msgid "Generate Images" msgstr "" +#: includes/Classifai/Providers/OpenAI/DallE.php:82 #: includes/Classifai/Providers/OpenAI/DallE.php:83 -#: includes/Classifai/Providers/OpenAI/DallE.php:84 msgid "Generate Image" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:146 +#: includes/Classifai/Providers/OpenAI/DallE.php:145 #. translators: %1$s is replaced with the OpenAI DALL·E URL msgid "Image generated by OpenAI's DALL·E" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:156 -#: includes/Classifai/Providers/OpenAI/DallE.php:221 +#: includes/Classifai/Providers/OpenAI/DallE.php:155 +#: includes/Classifai/Providers/OpenAI/DallE.php:220 msgid "Generate image" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:157 +#: includes/Classifai/Providers/OpenAI/DallE.php:156 msgid "Something went wrong. No results found" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:158 +#: includes/Classifai/Providers/OpenAI/DallE.php:157 msgid "Select image" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:200 +#: includes/Classifai/Providers/OpenAI/DallE.php:199 msgid "Enter a prompt below to generate images." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:202 +#: includes/Classifai/Providers/OpenAI/DallE.php:201 msgid "Enter a prompt below to generate an image." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:209 +#: includes/Classifai/Providers/OpenAI/DallE.php:208 msgid "" "Once images are generated, choose one or more of those to import into your " "Media Library and then choose one image to insert." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:211 +#: includes/Classifai/Providers/OpenAI/DallE.php:210 msgid "" "Once an image is generated, you can import it into your Media Library and " "then select to insert." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:215 +#: includes/Classifai/Providers/OpenAI/DallE.php:214 msgid "Enter prompt" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:231 +#: includes/Classifai/Providers/OpenAI/DallE.php:230 msgid "Images generated from prompt:" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:233 +#: includes/Classifai/Providers/OpenAI/DallE.php:232 msgid "Image generated from prompt:" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:253 +#: includes/Classifai/Providers/OpenAI/DallE.php:252 msgid "Import into Media Library" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:254 +#: includes/Classifai/Providers/OpenAI/DallE.php:253 msgid "Import and Insert" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:276 +#: includes/Classifai/Providers/OpenAI/DallE.php:275 msgid "Enable image generation" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:284 +#: includes/Classifai/Providers/OpenAI/DallE.php:283 msgid "" "When enabled, a new Generate images tab will be shown in the media upload " "flow, allowing you to generate and import images." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:293 -#: includes/Classifai/Providers/OpenAI/DallE.php:405 +#: includes/Classifai/Providers/OpenAI/DallE.php:292 +#: includes/Classifai/Providers/OpenAI/DallE.php:404 msgid "Number of images" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:301 +#: includes/Classifai/Providers/OpenAI/DallE.php:300 msgid "" "Number of images that will be generated in one request. Note that each " "image will incur separate costs." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:307 -#: includes/Classifai/Providers/OpenAI/DallE.php:406 +#: includes/Classifai/Providers/OpenAI/DallE.php:306 +#: includes/Classifai/Providers/OpenAI/DallE.php:405 msgid "Image size" msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:319 +#: includes/Classifai/Providers/OpenAI/DallE.php:318 msgid "Size of generated images." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:420 +#: includes/Classifai/Providers/OpenAI/DallE.php:419 msgid "A prompt is required to generate an image." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:438 +#: includes/Classifai/Providers/OpenAI/DallE.php:437 msgid "Sorry, you are not allowed to do that." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:442 +#: includes/Classifai/Providers/OpenAI/DallE.php:441 msgid "" "Image generation is disabled or OpenAI authentication failed. Please check " "your settings." msgstr "" -#: includes/Classifai/Providers/OpenAI/DallE.php:459 +#: includes/Classifai/Providers/OpenAI/DallE.php:458 msgid "" "Your image prompt is too long. Please ensure it doesn't exceed 1000 " "characters." @@ -1282,7 +1282,7 @@ msgstr "" #: includes/Classifai/Providers/OpenAI/Embeddings.php:158 #: includes/Classifai/Providers/Watson/NLU.php:51 #: includes/Classifai/Providers/Watson/NLU.php:90 -#: includes/Classifai/Providers/Watson/NLU.php:433 +#: includes/Classifai/Providers/Watson/NLU.php:432 msgid "Classify content" msgstr "" @@ -1292,7 +1292,7 @@ msgstr "" #: includes/Classifai/Providers/OpenAI/Embeddings.php:175 #: includes/Classifai/Providers/OpenAI/Embeddings.php:362 -#: includes/Classifai/Providers/Watson/NLU.php:918 +#: includes/Classifai/Providers/Watson/NLU.php:917 msgid "Post types" msgstr "" @@ -1361,12 +1361,12 @@ msgid "No data returned from OpenAI." msgstr "" #: includes/Classifai/Providers/OpenAI/Embeddings.php:917 -#: includes/Classifai/Providers/Watson/NLU.php:970 +#: includes/Classifai/Providers/Watson/NLU.php:969 msgid "ClassifAI Language Processing" msgstr "" #: includes/Classifai/Providers/OpenAI/Embeddings.php:947 -#: includes/Classifai/Providers/Watson/NLU.php:1001 +#: includes/Classifai/Providers/Watson/NLU.php:1000 msgid "Automatically tag content on update" msgstr "" @@ -1396,21 +1396,21 @@ msgstr "" msgid "The transcription result is invalid." msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:33 -#: includes/Classifai/Providers/OpenAI/Whisper.php:335 +#: includes/Classifai/Providers/OpenAI/Whisper.php:32 +#: includes/Classifai/Providers/OpenAI/Whisper.php:334 msgid "Generate transcripts" msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:38 +#: includes/Classifai/Providers/OpenAI/Whisper.php:37 msgid "OpenAI Whisper" msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:41 -#: includes/Classifai/Providers/OpenAI/Whisper.php:253 +#: includes/Classifai/Providers/OpenAI/Whisper.php:40 +#: includes/Classifai/Providers/OpenAI/Whisper.php:252 msgid "Generate transcripts from audio files" msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:70 +#: includes/Classifai/Providers/OpenAI/Whisper.php:69 #: includes/Classifai/Services/ImageProcessing.php:360 #: includes/Classifai/Services/LanguageProcessing.php:403 #: includes/Classifai/Services/LanguageProcessing.php:527 @@ -1419,28 +1419,28 @@ msgstr "" msgid "Please set up valid authentication with OpenAI." msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:74 +#: includes/Classifai/Providers/OpenAI/Whisper.php:73 msgid "User role does not have permission." msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:78 +#: includes/Classifai/Providers/OpenAI/Whisper.php:77 msgid "User does not have permission to edit this attachment." msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:83 +#: includes/Classifai/Providers/OpenAI/Whisper.php:82 msgid "Transcripts are not enabled." msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:149 -#: includes/Classifai/Providers/OpenAI/Whisper.php:199 +#: includes/Classifai/Providers/OpenAI/Whisper.php:148 +#: includes/Classifai/Providers/OpenAI/Whisper.php:198 msgid "Re-transcribe" msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:184 +#: includes/Classifai/Providers/OpenAI/Whisper.php:183 msgid "ClassifAI Audio Processing" msgstr "" -#: includes/Classifai/Providers/OpenAI/Whisper.php:261 +#: includes/Classifai/Providers/OpenAI/Whisper.php:260 msgid "Automatically generate transcripts for supported audio files." msgstr "" @@ -1495,7 +1495,7 @@ msgid "Image description" msgstr "" #: includes/Classifai/Providers/Provider.php:654 -#: includes/Classifai/Providers/Watson/NLU.php:933 +#: includes/Classifai/Providers/Watson/NLU.php:932 msgid "N/A" msgstr "" @@ -1573,70 +1573,70 @@ msgid "" "watsonplatform.net\" href=\"%s\">here for details." msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:368 +#: includes/Classifai/Providers/Watson/NLU.php:367 msgid "API Username" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:441 +#: includes/Classifai/Providers/Watson/NLU.php:440 msgid "Enables the automatic content classification of posts." msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:449 +#: includes/Classifai/Providers/Watson/NLU.php:448 msgid "Classification mode" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:461 +#: includes/Classifai/Providers/Watson/NLU.php:460 msgid "Classification method" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:469 +#: includes/Classifai/Providers/Watson/NLU.php:468 msgid "Recommend terms even if they do not exist on the site" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:470 +#: includes/Classifai/Providers/Watson/NLU.php:469 msgid "Only recommend terms that already exist on the site" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:477 +#: includes/Classifai/Providers/Watson/NLU.php:476 msgid "Post Types to Classify" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:488 +#: includes/Classifai/Providers/Watson/NLU.php:487 msgid "Post Statuses to Classify" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:687 +#: includes/Classifai/Providers/Watson/NLU.php:686 msgid "Watson Category Settings" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:692 +#: includes/Classifai/Providers/Watson/NLU.php:691 msgid "Enable" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:746 +#: includes/Classifai/Providers/Watson/NLU.php:745 msgid "Please enter your credentials." msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:878 +#: includes/Classifai/Providers/Watson/NLU.php:877 msgid "" "OpenAI Embeddings classification is turned on. This may conflict with the " "NLU classification feature. It is possible to run both features but if they " "use the same taxonomies, one will overwrite the other." msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:915 +#: includes/Classifai/Providers/Watson/NLU.php:914 msgid "Configured" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:917 +#: includes/Classifai/Providers/Watson/NLU.php:916 msgid "API username" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:919 +#: includes/Classifai/Providers/Watson/NLU.php:918 msgid "Features" msgstr "" -#: includes/Classifai/Providers/Watson/NLU.php:1008 +#: includes/Classifai/Providers/Watson/NLU.php:1007 #. translators: %s Post type label msgid "Classify %s" msgstr "" diff --git a/readme.txt b/readme.txt index bc526237c..d0749a4b6 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: AI, Artificial Intelligence, ML, Machine Learning, Microsoft Requires at least: 6.1 Tested up to: 6.4 Requires PHP: 7.4 -Stable tag: 2.5.0 +Stable tag: 2.5.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/vendor/autoload.php b/vendor/autoload.php index 2c3b6ec58..c879775e6 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderIniteac83010094406077b2bc944e936a9c2::getLoader(); +return ComposerAutoloaderInit7a9a2237236b5a380f663428adcb1357::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 7776bcc04..35c7a9623 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderIniteac83010094406077b2bc944e936a9c2 +class ComposerAutoloaderInit7a9a2237236b5a380f663428adcb1357 { private static $loader; @@ -24,16 +24,16 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderIniteac83010094406077b2bc944e936a9c2', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit7a9a2237236b5a380f663428adcb1357', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderIniteac83010094406077b2bc944e936a9c2', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit7a9a2237236b5a380f663428adcb1357', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticIniteac83010094406077b2bc944e936a9c2::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit7a9a2237236b5a380f663428adcb1357::getInitializer($loader)); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticIniteac83010094406077b2bc944e936a9c2::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit7a9a2237236b5a380f663428adcb1357::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index dcbbfa691..460d23bd4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticIniteac83010094406077b2bc944e936a9c2 +class ComposerStaticInit7a9a2237236b5a380f663428adcb1357 { public static $files = array ( '9b77ddcfb14408a32f5aaf74e0a11694' => __DIR__ . '/..' . '/yahnis-elsts/plugin-update-checker/load-v5p1.php', @@ -46,9 +46,9 @@ class ComposerStaticIniteac83010094406077b2bc944e936a9c2 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticIniteac83010094406077b2bc944e936a9c2::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticIniteac83010094406077b2bc944e936a9c2::$prefixDirsPsr4; - $loader->classMap = ComposerStaticIniteac83010094406077b2bc944e936a9c2::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit7a9a2237236b5a380f663428adcb1357::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7a9a2237236b5a380f663428adcb1357::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit7a9a2237236b5a380f663428adcb1357::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 78e3b1d0f..885dc9193 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '10up/classifai', 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => 'b2f148a433ff04170486a2630a15393f79d4717f', + 'reference' => '0f6b46e0426602a2baeab42cffb31be74c59d8a6', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '10up/classifai' => array( 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => 'b2f148a433ff04170486a2630a15393f79d4717f', + 'reference' => '0f6b46e0426602a2baeab42cffb31be74c59d8a6', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),