<?php
namespace EVPB\Tools;

if ( !defined( 'ABSPATH' ) ) { exit; }

if( !class_exists( 'Helper' ) ) {
	class Helper {
		const TAB_BREAKPOINT = '@media ( max-width: 1023px )';
		const MOB_BREAKPOINT = '@media ( max-width: 767px )';

		static function allowedHTML() {
			global $allowedposttags;

			return wp_parse_args( [
				'style' => [],
				'svg' => [
					'xmlns' => [],
					'viewbox' => [],
					'width' => [],
					'height' => [],
					'fill' => [],
					'class' => []
				],
				'path' => [
					'd' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'rect' => [
					'x' => [],
					'y' => [],
					'width' => [],
					'height' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'circle' => [
					'cx' => [],
					'cy' => [],
					'r' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'ellipse' => [
					'cx' => [],
					'cy' => [],
					'rx' => [],
					'ry' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'line' => [
					'x1' => [],
					'y1' => [],
					'x2' => [],
					'y2' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'polyline' => [
					'points' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'polygon' => [
					'points' => [],
					'fill' => [],
					'stroke' => [],
					'stroke-width' => [],
					'class' => []
				],
				'g' => [
					'fill' => [],
					'transform' => [],
					'class' => []
				],
				'title' => [],
				'desc' => [],
				'iframe' => [
					'src' => [],
					'width' => [],
					'height' => [],
					'frameborder' => [],
					'allowfullscreen' => [],
					'class' => []
				],
			], $allowedposttags );
		}

		static function allowGetterThenForCSS( $content ){
			$replacements = [
				'&gt;.' => '>.',
				'&gt;. ' => '> .',
				'&gt;#' => '>#',
				'&gt; #' => '> #',
				' &gt; ' => ' > '
			];

			return str_replace( array_keys( $replacements ), array_values( $replacements ), $content );
		}
	}
	new Helper();
}
