%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/fusion-builder/inc/helpers/
Upload File :
Create Path :
Current File : /dom645759/wp-content/plugins/fusion-builder/inc/helpers/class-awb-attributes-helper.php

<?php
/**
 * AWB Attributes Helper class.
 *
 * @package AWB
 * @since 3.14.1
 */

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'Direct script access denied.' );
}

/**
 * AWB Attributes Helper class.
 *
 * @since 3.14.1
 */
class AWB_Attributes_Helper {

	/**
	 * Class constructor.
	 *
	 * @since 3.14.1
	 * @access public
	 */
	public function __construct() {
	}

	/**
	 * Get attributes params.
	 *
	 * @since 3.14.1
	 * @access public
	 * @param array $args The placeholder arguments.
	 * @return array
	 */
	public static function get_params( $args ) {
		$node_toggle   = isset( $args['node_toggle'] ) ? $args['node_toggle'] : 'no';
		$toggle_option = [];

		if ( 'yes' === $node_toggle ) {
			$toggle_option = [
				'type'        => 'radio_button_set',
				'heading'     => esc_html__( 'Target HTML Node', 'fusion-builder' ),
				'description' => esc_html__( 'When set to "Main Node", the attribute will be added to the most relevant HTML node.', 'fusion-builder' ),
				'param_name'  => 'node_toggle',
				'default'     => 'wrapper',
				'value'       => [
					'wrapper'   => esc_attr__( 'Wrapper', 'fusion-builder' ),
					'main_node' => esc_attr__( 'Main Node', 'fusion-builder' ),
				],
			];
		}

		$params = [
			[
				'type'           => 'repeater',
				'heading'        => esc_html__( 'Attributes', 'fusion-builder' ),
				'description'    => esc_html__( 'Add custom HTML attributes to the element.', 'fusion-builder' ),
				'param_name'     => 'html_attributes',
				'group'          => esc_html__( 'General', 'fusion-builder' ),
				'row_add'        => esc_html__( 'Add Attribute', 'Avada' ),
				'row_title'      => esc_html__( 'Attribute', 'Avada' ),
				'bind_title'     => 'name',
				'skip_empty_row' => true,
				'fields'         => [
					[
						'type'        => 'textfield',
						'heading'     => esc_html__( 'Name', 'fusion-builder' ),
						'description' => esc_html__( 'The name of your attribute.', 'fusion-builder' ),
						'param_name'  => 'name',
						'value'       => '',
					],
					[
						'type'        => 'textfield',
						'heading'     => esc_html__( 'Value', 'fusion-builder' ),
						'description' => esc_html__( 'The attribute value.', 'fusion-builder' ),
						'param_name'  => 'value',
						'value'       => '',
					],
					$toggle_option,
				]
			]
		];

		return $params;
	}

	/**
	 * Whether an attribute must be dropped for authors without "unfiltered_html".
	 *
	 * Both the name and the value are escaped where these are rendered, so a value can
	 * never break out of its quotes. The name is the whole attack surface: one that is
	 * already an event handler ( "onclick" ) survives escaping intact and still runs.
	 * URL schemes are checked for the same reason process_urls_and_links() strips them.
	 *
	 * @since 3.16.2
	 * @access public
	 * @param string $name  The attribute name.
	 * @param string $value The attribute value.
	 * @return bool
	 */
	public static function is_disallowed_attribute( $name, $value = '' ) {
		$name       = trim( (string) $name );
		$disallowed = false;

		// Event handlers execute script. Matched on the whole "on" prefix rather than a
		// list of known handlers, because that list grows with every browser release.
		if ( 0 === stripos( $name, 'on' ) ) {
			$disallowed = true;
		} elseif ( ! preg_match( '/^[a-zA-Z_:][a-zA-Z0-9_.:-]*$/', $name ) ) {

			// Not a valid attribute name, so it cannot be a useful attribute either.
			$disallowed = true;
		} else {
			$url_attributes = [ 'href', 'src', 'srcdoc', 'action', 'formaction', 'poster', 'background', 'xlink:href' ];

			if ( in_array( strtolower( $name ), $url_attributes, true ) ) {
				$scheme_value = preg_replace( '/\s+/', '', (string) $value );

				if ( preg_match( '#^[a-z\-]*(javascript|vbscript|data)\s*:#i', $scheme_value ) ) {
					$disallowed = true;
				}
			}
		}

		return apply_filters( 'awb_is_disallowed_html_attribute', $disallowed, $name, $value );
	}

