/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Providers/Provider/Settings
NameSizeModeActions
FormBuilder.php258810644editdlrm
FormBuilderInterface.php6930644editdlrm
PageIntegrations.php103430644editdlrm
PageIntegrationsInterface.php5840644editdlrm
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Providers/Provider/Settings/FormBuilder.php (25881B)
core = $core; $form_obj = wpforms()->obj( 'form' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; if ( $form_obj && $form_id ) { $this->form_data = $form_obj->get( $form_id, [ 'content_only' => true ] ); // Form ID isn't defined for newly created forms. if ( empty( $this->form_data['id'] ) && is_array( $this->form_data ) ) { $this->form_data['id'] = $form_id; } } $this->init_hooks(); } /** * Register all hooks (actions and filters) here. * * @since 1.4.7 */ protected function init_hooks() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks // Register builder HTML template(s). add_action( 'wpforms_builder_print_footer_scripts', [ $this, 'builder_templates' ] ); add_action( 'wpforms_builder_print_footer_scripts', [ $this, 'builder_custom_templates' ], 11 ); // Process builder AJAX requests. add_action( "wp_ajax_wpforms_builder_provider_ajax_{$this->core->slug}", [ $this, 'process_ajax' ] ); /* * Enqueue assets. */ if ( ( ! empty( $_GET['page'] ) && $_GET['page'] === 'wpforms-builder' ) && // phpcs:ignore ! empty( $_GET['form_id'] ) && // phpcs:ignore is_admin() ) { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); } add_filter( 'wpforms_save_form_args', [ $this, 'remove_connection_locks' ], 1, 3 ); } /** * Used to register generic templates for all providers inside form builder. * * @since 1.4.7 * @since 1.6.2 Added sub-templates for conditional logic based on provider. */ public function builder_templates(): void { $cl_builder_block = wpforms()->is_pro() ? wpforms_conditional_logic()->builder_block( [ 'form' => $this->form_data, 'type' => 'panel', 'parent' => 'providers', 'panel' => esc_attr( $this->core->slug ), 'subsection' => '%connection_id%', ], false ) : ''; ?> builder_error_template(); } /** * Enqueue the JavaScript and CSS files if needed. * When extending - include the `parent::enqueue_assets();` not to break things! * * @since 1.4.7 */ public function enqueue_assets() { $min = wpforms_get_min_suffix(); wp_enqueue_script( 'wpforms-admin-builder-templates', WPFORMS_PLUGIN_URL . "assets/js/admin/builder/templates{$min}.js", [ 'wp-util' ], WPFORMS_VERSION, true ); wp_enqueue_script( 'wpforms-admin-builder-providers', WPFORMS_PLUGIN_URL . "assets/js/admin/builder/providers{$min}.js", [ 'wpforms-utils', 'wpforms-builder', 'wpforms-admin-builder-templates' ], WPFORMS_VERSION, true ); } /** * Process the Builder AJAX requests. * * @since 1.4.7 */ public function process_ajax(): void { // Run a security check. check_ajax_referer( 'wpforms-builder', 'nonce' ); // Check for permissions. if ( ! wpforms_current_user_can( 'edit_forms' ) ) { wp_send_json_error( [ 'error' => esc_html__( 'You do not have permission to perform this action.', 'wpforms-lite' ), ] ); } // Process required values. $error = [ 'error' => esc_html__( 'Something went wrong while performing an AJAX request.', 'wpforms-lite' ) ]; if ( empty( $_POST['id'] ) || empty( $_POST['task'] ) ) { wp_send_json_error( $error ); } $form_id = (int) $_POST['id']; $task = sanitize_key( $_POST['task'] ); $revisions = wpforms()->obj( 'revisions' ); $revision = $revisions ? $revisions->get_revision() : null; if ( $revision ) { // Set up form data based on the revision_id that we got from AJAX request. $this->form_data = wpforms_decode( $revision->post_content ); } else { // Set up form data based on the ID that we got from AJAX request. $form_handler = wpforms()->obj( 'form' ); $this->form_data = $form_handler ? $form_handler->get( $form_id, [ 'content_only' => true ] ) : []; } // Do not allow proceeding further, as form_id may be incorrect. if ( empty( $this->form_data ) ) { wp_send_json_error( $error ); } $data = apply_filters( // phpcs:ignore WPForms.Comments.PHPDocHooks.RequiredHookDocumentation, WPForms.PHP.ValidateHooks.InvalidHookName 'wpforms_providers_settings_builder_ajax_' . $task . '_' . $this->core->slug, null ); if ( ! empty( $data['error_msg'] ) ) { wp_send_json_error( [ 'error_msg' => $data['error_msg'] ] ); } if ( $data !== null ) { wp_send_json_success( $data ); } wp_send_json_error( $error ); } /** * Display content inside the panel sidebar area. * * @since 1.4.7 */ public function display_sidebar() { $configured = ''; if ( ! empty( $this->form_data['id'] ) && Status::init( $this->core->slug )->is_ready( $this->form_data['id'] ) ) { $configured = 'configured'; } $classes = [ 'wpforms-panel-sidebar-section', 'icon', $configured, 'wpforms-panel-sidebar-section-' . $this->core->slug, ]; ?> icon core->name ); ?>
display_content_header(); $form_id = ! empty( $this->form_data['id'] ) ? $this->form_data['id'] : ''; self::display_content_default_screen( Status::init( $this->core->slug )->is_ready( $form_id ), $this->core->slug, $this->core->name, $this->core->icon ); $this->display_lock_field(); ?>
' . esc_html__( 'Get the most out of WPForms — use it with an active %s account.', 'wpforms-lite' ) . '

', esc_html( $name ) ) ); ?>
is_lock_field_required( $this->core->slug ) ) { return; } ?> core->slug ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; $is_configured = $provider_status->is_configured(); $is_connected = $provider_status->is_ready( $form_id ); ?>
core->name ); ?>
core->slug ] ) ) { return $form; } $provider = $form_data['providers'][ $this->core->slug ]; $lock = '__lock__'; // Remove the lock field if it's the only one and it's locked. if ( isset( $provider[ $lock ] ) && count( $provider ) === 1 && absint( $provider[ $lock ] ) === 1 ) { unset( $form_data['providers'][ $this->core->slug ]['__lock__'] ); $form['post_content'] = wpforms_encode( $form_data ); } return $form; } /** * Received field values for fields with multiple choices, e.g., multi-select. * Connection Data has only the last saved field option. * So, we should receive data from super global $_POST and receive all submitted options instead. * WARNING: Sanitization of these values is required. * * @since 1.9.7 * * @param string $name Field name. * @param array $connection_data Connection data. * * @return array */ protected function get_multiple_option_field( string $name, array $connection_data ): array { // The nonce checked in the `wpforms_save_form` function. // phpcs:disable WordPress.Security.NonceVerification // When we duplicate a form the `$_POST['data']` is empty, // we shouldn't update the field and use copied data. if ( empty( $_POST['data'] ) || empty( $connection_data['id'] ) ) { return isset( $connection_data[ $name ] ) ? (array) $connection_data[ $name ] : []; } $connection_id = $connection_data['id']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $form_post = json_decode( wp_unslash( $_POST['data'] ), true ) ?? []; $full_name = "providers[{$this->core->slug}][$connection_id][$name][]"; $values = []; // phpcs:enable WordPress.Security.NonceVerification foreach ( $form_post as $post_pair ) { if ( empty( $post_pair['name'] ) || $post_pair['name'] !== $full_name ) { continue; } $values[] = $post_pair['value']; } return $values; } /** * Sanitize custom fields. * * @since 1.9.3 * * @param array $connection Connection data. */ protected function sanitize_connection_fields_meta( array &$connection ): void { if ( ! isset( $connection['fields_meta'] ) ) { return; } if ( ! is_array( $connection['fields_meta'] ) ) { unset( $connection['fields_meta'] ); return; } foreach ( $connection['fields_meta'] as $row_number => $field ) { if ( ! isset( $field['field_id'], $field['name'] ) ) { unset( $connection['fields_meta'][ $row_number ] ); continue; } // Field ID can contain a subfield, e.g. `1.first`. $field_id = sanitize_text_field( $field['field_id'] ); $name = sanitize_text_field( $field['name'] ); if ( wpforms_is_empty_string( $field_id ) || wpforms_is_empty_string( $name ) ) { unset( $connection['fields_meta'][ $row_number ] ); continue; } $connection['fields_meta'][ $row_number ] = [ 'name' => $name, 'field_id' => $field_id, ]; } $connection['fields_meta'] = array_values( $connection['fields_meta'] ); } /** * Sanitize conditional logic connection fields. * * @since 1.9.3 * * @param array $connection Connection data. */ protected function sanitize_connection_conditionals( array &$connection ): void { if ( ! isset( $connection['conditionals'] ) ) { return; } if ( ! is_array( $connection['conditionals'] ) ) { unset( $connection['conditionals'] ); return; } foreach ( $connection['conditionals'] as $group_id => $group ) { foreach ( $group as $rule ) { $this->sanitize_connection_conditional_rule( $rule ); } $group = array_filter( $group ); if ( empty( $group ) ) { unset( $connection['conditionals'][ $group_id ] ); continue; } $connection['conditionals'][ $group_id ] = $group; } } /** * Sanitize conditional logic rule. * * @since 1.9.3 * * @param array $rule Conditional logic rule. */ private function sanitize_connection_conditional_rule( array &$rule ): void { if ( ! isset( $rule['field'], $rule['operator'] ) ) { $rule = []; return; } $sanitized_rule = [ 'field' => sanitize_text_field( $rule['field'] ), 'operator' => sanitize_text_field( $rule['operator'] ), ]; if ( wpforms_is_empty_string( $sanitized_rule['field'] ) || wpforms_is_empty_string( $sanitized_rule['operator'] ) ) { $rule = []; return; } if ( isset( $rule['value'] ) ) { $sanitized_rule['value'] = sanitize_text_field( $rule['value'] ); } $rule = $sanitized_rule; } /** * Builder error template. * This generates an HTML template for displaying an error message * when the connection to the provider fails. The message includes * a link to the connection settings page for troubleshooting. * * @since 1.9.5 * * @noinspection HtmlUnknownTarget */ protected function builder_error_template(): void { ?> core->slug ) ); } }