plugin updates
This commit is contained in:
@@ -63,7 +63,7 @@ class PatternsHelper {
|
||||
/**
|
||||
* Upsert the patterns AI data.
|
||||
*
|
||||
* @param array $patterns_dictionary The patterns dictionary.
|
||||
* @param array $patterns_dictionary The patterns' dictionary.
|
||||
*
|
||||
* @return WP_Error|null
|
||||
*/
|
||||
@@ -92,18 +92,12 @@ class PatternsHelper {
|
||||
* @return array|WP_Error Returns pattern dictionary or WP_Error on failure.
|
||||
*/
|
||||
public static function get_patterns_dictionary( $pattern_slug = null ) {
|
||||
$patterns_dictionary_file = plugin_dir_path( __FILE__ ) . 'dictionary.json';
|
||||
$default_patterns_dictionary = PatternsDictionary::get();
|
||||
|
||||
if ( ! file_exists( $patterns_dictionary_file ) ) {
|
||||
if ( empty( $default_patterns_dictionary ) ) {
|
||||
return new WP_Error( 'missing_patterns_dictionary', __( 'The patterns dictionary is missing.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$default_patterns_dictionary = wp_json_file_decode( $patterns_dictionary_file, array( 'associative' => true ) );
|
||||
|
||||
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
||||
return new WP_Error( 'json_decode_error', __( 'Error decoding JSON.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$patterns_dictionary = '';
|
||||
$ai_connection_allowed = get_option( 'woocommerce_blocks_allow_ai_connection' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user