| @@ -28,13 +28,19 @@ | ||
| 28 | 28 | |
| 29 | 29 | $key = sanitize_text_field(wp_unslash($_POST['key'] ?? '')); |
| 30 | 30 | $value = sanitize_text_field(wp_unslash($_POST['value'] ?? '')); |
| 31 | 31 | $apiKeys = get_option('bBlocksApiKeys',[]); |
| 32 | - $error = $this->bBlocksTestApiKeys($key,$value); | |
| 33 | - | |
| 34 | - if (isset($error['valid']) && !$error['valid']) { | |
| 35 | - wp_send_json_error([$key=>$error]); | |
| 32 | + | |
| 33 | + if ( '' !== $value ) { | |
| 34 | + $error = $this->bBlocksTestApiKeys($key,$value); | |
| 35 | + | |
| 36 | + if (isset($error['valid']) && !$error['valid']) { | |
| 37 | + wp_send_json_error([$key=>$error]); | |
| 38 | + } | |
| 39 | + } elseif ( 'instagram' === $key && class_exists( __NAMESPACE__ . '\BBlocksInstagram' ) ) { | |
| 40 | + BBlocksInstagram::flush(); | |
| 36 | 41 | } |
| 42 | + | |
| 37 | 43 | if ($key) { |
| 38 | 44 | $apiKeys[$key] = ['key'=> $value]; |
| 39 | 45 | update_option( 'bBlocksApiKeys',$apiKeys); |
| 40 | 46 | } |