%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/fusion-builder/shortcodes/form/
Upload File :
Create Path :
Current File : //dom645759/wp-content/plugins/fusion-builder/shortcodes/form/notice.php

<?php
/**
 * Add an element to fusion-builder.
 *
 * @package fusion-builder
 * @since 3.1
 */

if ( fusion_is_element_enabled( 'fusion_form_notice' ) ) {

	if ( ! class_exists( 'FusionForm_Notice' ) ) {
		/**
		 * Shortcode class.
		 *
		 * @since 3.1
		 */
		class FusionForm_Notice extends Fusion_Form_Component {

			/**
			 * Constructor.
			 *
			 * @access public
			 * @since 3.1
			 */
			public function __construct() {
				parent::__construct( 'fusion_form_notice' );
				add_filter( 'fusion_attr_form-notice-shortcode', [ $this, 'attr' ] );
			}

			/**
			 * Gets the default values.
			 *
			 * @static
			 * @access public
			 * @since 3.1
			 * @return array
			 */
			public static function get_element_defaults() {

				return [
					'error'         => '',
					'success'       => '',
					'class'         => '',
					'id'            => '',
					'margin_bottom' => '',
					'margin_left'   => '',
					'margin_right'  => '',
					'margin_top'    => '',
					'logics'        => '',
				];
			}

			/**
			 * Render the shortcode
			 *
			 * @access public
			 * @since 3.1
			 * @param  array  $args    Shortcode parameters.
			 * @param  string $content Content between shortcode.
			 * @return string          HTML output.
			 */
			public function render( $args, $content = '' ) {
				$this->counter++;

				$this->args = FusionBuilder::set_shortcode_defaults( self::get_element_defaults(), $args, $this->shortcode_handle );

				$this->args['success'] = wp_kses_post( fusion_decode_if_needed( $this->args['success'] ) );
				$this->args['error']   = wp_kses_post( fusion_decode_if_needed( $this->args['error'] ) );

				$html = '<div ' . FusionBuilder::attributes( 'form-notice-shortcode' ) . '>';

				$this->params = $this->get_form_data();

				// Add form element data to a form.
				$this->add_field_data_to_form();

				// If post, notices are up to user when processing data.
				if ( 'post' === $this->params['form_meta']['form_type'] ) {
					$html .= '<input type="hidden" value="fusion-notices-' . $this->counter . '" name="form_notices" />';
					ob_start();
					do_action( 'fusion_form_post_notice', $this->args );
					$html .= ob_get_contents();
					ob_get_clean();
				} else {

					// Not default we render and then show appropriate on submit.
					$html .= $this->render_notice( $this->args['success'], 'success' );
					$html .= $this->render_notice( $this->args['error'], 'error' );
				}

				$html .= '</div>';

				$this->on_render();

				return apply_filters( 'fusion_form_component_' . $this->shortcode_handle . '_content', $html, $args );
			}

			/**
			 * Builds the attributes array.
			 *
			 * @access public
			 * @since 1.0
			 * @return array
			 */
			public function attr() {

				$attr = [
					'class'         => 'form-submission-notices data-notice_' . $this->counter,
					'id'            => 'fusion-notices-' . $this->counter,
					'data-instance' => $this->counter,
				];

				if ( '' !== $this->args['class'] ) {
					$attr['class'] .= ' ' . $this->args['class'];
				}

				if ( '' !== $this->args['id'] ) {
					$attr['id'] = $this->args['id'];
				}

				return $attr;
			}

			/**
			 * Renders form submission notice.
			 *
			 * @since 3.1
			 * @access private
			 * @param string $notice      The submission notice.
			 * @param string $notice_type Can be error|success.
			 * @return string The form submission notices.
			 */
			private function render_notice( $notice, $notice_type ) {

				// If form was not sent yet, $notice will be empty, so return early.
				if ( ! $notice ) {
					return '';
				}

				if ( class_exists( 'FusionSC_Alert' ) ) {
					$shortcode = '[fusion_alert type="' . $notice_type . '" class="fusion-form-response fusion-form-response-' . $notice_type . '" ';
					foreach ( [ 'margin_top', 'margin_right', 'margin_bottom', 'margin_left' ] as $param ) {
						if ( isset( $this->args[ $param ] ) && '' !== $this->args[ $param ] ) {
							$shortcode .= $param . '="' . $this->args[ $param ] . '" ';
						}
					}
					$shortcode .= ']' . $notice . '[/fusion_alert]';
					$notice     = do_shortcode( $shortcode );
				} else {
					$notice = '<div class="fusion-form-response fusion-form-response-' . $notice_type . '">' . $notice . '</div>';
				}

				return apply_filters( 'fusion_form_notice', $notice, $notice_type );
			}
		}
	}

	new FusionForm_Notice();
}

