cloggier
↑
/wp-content/plugins/wpforms-sendinblue/src/Provider
marsupiataab
hypermuffing
cloggier
hypermuffing
marsupiataab
FormBuilder.php
21,507 B
cloggier
marsupiataab
PageIntegrations.php
1,938 B
cloggier
marsupiataab
<?php namespace WPFormsSendinblue\Provider\Settings; use Exception; use WPFormsSendinblue\Plugin; use WPFormsSendinblue\Api\Exceptions\RequiredArgumentMissingException; use WPForms\Providers\Provider\Settings\PageIntegrations as PageIntegrationsAbstract; /** * Class PageIntegrations handles functionality inside the Settings > Integrations page. * * @since 1.0.0 */ class PageIntegrations extends PageIntegrationsAbstract { /** * AJAX to add a provider from the settings integrations tab. * * @since 1.0.0 * * phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.Missing */ public function ajax_connect() { parent::ajax_connect(); $data = wp_unslash( wp_parse_args( $_POST['data'] ) ); // phpcs:ignore $api_key = ! empty( $data['api_key'] ) ? sanitize_text_field( $data['api_key'] ) : ''; $account_name = ! empty( $data['account_name'] ) ? sanitize_text_field( $data['account_name'] ) : ''; try { if ( empty( $api_key ) ) { throw new RequiredArgumentMissingException( 'api_key' ); } $account = wpforms_sendinblue() ->get( 'account' ) ->add( $api_key, $account_name ); wp_send_json_success( [ 'html' => wpforms_sendinblue() ->get( 'template' ) ->get_settings_template( 'connected-account', [ 'label' => ! empty( $account['label'] ) ? esc_html( $account['label'] ) : '', 'core_slug' => esc_html( Plugin::SLUG ), 'key' => ! empty( $account['key'] ) ? esc_html( $account['key'] ) : '', ] ), ] ); } catch ( Exception $e ) { wp_send_json_error( [ 'error_msg' => $e->getMessage() ] ); } } /** * Display fields that will store Sendinblue account details. * * @since 1.0.0 */ protected function display_add_new_connection_fields() { echo wpforms_sendinblue()->get( 'account' )->get_form(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }
cloggier