Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions class-gwiz-gf-openai.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
protected $_path = 'gravityforms-openai/gravityforms-openai.php';
protected $_full_path = __FILE__;
protected $_slug = 'gravityforms-openai';
protected $_title = 'Gravity Forms OpenAI';
protected $_short_title = 'OpenAI (Free)';
protected $_title = 'Gravity Forms OpenAI (deprecated).';
protected $_short_title = 'OpenAI (Deprecated)';

/**
* Defines the capabilities needed for the Add-On.
Expand Down Expand Up @@ -253,6 +253,55 @@
add_filter( 'gform_validation_message', array( $this, 'modify_validation_message' ), 15, 2 );
add_filter( 'gform_entry_is_spam', array( $this, 'moderations_endpoint_spam' ), 10, 3 );
add_filter( 'gform_pre_replace_merge_tags', array( $this, 'replace_merge_tags' ), 10, 7 );

add_action( 'admin_notices', array( $this, 'maybe_display_deprecation_notice' ) );
add_action( 'wp_ajax_gwiz_gf_openai_dismiss_deprecation_notice', array( $this, 'dismiss_deprecation_notice' ) );
}

/**
* Displays a one-time deprecation notice in wp-admin.
*/
public function maybe_display_deprecation_notice() {
if ( ! current_user_can( 'activate_plugins' ) || $this->is_deprecation_notice_dismissed() ) {
return;
}
?>
<div class="notice notice-warning is-dismissible gwiz-gf-openai-deprecation-notice">
<p>The <strong>Gravity Forms OpenAI</strong> plugin has been deprecated and is no longer actively maintained. The plugin will continue to function as-is, but it will <strong>not receive future updates, improvements, or bug fixes.</strong></p>
<p>For continued development, enhanced features, and ongoing support, we recommend upgrading to <a href="https://gravitywiz.com/documentation/gravity-connect-openai/">Gravity Connect OpenAI</a>, our premium solution built specifically for long-term reliability and expansion.</p>
</div>
<script>
jQuery( document ).on( 'click', '.gwiz-gf-openai-deprecation-notice .notice-dismiss', function() {
jQuery.post( ajaxurl, {
action: 'gwiz_gf_openai_dismiss_deprecation_notice',
nonce: '<?php echo esc_js( wp_create_nonce( 'gwiz_gf_openai_dismiss_deprecation_notice' ) ); ?>'
} );
} );
</script>
<?php
}

/**
* Persist dismissal of the deprecation notice for the current user.
*/
public function dismiss_deprecation_notice() {
check_ajax_referer( 'gwiz_gf_openai_dismiss_deprecation_notice', 'nonce' );

if ( ! current_user_can( 'activate_plugins' ) ) {
wp_send_json_error();
}

update_user_meta( get_current_user_id(), 'gwiz_gf_openai_deprecation_notice_dismissed', 1 );
wp_send_json_success();
}

/**
* Checks whether the deprecation notice has been dismissed by the current user.
*
* @return bool
*/
public function is_deprecation_notice_dismissed() {
return (bool) get_user_meta( get_current_user_id(), 'gwiz_gf_openai_deprecation_notice_dismissed', true );
}

/**
Expand All @@ -270,7 +319,7 @@
'gpt-5-nano' => array(
'description' => __( 'OpenAI\'s fastest, cheapest version of GPT-5. It\'s great for summarization and classification tasks. It\'s great for well-defined tasks and precise prompts. Context length: 128k. <a href="https://platform.openai.com/docs/models/gpt-5-mini" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
'gpt-4o' => array(

Check warning on line 322 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Array double arrow not aligned correctly; expected 8 space(s) between "'gpt-4o'" and double arrow, but found 13.
'description' => __( 'OpenAI\'s fastest and most affordable flagship model. Context length: 128k. <a href="https://platform.openai.com/docs/models/gpt-4o" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
'gpt-4-turbo' => array(
Expand Down Expand Up @@ -1423,7 +1472,7 @@

$body = apply_filters( 'gf_openai_request_body', $body, $endpoint, $feed );

$this->log_debug( __METHOD__ . '(): ' . sprintf( __( 'Making request to %s', 'gravityforms-openai' ), $url ) );

Check warning on line 1475 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.

// Cache successful responses.
$response = wp_remote_post($url, array_merge( array(
Expand Down Expand Up @@ -1584,7 +1633,7 @@
public function should_transform_feed( $feed ) {
$endpoint = rgars( $feed, 'meta/endpoint' );

if ( in_array( $endpoint, array( 'completions', 'edits' ) ) ) {

Check warning on line 1636 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Not using strict comparison for in_array; supply true for third argument.
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion gravityforms-openai.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin Name: Gravity Forms OpenAI (Free)
* Plugin Name: Gravity Forms OpenAI (deprecated).
* Description: Pair the magic of OpenAI's robust models with Gravity Forms' flexibility.
* Plugin URI: https://gravitywiz.com/gravity-forms-openai/
* Version: 1.0-beta-1.15
Expand Down