core-bundle/src/Resources/contao/classes/StyleSheets.php
protected function createDefinition($arrDefinition)
	{
		$arrSet = array
		(
			'pid'      => $arrDefinition['pid'],
			'sorting'  => $arrDefinition['sorting'],
			'tstamp'   => time(),
			'comment'  => $arrDefinition['comment'],
			'category' => $arrDefinition['category'],
			'selector' => $arrDefinition['selector']
		);

		$arrAttributes = StringUtil::trimsplit(';', $arrDefinition['attributes']);

		foreach ($arrAttributes as $strDefinition)
		{
			// Skip empty definitions
			if (trim($strDefinition) == '')
			{
				continue;
			}

			// Handle keywords, variables and functions (see #7448)
			if (strpos($strDefinition, 'important') !== false || strpos($strDefinition, 'transparent') !== false || strpos($strDefinition, 'inherit') !== false || strpos($strDefinition, '$') !== false || strpos($strDefinition, '(') !== false)
			{
				$arrSet['own'][] = $strDefinition;
				continue;
			}

			$arrChunks = array_map('trim', explode(':', $strDefinition, 2));
			$strKey = strtolower($arrChunks[0]);

			switch ($strKey)
			{
				case 'width':
				case 'height':
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strKey]['value'] = $varValue;
					$arrSet[$strKey]['unit'] = $strUnit;
					break;

				case 'min-width':
				case 'min-height':
					$strName = str_replace('-', '', $strKey);
					if ($arrChunks[1] == 'inherit')
					{
						$strUnit = '';
						$varValue = 'inherit';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strName]['value'] = $varValue;
					$arrSet[$strName]['unit'] = $strUnit;
					break;

				case 'max-width':
				case 'max-height':
					$strName = str_replace('-', '', $strKey);
					if ($arrChunks[1] == 'inherit' || $arrChunks[1] == 'none')
					{
						$strUnit = '';
						$varValue = $arrChunks[1];
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strName]['value'] = $varValue;
					$arrSet[$strName]['unit'] = $strUnit;
					break;

				case 'top':
				case 'right':
				case 'bottom':
				case 'left':
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					elseif (isset($arrSet['trbl']['unit']))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['positioning'] = 1;
					$arrSet['trbl'][$strKey] = $varValue;
					if ($strUnit != '')
					{
						$arrSet['trbl']['unit'] = $strUnit;
					}
					break;

				case 'position':
				case 'overflow':
				case 'clear':
				case 'display':
					$arrSet['positioning'] = 1;
					$arrSet[$strKey] = $arrChunks[1];
					break;

				case 'float':
					$arrSet['positioning'] = 1;
					$arrSet['floating'] = $arrChunks[1];
					break;

				case 'margin':
				case 'padding':
					$arrSet['alignment'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$arrUnits = array();
					switch (\count($arrTRBL))
					{
						case 1:
							if ($arrTRBL[0] == 'auto')
							{
								$strUnit = '';
								$varValue = 'auto';
							}
							else
							{
								$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;

						case 2:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;

						case 3:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							if ($arrTRBL[2] == 'auto')
							{
								$varValue_3 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[2]);
								$varValue_3 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_3,
								'left' => $varValue_2,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;

						case 4:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							if ($arrTRBL[2] == 'auto')
							{
								$varValue_3 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[2]);
								$varValue_3 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]);
							}
							if ($arrTRBL[3] == 'auto')
							{
								$varValue_4 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[3]);
								$varValue_4 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_3,
								'left' => $varValue_4,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;
					}
					break;

				case 'margin-top':
				case 'margin-right':
				case 'margin-bottom':
				case 'margin-left':
					$arrSet['alignment'] = 1;
					$strName = str_replace('margin-', '', $strKey);
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['margin'][$strName] = $varValue;
					if (empty($arrSet['margin']['unit']))
					{
						$arrSet['margin']['unit'] = $strUnit;
					}
					break;

				case 'padding-top':
				case 'padding-right':
				case 'padding-bottom':
				case 'padding-left':
					$arrSet['alignment'] = 1;
					$strName = str_replace('padding-', '', $strKey);
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
					$arrSet['padding'][$strName] = $varValue;
					$arrSet['padding']['unit'] = $strUnit;
					break;

				case 'align':
				case 'text-align':
				case 'vertical-align':
				case 'white-space':
					$arrSet['alignment'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'background-color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['background'] = 1;
						$arrSet['bgcolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'background-image':
					$url = preg_replace('/url\(["\']?([^"\')]+)["\']?\)/i', '$1', $arrChunks[1]);

					if (strncmp($url, '-', 1) === 0)
					{
						// Ignore vendor prefixed commands
					}
					elseif (strncmp($url, 'radial-gradient', 15) === 0)
					{
						$arrSet['own'][] = $strDefinition; // radial gradients (see #4640)
					}
					else
					{
						$arrSet['background'] = 1;

						// Handle linear gradients (see #4640)
						if (strncmp($url, 'linear-gradient', 15) === 0)
						{
							$colors = StringUtil::trimsplit(',', preg_replace('/linear-gradient ?\(([^\)]+)\)/', '$1', $url));
							$arrSet['gradientAngle'] = array_shift($colors);
							$arrSet['gradientColors'] = serialize($colors);
						}
						else
						{
							$arrSet['bgimage'] = $url;
						}
					}
					break;

				case 'background-position':
					$arrSet['background'] = 1;
					if (preg_match('/[0-9]+/', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['bgposition'] = $arrChunks[1];
					}
					break;

				case 'background-repeat':
					$arrSet['background'] = 1;
					$arrSet['bgrepeat'] = $arrChunks[1];
					break;

				case 'border':
					if ($arrChunks[1] == 'none')
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrWSC = preg_split('/\s+/', $arrChunks[1]);
					if ($arrWSC[2] != '' && !preg_match('/^#[a-f0-9]+$/i', $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['border'] = 1;
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrWSC[0]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrWSC[0]);
					$arrSet['borderwidth'] = array
					(
						'top' => $varValue,
						'right' => $varValue,
						'bottom' => $varValue,
						'left' => $varValue,
						'unit' => $strUnit
					);
					if ($arrWSC[1] != '')
					{
						$arrSet['borderstyle'] = $arrWSC[1];
					}
					if ($arrWSC[2] != '')
					{
						$arrSet['bordercolor'] = str_replace('#', '', $arrWSC[2]);
					}
					break;

				case 'border-top':
				case 'border-right':
				case 'border-bottom':
				case 'border-left':
					if ($arrChunks[1] == 'none')
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrWSC = preg_split('/\s+/', $arrChunks[1]);
					if ($arrWSC[2] != '' && !preg_match('/^#[a-f0-9]+$/i', $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['border'] = 1;
					$strName = str_replace('border-', '', $strKey);
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrWSC[0]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrWSC[0]);
					if ((isset($arrSet['borderwidth']['unit']) && $arrSet['borderwidth']['unit'] != $strUnit) || ($arrWSC[1] != '' && isset($arrSet['borderstyle']) && $arrSet['borderstyle'] != $arrWSC[1]) || ($arrWSC[2] != '' && isset($arrSet['bordercolor']) && $arrSet['bordercolor'] != $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['borderwidth'][$strName] = preg_replace('/[^0-9.-]+/', '', $varValue);
					$arrSet['borderwidth']['unit'] = $strUnit;
					if ($arrWSC[1] != '')
					{
						$arrSet['borderstyle'] = $arrWSC[1];
					}
					if ($arrWSC[2] != '')
					{
						$arrSet['bordercolor'] = str_replace('#', '', $arrWSC[2]);
					}
					break;

				case 'border-width':
					$arrSet['border'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$strUnit = '';
					foreach ($arrTRBL as $v)
					{
						if ($v != 0)
						{
							$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
						}
					}
					switch (\count($arrTRBL))
					{
						case 1:
							$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$arrSet['borderwidth'] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;
						case 2:
							$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							$arrSet['borderwidth'] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => $strUnit
							);
							break;
						case 4:
							$arrSet['borderwidth'] = array
							(
								'top' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]),
								'right' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]),
								'bottom' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]),
								'left' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]),
								'unit' => $strUnit
							);
							break;
					}
					break;

				case 'border-color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['border'] = 1;
						$arrSet['bordercolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'border-radius':
					$arrSet['border'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$strUnit = '';
					foreach ($arrTRBL as $v)
					{
						if ($v != 0)
						{
							$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
						}
					}
					switch (\count($arrTRBL))
					{
						case 1:
							$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$arrSet['borderradius'] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;
						case 2:
							$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							$arrSet['borderradius'] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => $strUnit
							);
							break;
						case 4:
							$arrSet['borderradius'] = array
							(
								'top' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]),
								'right' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]),
								'bottom' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]),
								'left' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]),
								'unit' => $strUnit
							);
							break;
					}
					break;

				case '-moz-border-radius':
				case '-webkit-border-radius':
					// Ignore
					break;

				case 'border-style':
				case 'border-collapse':
					$arrSet['border'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'border-spacing':
					$arrSet['border'] = 1;
					$arrSet['borderspacing'] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'font-family':
					$arrSet['font'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'font-size':
					if (!preg_match('/[0-9]+/', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['font'] = 1;
						$arrSet['fontsize'] = array
						(
							'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
							'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
						);
					}
					break;

				case 'font-weight':
					if ($arrChunks[1] == 'bold' || $arrChunks[1] == 'normal')
					{
						$arrSet['font'] = 1;
						$arrSet['fontstyle'][] = $arrChunks[1];
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'font-style':
					if ($arrChunks[1] == 'italic')
					{
						$arrSet['font'] = 1;
						$arrSet['fontstyle'][] = 'italic';
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'text-decoration':
					$arrSet['font'] = 1;
					switch ($arrChunks[1])
					{
						case 'underline':
							$arrSet['fontstyle'][] = 'underline';
							break;

						case 'none':
							$arrSet['fontstyle'][] = 'notUnderlined';
							break;

						case 'overline':
						case 'line-through':
							$arrSet['fontstyle'][] = $arrChunks[1];
							break;
					}
					break;

				case 'font-variant':
					$arrSet['font'] = 1;
					if ($arrChunks[1] == 'small-caps')
					{
						$arrSet['fontstyle'][] = 'small-caps';
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['font'] = 1;
						$arrSet['fontcolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'line-height':
					$arrSet['font'] = 1;
					$arrSet['lineheight'] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'text-transform':
					$arrSet['font'] = 1;
					$arrSet['texttransform'] = $arrChunks[1];
					break;

				case 'text-indent':
				case 'letter-spacing':
				case 'word-spacing':
					$strName = str_replace('-', '', $strKey);
					$arrSet['font'] = 1;
					$arrSet[$strName] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'list-style-type':
					$arrSet['list'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'list-style-image':
					$arrSet['list'] = 1;
					$arrSet['liststyleimage'] = preg_replace('/url\(["\']?([^"\')]+)["\']?\)/i', '$1', $arrChunks[1]);
					break;

				case 'behavior':
					$arrSet['own'][] = $strDefinition;
					break;

				default:
					$blnIsOwn = true;

					// Allow custom definitions
					if (isset($GLOBALS['TL_HOOKS']['createDefinition']) && \is_array($GLOBALS['TL_HOOKS']['createDefinition']))
					{
						foreach ($GLOBALS['TL_HOOKS']['createDefinition'] as $callback)
						{
							$this->import($callback[0]);
							$arrTemp = $this->{$callback[0]}->{$callback[1]}($strKey, $arrChunks[1], $strDefinition, $arrSet);

							if ($arrTemp && \is_array($arrTemp))
							{
								$blnIsOwn = false;
								$arrSet = array_merge($arrSet, $arrTemp);
							}
						}
					}

					// Unknown definition
					if ($blnIsOwn)
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;
			}
		}

		if (!empty($arrSet['own']))
		{
			$arrSet['own'] = implode(";\n", $arrSet['own']) . ';';
		}

		$this->Database->prepare("INSERT INTO tl_style %s")->set($arrSet)->execute();
	}
protected function createDefinition($arrDefinition)
	{
		$arrSet = array
		(
			'pid'      => $arrDefinition['pid'],
			'sorting'  => $arrDefinition['sorting'],
			'tstamp'   => time(),
			'comment'  => $arrDefinition['comment'],
			'category' => $arrDefinition['category'],
			'selector' => $arrDefinition['selector']
		);

		$arrAttributes = StringUtil::trimsplit(';', $arrDefinition['attributes']);

		foreach ($arrAttributes as $strDefinition)
		{
			// Skip empty definitions
			if (trim($strDefinition) == '')
			{
				continue;
			}

			// Handle keywords, variables and functions (see #7448)
			if (strpos($strDefinition, 'important') !== false || strpos($strDefinition, 'transparent') !== false || strpos($strDefinition, 'inherit') !== false || strpos($strDefinition, '$') !== false || strpos($strDefinition, '(') !== false)
			{
				$arrSet['own'][] = $strDefinition;
				continue;
			}

			$arrChunks = array_map('trim', explode(':', $strDefinition, 2));
			$strKey = strtolower($arrChunks[0]);

			switch ($strKey)
			{
				case 'width':
				case 'height':
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strKey]['value'] = $varValue;
					$arrSet[$strKey]['unit'] = $strUnit;
					break;

				case 'min-width':
				case 'min-height':
					$strName = str_replace('-', '', $strKey);
					if ($arrChunks[1] == 'inherit')
					{
						$strUnit = '';
						$varValue = 'inherit';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strName]['value'] = $varValue;
					$arrSet[$strName]['unit'] = $strUnit;
					break;

				case 'max-width':
				case 'max-height':
					$strName = str_replace('-', '', $strKey);
					if ($arrChunks[1] == 'inherit' || $arrChunks[1] == 'none')
					{
						$strUnit = '';
						$varValue = $arrChunks[1];
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['size'] = 1;
					$arrSet[$strName]['value'] = $varValue;
					$arrSet[$strName]['unit'] = $strUnit;
					break;

				case 'top':
				case 'right':
				case 'bottom':
				case 'left':
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					elseif (isset($arrSet['trbl']['unit']))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['positioning'] = 1;
					$arrSet['trbl'][$strKey] = $varValue;
					if ($strUnit != '')
					{
						$arrSet['trbl']['unit'] = $strUnit;
					}
					break;

				case 'position':
				case 'overflow':
				case 'clear':
				case 'display':
					$arrSet['positioning'] = 1;
					$arrSet[$strKey] = $arrChunks[1];
					break;

				case 'float':
					$arrSet['positioning'] = 1;
					$arrSet['floating'] = $arrChunks[1];
					break;

				case 'margin':
				case 'padding':
					$arrSet['alignment'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$arrUnits = array();
					switch (\count($arrTRBL))
					{
						case 1:
							if ($arrTRBL[0] == 'auto')
							{
								$strUnit = '';
								$varValue = 'auto';
							}
							else
							{
								$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;

						case 2:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;

						case 3:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							if ($arrTRBL[2] == 'auto')
							{
								$varValue_3 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[2]);
								$varValue_3 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_3,
								'left' => $varValue_2,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;

						case 4:
							if ($arrTRBL[0] == 'auto')
							{
								$varValue_1 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
								$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							}
							if ($arrTRBL[1] == 'auto')
							{
								$varValue_2 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[1]);
								$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							}
							if ($arrTRBL[2] == 'auto')
							{
								$varValue_3 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[2]);
								$varValue_3 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]);
							}
							if ($arrTRBL[3] == 'auto')
							{
								$varValue_4 = 'auto';
							}
							else
							{
								$arrUnits[] = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[3]);
								$varValue_4 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]);
							}
							// Move to custom section if there are different units
							if (\count(array_filter(array_unique($arrUnits))) > 1)
							{
								$arrSet['alignment'] = '';
								$arrSet['own'][] = $strDefinition;
								break;
							}
							$arrSet[$strKey] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_3,
								'left' => $varValue_4,
								'unit' => ''
							);
							// Overwrite the unit
							foreach ($arrUnits as $strUnit)
							{
								if ($strUnit != '')
								{
									$arrSet[$strKey]['unit'] = $strUnit;
									break;
								}
							}
							break;
					}
					break;

				case 'margin-top':
				case 'margin-right':
				case 'margin-bottom':
				case 'margin-left':
					$arrSet['alignment'] = 1;
					$strName = str_replace('margin-', '', $strKey);
					if ($arrChunks[1] == 'auto')
					{
						$strUnit = '';
						$varValue = 'auto';
					}
					else
					{
						$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
						$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					}
					$arrSet['margin'][$strName] = $varValue;
					if (empty($arrSet['margin']['unit']))
					{
						$arrSet['margin']['unit'] = $strUnit;
					}
					break;

				case 'padding-top':
				case 'padding-right':
				case 'padding-bottom':
				case 'padding-left':
					$arrSet['alignment'] = 1;
					$strName = str_replace('padding-', '', $strKey);
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrChunks[1]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1]);
					$arrSet['padding'][$strName] = $varValue;
					$arrSet['padding']['unit'] = $strUnit;
					break;

				case 'align':
				case 'text-align':
				case 'vertical-align':
				case 'white-space':
					$arrSet['alignment'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'background-color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['background'] = 1;
						$arrSet['bgcolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'background-image':
					$url = preg_replace('/url\(["\']?([^"\')]+)["\']?\)/i', '$1', $arrChunks[1]);

					if (strncmp($url, '-', 1) === 0)
					{
						// Ignore vendor prefixed commands
					}
					elseif (strncmp($url, 'radial-gradient', 15) === 0)
					{
						$arrSet['own'][] = $strDefinition; // radial gradients (see #4640)
					}
					else
					{
						$arrSet['background'] = 1;

						// Handle linear gradients (see #4640)
						if (strncmp($url, 'linear-gradient', 15) === 0)
						{
							$colors = StringUtil::trimsplit(',', preg_replace('/linear-gradient ?\(([^\)]+)\)/', '$1', $url));
							$arrSet['gradientAngle'] = array_shift($colors);
							$arrSet['gradientColors'] = serialize($colors);
						}
						else
						{
							$arrSet['bgimage'] = $url;
						}
					}
					break;

				case 'background-position':
					$arrSet['background'] = 1;
					if (preg_match('/[0-9]+/', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['bgposition'] = $arrChunks[1];
					}
					break;

				case 'background-repeat':
					$arrSet['background'] = 1;
					$arrSet['bgrepeat'] = $arrChunks[1];
					break;

				case 'border':
					if ($arrChunks[1] == 'none')
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrWSC = preg_split('/\s+/', $arrChunks[1]);
					if ($arrWSC[2] != '' && !preg_match('/^#[a-f0-9]+$/i', $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['border'] = 1;
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrWSC[0]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrWSC[0]);
					$arrSet['borderwidth'] = array
					(
						'top' => $varValue,
						'right' => $varValue,
						'bottom' => $varValue,
						'left' => $varValue,
						'unit' => $strUnit
					);
					if ($arrWSC[1] != '')
					{
						$arrSet['borderstyle'] = $arrWSC[1];
					}
					if ($arrWSC[2] != '')
					{
						$arrSet['bordercolor'] = str_replace('#', '', $arrWSC[2]);
					}
					break;

				case 'border-top':
				case 'border-right':
				case 'border-bottom':
				case 'border-left':
					if ($arrChunks[1] == 'none')
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrWSC = preg_split('/\s+/', $arrChunks[1]);
					if ($arrWSC[2] != '' && !preg_match('/^#[a-f0-9]+$/i', $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['border'] = 1;
					$strName = str_replace('border-', '', $strKey);
					$varValue = preg_replace('/[^0-9.-]+/', '', $arrWSC[0]);
					$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrWSC[0]);
					if ((isset($arrSet['borderwidth']['unit']) && $arrSet['borderwidth']['unit'] != $strUnit) || ($arrWSC[1] != '' && isset($arrSet['borderstyle']) && $arrSet['borderstyle'] != $arrWSC[1]) || ($arrWSC[2] != '' && isset($arrSet['bordercolor']) && $arrSet['bordercolor'] != $arrWSC[2]))
					{
						$arrSet['own'][] = $strDefinition;
						break;
					}
					$arrSet['borderwidth'][$strName] = preg_replace('/[^0-9.-]+/', '', $varValue);
					$arrSet['borderwidth']['unit'] = $strUnit;
					if ($arrWSC[1] != '')
					{
						$arrSet['borderstyle'] = $arrWSC[1];
					}
					if ($arrWSC[2] != '')
					{
						$arrSet['bordercolor'] = str_replace('#', '', $arrWSC[2]);
					}
					break;

				case 'border-width':
					$arrSet['border'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$strUnit = '';
					foreach ($arrTRBL as $v)
					{
						if ($v != 0)
						{
							$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
						}
					}
					switch (\count($arrTRBL))
					{
						case 1:
							$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$arrSet['borderwidth'] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;
						case 2:
							$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							$arrSet['borderwidth'] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => $strUnit
							);
							break;
						case 4:
							$arrSet['borderwidth'] = array
							(
								'top' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]),
								'right' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]),
								'bottom' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]),
								'left' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]),
								'unit' => $strUnit
							);
							break;
					}
					break;

				case 'border-color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['border'] = 1;
						$arrSet['bordercolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'border-radius':
					$arrSet['border'] = 1;
					$arrTRBL = preg_split('/\s+/', $arrChunks[1]);
					$strUnit = '';
					foreach ($arrTRBL as $v)
					{
						if ($v != 0)
						{
							$strUnit = preg_replace('/[^acehimnprtvwx%]/', '', $arrTRBL[0]);
						}
					}
					switch (\count($arrTRBL))
					{
						case 1:
							$varValue = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$arrSet['borderradius'] = array
							(
								'top' => $varValue,
								'right' => $varValue,
								'bottom' => $varValue,
								'left' => $varValue,
								'unit' => $strUnit
							);
							break;
						case 2:
							$varValue_1 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]);
							$varValue_2 = preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]);
							$arrSet['borderradius'] = array
							(
								'top' => $varValue_1,
								'right' => $varValue_2,
								'bottom' => $varValue_1,
								'left' => $varValue_2,
								'unit' => $strUnit
							);
							break;
						case 4:
							$arrSet['borderradius'] = array
							(
								'top' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[0]),
								'right' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[1]),
								'bottom' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[2]),
								'left' => preg_replace('/[^0-9.-]+/', '', $arrTRBL[3]),
								'unit' => $strUnit
							);
							break;
					}
					break;

				case '-moz-border-radius':
				case '-webkit-border-radius':
					// Ignore
					break;

				case 'border-style':
				case 'border-collapse':
					$arrSet['border'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'border-spacing':
					$arrSet['border'] = 1;
					$arrSet['borderspacing'] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'font-family':
					$arrSet['font'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'font-size':
					if (!preg_match('/[0-9]+/', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['font'] = 1;
						$arrSet['fontsize'] = array
						(
							'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
							'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
						);
					}
					break;

				case 'font-weight':
					if ($arrChunks[1] == 'bold' || $arrChunks[1] == 'normal')
					{
						$arrSet['font'] = 1;
						$arrSet['fontstyle'][] = $arrChunks[1];
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'font-style':
					if ($arrChunks[1] == 'italic')
					{
						$arrSet['font'] = 1;
						$arrSet['fontstyle'][] = 'italic';
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'text-decoration':
					$arrSet['font'] = 1;
					switch ($arrChunks[1])
					{
						case 'underline':
							$arrSet['fontstyle'][] = 'underline';
							break;

						case 'none':
							$arrSet['fontstyle'][] = 'notUnderlined';
							break;

						case 'overline':
						case 'line-through':
							$arrSet['fontstyle'][] = $arrChunks[1];
							break;
					}
					break;

				case 'font-variant':
					$arrSet['font'] = 1;
					if ($arrChunks[1] == 'small-caps')
					{
						$arrSet['fontstyle'][] = 'small-caps';
					}
					else
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;

				case 'color':
					if (!preg_match('/^#[a-f0-9]+$/i', $arrChunks[1]))
					{
						$arrSet['own'][] = $strDefinition;
					}
					else
					{
						$arrSet['font'] = 1;
						$arrSet['fontcolor'] = str_replace('#', '', $arrChunks[1]);
					}
					break;

				case 'line-height':
					$arrSet['font'] = 1;
					$arrSet['lineheight'] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'text-transform':
					$arrSet['font'] = 1;
					$arrSet['texttransform'] = $arrChunks[1];
					break;

				case 'text-indent':
				case 'letter-spacing':
				case 'word-spacing':
					$strName = str_replace('-', '', $strKey);
					$arrSet['font'] = 1;
					$arrSet[$strName] = array
					(
						'value' => preg_replace('/[^0-9.-]+/', '', $arrChunks[1]),
						'unit' => preg_replace('/[^acehimnprtvwx%]/', '', $arrChunks[1])
					);
					break;

				case 'list-style-type':
					$arrSet['list'] = 1;
					$arrSet[str_replace('-', '', $strKey)] = $arrChunks[1];
					break;

				case 'list-style-image':
					$arrSet['list'] = 1;
					$arrSet['liststyleimage'] = preg_replace('/url\(["\']?([^"\')]+)["\']?\)/i', '$1', $arrChunks[1]);
					break;

				case 'behavior':
					$arrSet['own'][] = $strDefinition;
					break;

				default:
					$blnIsOwn = true;

					// Allow custom definitions
					if (isset($GLOBALS['TL_HOOKS']['createDefinition']) && \is_array($GLOBALS['TL_HOOKS']['createDefinition']))
					{
						foreach ($GLOBALS['TL_HOOKS']['createDefinition'] as $callback)
						{
							$this->import($callback[0]);
							$arrTemp = $this->{$callback[0]}->{$callback[1]}($strKey, $arrChunks[1], $strDefinition, $arrSet);

							if ($arrTemp && \is_array($arrTemp))
							{
								$blnIsOwn = false;
								$arrSet = array_merge($arrSet, $arrTemp);
							}
						}
					}

					// Unknown definition
					if ($blnIsOwn)
					{
						$arrSet['own'][] = $strDefinition;
					}
					break;
			}
		}

		if (!empty($arrSet['own']))
		{
			$arrSet['own'] = implode(";\n", $arrSet['own']) . ';';
		}

		$this->Database->prepare("INSERT INTO tl_style %s")->set($arrSet)->execute();
	}
Create a format definition and insert it into the database

@param array $arrDefinition