diff --git a/includes/Classifai/Features/ContentResizing.php b/includes/Classifai/Features/ContentResizing.php index 431005e89..6b1138991 100644 --- a/includes/Classifai/Features/ContentResizing.php +++ b/includes/Classifai/Features/ContentResizing.php @@ -273,6 +273,37 @@ public function get_feature_default_settings(): array { ]; } + /** + * Returns the settings for the feature. + * + * @param string $index The index of the setting to return. + * @return array|mixed + */ + public function get_settings( $index = false ) { + $settings = parent::get_settings( $index ); + + // Keep using the original prompt from the codebase to allow updates. + if ( $settings && !empty( $settings['condense_text_prompt'] ) ) { + foreach ( $settings['condense_text_prompt'] as $key => $prompt ) { + if( 1 === intval( $prompt['original'] ) ) { + $settings['condense_text_prompt'][ $key ]['prompt'] = $this->condense_prompt; + break; + } + } + } + + if ( $settings && !empty( $settings['expand_text_prompt'] ) ) { + foreach ( $settings['expand_text_prompt'] as $key => $prompt ) { + if( 1 === intval( $prompt['original'] ) ) { + $settings['expand_text_prompt'][ $key ]['prompt'] = $this->expand_prompt; + break; + } + } + } + + return $settings; + } + /** * Sanitizes the default feature settings. * diff --git a/includes/Classifai/Features/DescriptiveTextGenerator.php b/includes/Classifai/Features/DescriptiveTextGenerator.php index 180410194..f740819e2 100644 --- a/includes/Classifai/Features/DescriptiveTextGenerator.php +++ b/includes/Classifai/Features/DescriptiveTextGenerator.php @@ -390,6 +390,28 @@ public function get_feature_default_settings(): array { ]; } + /** + * Returns the settings for the feature. + * + * @param string $index The index of the setting to return. + * @return array|mixed + */ + public function get_settings( $index = false ) { + $settings = parent::get_settings( $index ); + + // Keep using the original prompt from the codebase to allow updates. + if ( $settings && ! empty( $settings[ ChatGPT::ID ]['prompt'] ) ) { + foreach ( $settings[ ChatGPT::ID ]['prompt'] as $key => $prompt ) { + if( 1 === intval( $prompt['original'] ) ) { + $settings[ ChatGPT::ID ]['prompt'][ $key ]['prompt'] = $this->prompt; + break; + } + } + } + + return $settings; + } + /** * Sanitizes the default feature settings. * diff --git a/includes/Classifai/Features/ExcerptGeneration.php b/includes/Classifai/Features/ExcerptGeneration.php index 15ec70e6e..7c19a7003 100644 --- a/includes/Classifai/Features/ExcerptGeneration.php +++ b/includes/Classifai/Features/ExcerptGeneration.php @@ -344,6 +344,28 @@ public function get_feature_default_settings(): array { ]; } + /** + * Returns the settings for the feature. + * + * @param string $index The index of the setting to return. + * @return array|mixed + */ + public function get_settings( $index = false ) { + $settings = parent::get_settings( $index ); + + // Keep using the original prompt from the codebase to allow updates. + if ( $settings && !empty( $settings['generate_excerpt_prompt'] ) ) { + foreach ( $settings['generate_excerpt_prompt'] as $key => $prompt ) { + if( 1 === intval( $prompt['original'] ) ) { + $settings['generate_excerpt_prompt'][ $key ]['prompt'] = $this->prompt; + break; + } + } + } + + return $settings; + } + /** * Sanitizes the default feature settings. * diff --git a/includes/Classifai/Features/TitleGeneration.php b/includes/Classifai/Features/TitleGeneration.php index a86d74388..60c83d38c 100644 --- a/includes/Classifai/Features/TitleGeneration.php +++ b/includes/Classifai/Features/TitleGeneration.php @@ -344,6 +344,28 @@ public function get_feature_default_settings(): array { ]; } + /** + * Returns the settings for the feature. + * + * @param string $index The index of the setting to return. + * @return array|mixed + */ + public function get_settings( $index = false ) { + $settings = parent::get_settings( $index ); + + // Keep using the original prompt from the codebase to allow updates. + if ( $settings && ! empty( $settings['generate_title_prompt'] ) ) { + foreach ( $settings['generate_title_prompt'] as $key => $prompt ) { + if( 1 === intval( $prompt['original'] ) ) { + $settings['generate_title_prompt'][ $key ]['prompt'] = $this->prompt; + break; + } + } + } + + return $settings; + } + /** * Sanitizes the default feature settings. *