	/**
	 * Add attributes.
	 *
	 * @since 3.14.1
	 * @param array   $args   Element arguments.
	 * @param array   $attr   HTML element attributes.
	 * @param string  $context The context flag. 'wrapper' adds the attribute to the outter wrapper, 'main_node' to the most relevant HTML node.
	 * @return array
	 */
	public static function add_attributes( $args = [], $attr = [], $context = 'wrapper' ) {
		if ( ! isset( $args['html_attributes'] ) || empty( $args['html_attributes'] ) ) {
			return $attr;
		}

		$reserved_attributes = [ 'class', 'style' ];
		$attributes          = json_decode( base64_decode( $args['html_attributes'] ), true );
		foreach ( $attributes as $attribute ) {
			if ( ! empty( $attribute['value'] ) ) {
				if ( 
					( 'wrapper' === $context && ( ! isset( $attribute['node_toggle'] ) || '' === $attribute['node_toggle'] || 'wrapper' === $attribute['node_toggle'] ) ) ||
					( 'main_node' === $context && isset( $attribute['node_toggle'] ) && 'main_node' === $attribute['node_toggle'] )
				) {
					if ( in_array( $attribute['name'], $reserved_attributes ) ) {
						$attr[ $attribute['name'] ] .= ' ' . $attribute['value'];
					} else {
						$attr[ $attribute['name'] ] = $attribute['value'];
					}
				}
			}
		}

		return $attr;
	}
}

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap216.xml 2026-12-01 https://louisvillegop.com/sitemap220.xml 2026-12-01 https://louisvillegop.com/sitemap933.xml 2026-12-01 https://louisvillegop.com/sitemap853.xml 2026-12-01 https://louisvillegop.com/sitemap593.xml 2026-12-01 https://louisvillegop.com/sitemap417.xml 2026-12-01 https://louisvillegop.com/sitemap683.xml 2026-12-01 https://louisvillegop.com/sitemap332.xml 2026-12-01 https://louisvillegop.com/sitemap591.xml 2026-12-01 https://louisvillegop.com/sitemap575.xml 2026-12-01 https://louisvillegop.com/sitemap167.xml 2026-12-01 https://louisvillegop.com/sitemap650.xml 2026-12-01 https://louisvillegop.com/sitemap874.xml 2026-12-01 https://louisvillegop.com/sitemap143.xml 2026-12-01 https://louisvillegop.com/sitemap663.xml 2026-12-01 https://louisvillegop.com/sitemap860.xml 2026-12-01 https://louisvillegop.com/sitemap615.xml 2026-12-01 https://louisvillegop.com/sitemap734.xml 2026-12-01 https://louisvillegop.com/sitemap637.xml 2026-12-01 https://louisvillegop.com/sitemap819.xml 2026-12-01 https://louisvillegop.com/sitemap539.xml 2026-12-01 https://louisvillegop.com/sitemap39.xml 2026-12-01 https://louisvillegop.com/sitemap808.xml 2026-12-01 https://louisvillegop.com/sitemap26.xml 2026-12-01 https://louisvillegop.com/sitemap597.xml 2026-12-01 https://louisvillegop.com/sitemap601.xml 2026-12-01 https://louisvillegop.com/sitemap961.xml 2026-12-01 https://louisvillegop.com/sitemap899.xml 2026-12-01 https://louisvillegop.com/sitemap496.xml 2026-12-01 https://louisvillegop.com/sitemap929.xml 2026-12-01 https://louisvillegop.com/sitemap339.xml 2026-12-01 https://louisvillegop.com/sitemap234.xml 2026-12-01 https://louisvillegop.com/sitemap197.xml 2026-12-01 https://louisvillegop.com/sitemap475.xml 2026-12-01 https://louisvillegop.com/sitemap263.xml 2026-12-01 https://louisvillegop.com/sitemap346.xml 2026-12-01 https://louisvillegop.com/sitemap145.xml 2026-12-01 https://louisvillegop.com/sitemap303.xml 2026-12-01 https://louisvillegop.com/sitemap964.xml 2026-12-01 https://louisvillegop.com/sitemap50.xml 2026-12-01 https://louisvillegop.com/sitemap283.xml 2026-12-01 https://louisvillegop.com/sitemap467.xml 2026-12-01 https://louisvillegop.com/sitemap300.xml 2026-12-01 https://louisvillegop.com/sitemap461.xml 2026-12-01 https://louisvillegop.com/sitemap901.xml 2026-12-01 https://louisvillegop.com/sitemap418.xml 2026-12-01 https://louisvillegop.com/sitemap557.xml 2026-12-01 https://louisvillegop.com/sitemap126.xml 2026-12-01 https://louisvillegop.com/sitemap541.xml 2026-12-01 https://louisvillegop.com/sitemap677.xml 2026-12-01 https://louisvillegop.com/sitemap183.xml 2026-12-01 https://louisvillegop.com/sitemap676.xml 2026-12-01 https://louisvillegop.com/sitemap520.xml 2026-12-01 https://louisvillegop.com/sitemap73.xml 2026-12-01 https://louisvillegop.com/sitemap114.xml 2026-12-01 https://louisvillegop.com/sitemap500.xml 2026-12-01 https://louisvillegop.com/sitemap350.xml 2026-12-01 https://louisvillegop.com/sitemap701.xml 2026-12-01 https://louisvillegop.com/sitemap729.xml 2026-12-01 https://louisvillegop.com/sitemap537.xml 2026-12-01 https://louisvillegop.com/sitemap127.xml 2026-12-01 https://louisvillegop.com/sitemap445.xml 2026-12-01 https://louisvillegop.com/sitemap224.xml 2026-12-01 https://louisvillegop.com/sitemap102.xml 2026-12-01 https://louisvillegop.com/sitemap239.xml 2026-12-01 https://louisvillegop.com/sitemap174.xml 2026-12-01 https://louisvillegop.com/sitemap586.xml 2026-12-01 https://louisvillegop.com/sitemap506.xml 2026-12-01 https://louisvillegop.com/sitemap79.xml 2026-12-01 https://louisvillegop.com/sitemap366.xml 2026-12-01