Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Dec 13, 2023
2 parents bfb3822 + fbd9925 commit b2f148a
Show file tree
Hide file tree
Showing 77 changed files with 12,346 additions and 5,269 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
core:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#5.8'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.1'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"core": "WordPress/WordPress#6.1",
"plugins": [".", "./tests/test-plugin", "https://downloads.wordpress.org/plugin/classic-editor.zip"],
"env": {
"tests": {
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.5.0] - 2023-12-13
**Note that this release bumps the WordPress minimum from 5.8 to 6.1.**

### Added
- Ability to control access to each feature based on user role or by individual users, allowing users to opt out of features they don't want (props [@iamdharmesh](https://github.com/iamdharmesh), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#606](https://github.com/10up/classifai/pull/606)).
- New manual classification mode that allows you to easily select which AI suggested terms you want to add (props [@faisal-alvi](https://github.com/faisal-alvi), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#609](https://github.com/10up/classifai/pull/609)).
- Enable/disable toggle option for the "Classify content", "Text to Speech" and "Recommended content" features (props [@iamdharmesh](https://github.com/iamdharmesh), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#614](https://github.com/10up/classifai/pull/614)).
- New setting option for the IBM Watson classification feature to allow you to classify content within existing terms only (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#620](https://github.com/10up/classifai/pull/620)).
- Threshold settings added for taxonomies in the OpenAI Embeddings classification feature (props [@faisal-alvi](https://github.com/faisal-alvi), [@timatron](https://github.com/timatron), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#621](https://github.com/10up/classifai/pull/621)).
- Ability to preview the suggested terms for the OpenAI Embeddings classification feature (props [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#622](https://github.com/10up/classifai/pull/622)).
- Post autosave when a generated title is used or when a paragraph of text is resized to allow for Revisions-based rollbacks (props [@iamdharmesh](https://github.com/iamdharmesh), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#626](https://github.com/10up/classifai/pull/626)).

### Changed
- Bump WordPress minimum from 5.8 to 6.1 (props [@faisal-alvi](https://github.com/faisal-alvi), [@berkod](https://github.com/berkod), [@dkotter](https://github.com/dkotter) via [#609](https://github.com/10up/classifai/pull/609)).
- Increase our max content length for any interactions with ChatGPT (props [@dkotter](https://github.com/dkotter), [@ravinderk](https://github.com/ravinderk) via [#617](https://github.com/10up/classifai/pull/617)).

### Fixed
- Ensure that when using the manual classification mode, all terms will be considered, not just the first 100 (props [@faisal-alvi](https://github.com/faisal-alvi), [@dkotter](https://github.com/dkotter) via [#638](https://github.com/10up/classifai/pull/638)).
- Ensure that the ClassifAI panel only appears when the related feature is enabled (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter) via [#628](https://github.com/10up/classifai/pull/628)).
- More accurate token counts when trimming content (props [@dkotter](https://github.com/dkotter), [@faisal-alvi](https://github.com/faisal-alvi) via [#616](https://github.com/10up/classifai/pull/616)).
- Ensure that updating the "Recommended Content Block" settings works correctly (props [@iamdharmesh](https://github.com/iamdharmesh), [@faisal-alvi](https://github.com/faisal-alvi), [@dkotter](https://github.com/dkotter) via [#625](https://github.com/10up/classifai/pull/625)).

### Security
- Bump `axios` from 0.25.0 to 1.6.2 and `@wordpress/scripts` from 26.6.0 to 26.18.0 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@dkotter](https://github.com/dkotter) via [#629](https://github.com/10up/classifai/pull/629)).

## [2.4.0] - 2023-11-09
### Added
- Support for modifying prompts from the admin settings page (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@ravinderk](https://github.com/ravinderk), [@dkotter](https://github.com/dkotter) via [#594](https://github.com/10up/classifai/pull/594)).
Expand Down Expand Up @@ -451,6 +476,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Initial closed source release

[Unreleased]: https://github.com/10up/classifai/compare/trunk...develop
[2.5.0]: https://github.com/10up/classifai/compare/2.4.0...2.5.0
[2.4.0]: https://github.com/10up/classifai/compare/2.3.0...2.4.0
[2.3.0]: https://github.com/10up/classifai/compare/2.2.3...2.3.0
[2.2.3]: https://github.com/10up/classifai/compare/2.2.2...2.2.3
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Darshan Sawardekar (@dsawardekar)](https://github.com/dsawardekar), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Christian Chung (@christianc1)](https://github.com/christianc1), [Dependabot (@dependabot)](https://github.com/dependabot), [Dillon McCallum (@McCallumDillon)](https://github.com/McCallumDillon), [Dustin Rue (@dustinrue)](https://github.com/dustinrue), [Jay Wood (@JayWood)](https://github.com/JayWood), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darío Hereñú (@kant)](https://github.com/kant), [Aaron Jorbin (@aaronjorbin)](https://github.com/aaronjorbin), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Dana Ross (@dana-ross)](https://github.com/dana-ross), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Pete Nelson (@petenelson)](https://github.com/petenelson), [Connor Smyth (@ActuallyConnor)](https://github.com/ActuallyConnor), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Jeffrey Carandang (@phpbits)](https://github.com/phpbits), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Junaid Bhura (@junaidbhura)](https://github.com/junaidbhura), [Blanca Hong [@blancahong]](https://profiles.wordpress.org/blancahong/), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [@myBCN](https://github.com/myBCN), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Rahul Prajapati (@rahulsprajapati)](https://github.com/rahulsprajapati), [Sérgio Santos (@s3rgiosan)](https://github.com/s3rgiosan), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Delfina Hoxha](https://www.linkedin.com/in/delfina-hoxha/), [Ajay Maurya (@ajmaurya99)](https://github.com/ajmaurya99), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Mustafa Uysal (@mustafauysal)](https://github.com/mustafauysal), [Max Lyuchin (@cadic)](https://github.com/cadic), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Quamruz Zaman (@zamanq)](https://github.com/zamanq), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Joe McGill (@joemcgill)](https://github.com/joemcgill), [Tyler Bailey (@TylerB24890)](https://github.com/TylerB24890), [Viktor Szépe (@szepeviktor)](https://github.com/szepeviktor), [Ivan Ivanić (@Spoygg)](https://github.com/Spoygg), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Garth Gutenberg (@ggutenberg)](https://github.com/ggutenberg), [Mehidi Hassan (@mehidi258)](https://github.com/mehidi258), [Julian Weiland (@derweili)](https://github.com/derweili), [Anton Vanyukov (@av3nger)](https://github.com/av3nger), [Ben Keith (@benlk)](https://github.com/benlk), [David Hechler (@pixeldevsio)](https://github.com/pixeldevsio), [Joshua Abenazer (@joshuaabenazer)](https://github.com/joshuaabenazer), [Dominik Schilling (@ocean90)](https://github.com/ocean90), [Björn Holine (@bjorn2404)](https://github.com/bjorn2404), [Konstantinos Galanakis (@kmgalanakis)](https://github.com/kmgalanakis), [Dan Berko (@berkod)](https://github.com/berkod), [Luca Ricci (@theskinnyghost)](https://github.com/theskinnyghost), [Parikshit Adhikari (@parikshit-adhikari)](https://github.com/parikshit-adhikari), [Surav Shrestha (@shresthasurav)](https://github.com/shresthasurav).
[Darshan Sawardekar (@dsawardekar)](https://github.com/dsawardekar), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Christian Chung (@christianc1)](https://github.com/christianc1), [Dependabot (@dependabot)](https://github.com/dependabot), [Dillon McCallum (@McCallumDillon)](https://github.com/McCallumDillon), [Dustin Rue (@dustinrue)](https://github.com/dustinrue), [Jay Wood (@JayWood)](https://github.com/JayWood), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darío Hereñú (@kant)](https://github.com/kant), [Aaron Jorbin (@aaronjorbin)](https://github.com/aaronjorbin), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Dana Ross (@dana-ross)](https://github.com/dana-ross), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Pete Nelson (@petenelson)](https://github.com/petenelson), [Connor Smyth (@ActuallyConnor)](https://github.com/ActuallyConnor), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Jeffrey Carandang (@phpbits)](https://github.com/phpbits), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Junaid Bhura (@junaidbhura)](https://github.com/junaidbhura), [Blanca Hong [@blancahong]](https://profiles.wordpress.org/blancahong/), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [@myBCN](https://github.com/myBCN), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Rahul Prajapati (@rahulsprajapati)](https://github.com/rahulsprajapati), [Sérgio Santos (@s3rgiosan)](https://github.com/s3rgiosan), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Delfina Hoxha](https://www.linkedin.com/in/delfina-hoxha/), [Ajay Maurya (@ajmaurya99)](https://github.com/ajmaurya99), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Mustafa Uysal (@mustafauysal)](https://github.com/mustafauysal), [Max Lyuchin (@cadic)](https://github.com/cadic), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Quamruz Zaman (@zamanq)](https://github.com/zamanq), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Joe McGill (@joemcgill)](https://github.com/joemcgill), [Tyler Bailey (@TylerB24890)](https://github.com/TylerB24890), [Viktor Szépe (@szepeviktor)](https://github.com/szepeviktor), [Ivan Ivanić (@Spoygg)](https://github.com/Spoygg), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Garth Gutenberg (@ggutenberg)](https://github.com/ggutenberg), [Mehidi Hassan (@mehidi258)](https://github.com/mehidi258), [Julian Weiland (@derweili)](https://github.com/derweili), [Anton Vanyukov (@av3nger)](https://github.com/av3nger), [Ben Keith (@benlk)](https://github.com/benlk), [David Hechler (@pixeldevsio)](https://github.com/pixeldevsio), [Joshua Abenazer (@joshuaabenazer)](https://github.com/joshuaabenazer), [Dominik Schilling (@ocean90)](https://github.com/ocean90), [Björn Holine (@bjorn2404)](https://github.com/bjorn2404), [Konstantinos Galanakis (@kmgalanakis)](https://github.com/kmgalanakis), [Dan Berko (@berkod)](https://github.com/berkod), [Luca Ricci (@theskinnyghost)](https://github.com/theskinnyghost), [Parikshit Adhikari (@parikshit-adhikari)](https://github.com/parikshit-adhikari), [Surav Shrestha (@shresthasurav)](https://github.com/shresthasurav), [Tim Schwartz (@timatron)](https://github.com/timatron).

## Libraries

Expand Down
4 changes: 2 additions & 2 deletions classifai.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* 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.4.0
* Requires at least: 5.8
* Version: 2.5.0
* Requires at least: 6.1
* Requires PHP: 7.4
* Author: 10up
* Author URI: https://10up.com
Expand Down
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* declared here instead of a Class.
*/

$plugin_version = '2.4.0';
$plugin_version = '2.5.0';

if ( file_exists( __DIR__ . '/.commit' ) ) {
$plugin_version .= '-' . file_get_contents( __DIR__ . '/.commit' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
Expand Down
49 changes: 24 additions & 25 deletions includes/Classifai/Admin/BulkActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ public function register() {
* Register bulk actions for language processing.
*/
public function register_language_processing_hooks() {
$this->chat_gpt = new ChatGPT( false );
$this->embeddings = new Embeddings( false );
$this->chat_gpt = new ChatGPT( false );
$this->embeddings = new Embeddings( false );
$this->text_to_speech = new TextToSpeech( false );

$user_roles = wp_get_current_user()->roles ?? [];
$embedding_settings = $this->embeddings->get_settings();
$embeddings_post_types = [];
$nlu_post_types = get_supported_post_types();
$text_to_speech_post_types = get_tts_supported_post_types();
$chat_gpt_post_types = [];
$chat_gpt_settings = $this->chat_gpt->get_settings();

// Set up the save post handler if we have any post types.
if ( ! empty( $nlu_post_types ) || ! empty( $text_to_speech_post_types ) ) {
Expand All @@ -87,23 +85,26 @@ public function register_language_processing_hooks() {

// Set up the ChatGPT post types if the feature is enabled. Otherwise clear our handler.
if (
isset( $chat_gpt_settings['enable_excerpt'] ) &&
1 === (int) $chat_gpt_settings['enable_excerpt'] &&
! empty( $chat_gpt_settings['roles'] ) &&
empty( array_diff( $user_roles, $chat_gpt_settings['roles'] ) )
$this->chat_gpt &&
$this->chat_gpt->is_feature_enabled( 'excerpt_generation' )
) {
$chat_gpt_post_types = array_keys( get_post_types_for_language_settings() );
} else {
$this->chat_gpt = null;
}

// Set up the embeddings post types if the feature is enabled. Otherwise clear our embeddings handler.
if ( isset( $embedding_settings['enable_classification'] ) && 1 === (int) $embedding_settings['enable_classification'] ) {
if ( $this->embeddings && $this->embeddings->is_feature_enabled( 'classification' ) ) {
$embeddings_post_types = $this->embeddings->supported_post_types();
} else {
$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 ) );

Expand Down Expand Up @@ -161,7 +162,8 @@ public function register_bulk_actions( $bulk_actions ) {

if (
is_a( $this->text_to_speech, '\Classifai\Providers\Azure\TextToSpeech' ) &&
in_array( get_current_screen()->post_type, $this->text_to_speech->get_supported_post_types(), true )
in_array( get_current_screen()->post_type, get_tts_supported_post_types(), true ) &&
$this->text_to_speech->is_feature_enabled( 'text_to_speech' )
) {
$bulk_actions['text_to_speech'] = __( 'Text to speech', 'classifai' );
}
Expand All @@ -177,17 +179,16 @@ public function register_bulk_actions( $bulk_actions ) {
* @return array
*/
public function register_media_bulk_actions( $bulk_actions ) {
$computer_vision_settings = $this->computer_vision->get_settings();
$whisper_enabled = $this->whisper->is_feature_enabled();
$whisper_enabled = $this->whisper->is_feature_enabled( 'speech_to_text' );

if (
'no' !== $computer_vision_settings['enable_image_tagging'] ||
! empty( $this->computer_vision->get_alt_text_settings() )
$this->computer_vision->is_feature_enabled( 'image_tagging' ) ||
$this->computer_vision->is_feature_enabled( 'image_captions' )
) {
$bulk_actions['scan_image'] = __( 'Scan image', 'classifai' );
}

if ( isset( $computer_vision_settings['enable_smart_cropping'] ) && '1' === $computer_vision_settings['enable_smart_cropping'] ) {
if ( $this->computer_vision && $this->computer_vision->is_feature_enabled( 'smart_cropping' ) ) {
$bulk_actions['smart_crop'] = __( 'Smart crop', 'classifai' );
}

Expand Down Expand Up @@ -415,14 +416,12 @@ public function register_row_action( $actions, $post ) {
}
}

if ( is_a( $this->text_to_speech, '\Classifai\Providers\Azure\TextToSpeech' ) ) {
if ( in_array( $post->post_type, $this->text_to_speech->get_supported_post_types(), true ) ) {
$actions['text_to_speech'] = sprintf(
'<a href="%s">%s</a>',
esc_url( wp_nonce_url( admin_url( sprintf( 'edit.php?action=text_to_speech&ids=%d&post_type=%s', $post->ID, $post->post_type ) ), 'bulk-posts' ) ),
esc_html__( 'Text to speech', 'classifai' )
);
}
if ( is_a( $this->text_to_speech, '\Classifai\Providers\Azure\TextToSpeech' ) && $this->text_to_speech->is_feature_enabled( 'text_to_speech' ) && in_array( $post->post_type, get_tts_supported_post_types(), true ) ) {
$actions['text_to_speech'] = sprintf(
'<a href="%s">%s</a>',
esc_url( wp_nonce_url( admin_url( sprintf( 'edit.php?action=text_to_speech&ids=%d&post_type=%s', $post->ID, $post->post_type ) ), 'bulk-posts' ) ),
esc_html__( 'Text to speech', 'classifai' )
);
}

return $actions;
Expand All @@ -437,7 +436,7 @@ public function register_row_action( $actions, $post ) {
*/
public function register_media_row_action( $actions, $post ) {
$whisper_settings = $this->whisper->get_settings();
$whisper_enabled = $this->whisper->is_feature_enabled( $post->ID );
$whisper_enabled = $this->whisper->is_feature_enabled( 'speech_to_text', $post->ID );

if ( is_wp_error( $whisper_enabled ) ) {
return $actions;
Expand Down
Loading

0 comments on commit b2f148a

Please sign in to comment.