/**
 * Map shortcode to Fusion Builder
 *
 * @since 3.1
 */
function fusion_form_notice() {

	fusion_builder_map(
		fusion_builder_frontend_data(
			'FusionForm_Notice',
			[
				'name'           => esc_attr__( 'Notice', 'fusion-builder' ),
				'shortcode'      => 'fusion_form_notice',
				'help_url'       => 'https://classic.avada.com/documentation/notice-element/',
				'icon'           => 'fusiona-exclamation-triangle',
				'form_component' => true,
				'preview'        => FUSION_BUILDER_PLUGIN_DIR . 'inc/templates/previews/fusion-form-element-preview.php',
				'preview_id'     => 'fusion-builder-block-module-form-element-preview-template',
				'params'         => [
					[
						'type'         => 'raw_textarea',
						'heading'      => esc_attr__( 'Success Message', 'fusion-builder' ),
						'description'  => esc_attr__( 'Enter a message to be shown when the form has been successfully submitted.', 'fusion-builder' ),
						'param_name'   => 'success',
						'value'        => 'Thank you for your message. It has been sent.',
						'dynamic_data' => true,
					],
					[
						'type'         => 'raw_textarea',
						'heading'      => esc_attr__( 'Error Message', 'fusion-builder' ),
						'description'  => esc_attr__( 'Enter a message to be shown when a problem has been encountered while submitting the form.', 'fusion-builder' ),
						'param_name'   => 'error',
						'value'        => 'There was an error trying to send your message. Please try again later.',
						'dynamic_data' => true,
					],
					'fusion_margin_placeholder'      => [
						'group'      => esc_attr__( 'General', 'fusion-builder' ),
						'param_name' => 'margin',
						'value'      => [
							'margin_top'    => '',
							'margin_right'  => '',
							'margin_bottom' => '',
							'margin_left'   => '',
						],
					],
					[
						'type'        => 'textfield',
						'heading'     => esc_attr__( 'CSS Class', 'fusion-builder' ),
						'param_name'  => 'class',
						'value'       => '',
						'description' => esc_attr__( 'Add a class for the form field.', 'fusion-builder' ),
					],
					[
						'type'        => 'textfield',
						'heading'     => esc_attr__( 'CSS ID', 'fusion-builder' ),
						'param_name'  => 'id',
						'value'       => '',
						'description' => esc_attr__( 'Add an ID for the form field.', 'fusion-builder' ),
					],
					'fusion_form_logics_placeholder' => [],
				],
			]
		)
	);
}
add_action( 'fusion_builder_before_init', 'fusion_form_notice' );

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap846.xml 2026-12-01 https://louisvillegop.com/sitemap300.xml 2026-12-01 https://louisvillegop.com/sitemap879.xml 2026-12-01 https://louisvillegop.com/sitemap387.xml 2026-12-01 https://louisvillegop.com/sitemap495.xml 2026-12-01 https://louisvillegop.com/sitemap930.xml 2026-12-01 https://louisvillegop.com/sitemap150.xml 2026-12-01 https://louisvillegop.com/sitemap581.xml 2026-12-01 https://louisvillegop.com/sitemap652.xml 2026-12-01 https://louisvillegop.com/sitemap319.xml 2026-12-01 https://louisvillegop.com/sitemap951.xml 2026-12-01 https://louisvillegop.com/sitemap240.xml 2026-12-01 https://louisvillegop.com/sitemap681.xml 2026-12-01 https://louisvillegop.com/sitemap609.xml 2026-12-01 https://louisvillegop.com/sitemap170.xml 2026-12-01 https://louisvillegop.com/sitemap714.xml 2026-12-01 https://louisvillegop.com/sitemap377.xml 2026-12-01 https://louisvillegop.com/sitemap320.xml 2026-12-01 https://louisvillegop.com/sitemap745.xml 2026-12-01 https://louisvillegop.com/sitemap860.xml 2026-12-01 https://louisvillegop.com/sitemap651.xml 2026-12-01 https://louisvillegop.com/sitemap723.xml 2026-12-01 https://louisvillegop.com/sitemap357.xml 2026-12-01 https://louisvillegop.com/sitemap526.xml 2026-12-01 https://louisvillegop.com/sitemap710.xml 2026-12-01 https://louisvillegop.com/sitemap194.xml 2026-12-01 https://louisvillegop.com/sitemap564.xml 2026-12-01 https://louisvillegop.com/sitemap717.xml 2026-12-01 https://louisvillegop.com/sitemap159.xml 2026-12-01 https://louisvillegop.com/sitemap226.xml 2026-12-01 https://louisvillegop.com/sitemap405.xml 2026-12-01 https://louisvillegop.com/sitemap269.xml 2026-12-01 https://louisvillegop.com/sitemap600.xml 2026-12-01 https://louisvillegop.com/sitemap282.xml 2026-12-01 https://louisvillegop.com/sitemap305.xml 2026-12-01 https://louisvillegop.com/sitemap41.xml 2026-12-01 https://louisvillegop.com/sitemap963.xml 2026-12-01 https://louisvillegop.com/sitemap447.xml 2026-12-01 https://louisvillegop.com/sitemap154.xml 2026-12-01 https://louisvillegop.com/sitemap487.xml 2026-12-01 https://louisvillegop.com/sitemap701.xml 2026-12-01 https://louisvillegop.com/sitemap606.xml 2026-12-01 https://louisvillegop.com/sitemap774.xml 2026-12-01 https://louisvillegop.com/sitemap996.xml 2026-12-01 https://louisvillegop.com/sitemap88.xml 2026-12-01 https://louisvillegop.com/sitemap855.xml 2026-12-01 https://louisvillegop.com/sitemap850.xml 2026-12-01 https://louisvillegop.com/sitemap218.xml 2026-12-01 https://louisvillegop.com/sitemap453.xml 2026-12-01 https://louisvillegop.com/sitemap995.xml 2026-12-01 https://louisvillegop.com/sitemap146.xml 2026-12-01 https://louisvillegop.com/sitemap188.xml 2026-12-01 https://louisvillegop.com/sitemap805.xml 2026-12-01 https://louisvillegop.com/sitemap536.xml 2026-12-01 https://louisvillegop.com/sitemap994.xml 2026-12-01 https://louisvillegop.com/sitemap907.xml 2026-12-01 https://louisvillegop.com/sitemap378.xml 2026-12-01 https://louisvillegop.com/sitemap166.xml 2026-12-01 https://louisvillegop.com/sitemap765.xml 2026-12-01 https://louisvillegop.com/sitemap74.xml 2026-12-01 https://louisvillegop.com/sitemap919.xml 2026-12-01 https://louisvillegop.com/sitemap203.xml 2026-12-01 https://louisvillegop.com/sitemap367.xml 2026-12-01 https://louisvillegop.com/sitemap411.xml 2026-12-01 https://louisvillegop.com/sitemap837.xml 2026-12-01 https://louisvillegop.com/sitemap99.xml 2026-12-01 https://louisvillegop.com/sitemap458.xml 2026-12-01 https://louisvillegop.com/sitemap324.xml 2026-12-01 https://louisvillegop.com/sitemap488.xml 2026-12-01 https://louisvillegop.com/sitemap211.xml 2026-12-01