core-bundle/src/Resources/contao/classes/StyleSheets.php
public function compileDefinition($row, $blnWriteToFile=false, $vars=array(), $parent=array(), $export=false)
	{
		if ($blnWriteToFile)
		{
			$strGlue = '../../';
			$lb = '';
			$return = '';
		}
		elseif ($export)
		{
			$strGlue = '';
			$lb = "\n    ";
			$return = '';
		}
		else
		{
			$strGlue = '';
			$lb = "\n    ";
			$return = "\n" . '<pre'. ($row['invisible'] ? ' class="disabled"' : '') .'>';
		}

		// Comment
		if ((!$blnWriteToFile || $export) && $row['comment'] != '')
		{
			$search = array('@^\s*/\*+@', '@\*+/\s*$@');
			$comment = preg_replace($search, '', $row['comment']);

			if ($export)
			{
				$return .= "\n/* " . $comment . " */\n";
			}
			else
			{
				$comment = wordwrap(trim($comment), 72);
				$return .= "\n" . '<span class="comment">' . $comment . '</span>' . "\n";
			}
		}

		// Selector
		$arrSelector = StringUtil::trimsplit(',', StringUtil::decodeEntities($row['selector']));
		$return .= implode(($blnWriteToFile ? ',' : ",\n"), $arrSelector) . ($blnWriteToFile ? '' : ' ') . '{';

		// Size
		if ($row['size'])
		{
			// Width
			$row['width'] = StringUtil::deserialize($row['width']);

			if (isset($row['width']['value']) && $row['width']['value'] != '')
			{
				$return .= $lb . 'width:' . $row['width']['value'] . (($row['width']['value'] == 'auto') ? '' : $row['width']['unit']) . ';';
			}

			// Height
			$row['height'] = StringUtil::deserialize($row['height']);

			if (isset($row['height']['value']) && $row['height']['value'] != '')
			{
				$return .= $lb . 'height:' . $row['height']['value'] . (($row['height']['value'] == 'auto') ? '' : $row['height']['unit']) . ';';
			}

			// Min-width
			$row['minwidth'] = StringUtil::deserialize($row['minwidth']);

			if (isset($row['minwidth']['value']) && $row['minwidth']['value'] != '')
			{
				$return .= $lb . 'min-width:' . $row['minwidth']['value'] . (($row['minwidth']['value'] == 'inherit') ? '' : $row['minwidth']['unit']) . ';';
			}

			// Min-height
			$row['minheight'] = StringUtil::deserialize($row['minheight']);

			if (isset($row['minheight']['value']) && $row['minheight']['value'] != '')
			{
				$return .= $lb . 'min-height:' . $row['minheight']['value'] . (($row['minheight']['value'] == 'inherit') ? '' : $row['minheight']['unit']) . ';';
			}

			// Max-width
			$row['maxwidth'] = StringUtil::deserialize($row['maxwidth']);

			if (isset($row['maxwidth']['value']) && $row['maxwidth']['value'] != '')
			{
				$return .= $lb . 'max-width:' . $row['maxwidth']['value'] . (($row['maxwidth']['value'] == 'inherit' || $row['maxwidth']['value'] == 'none') ? '' : $row['maxwidth']['unit']) . ';';
			}

			// Max-height
			$row['maxheight'] = StringUtil::deserialize($row['maxheight']);

			if (isset($row['maxheight']['value']) && $row['maxheight']['value'] != '')
			{
				$return .= $lb . 'max-height:' . $row['maxheight']['value'] . (($row['maxheight']['value'] == 'inherit' || $row['maxheight']['value'] == 'none') ? '' : $row['maxheight']['unit']) . ';';
			}
		}

		// Position
		if ($row['positioning'])
		{
			// Top/right/bottom/left
			$row['trbl'] = StringUtil::deserialize($row['trbl']);

			if (\is_array($row['trbl']))
			{
				foreach ($row['trbl'] as $k=>$v)
				{
					if ($v != '' && $k != 'unit')
					{
						$return .= $lb . $k . ':' . $v . (($v == 'auto' || $v === '0') ? '' : $row['trbl']['unit']) . ';';
					}
				}
			}

			// Position
			if ($row['position'] != '')
			{
				$return .= $lb . 'position:' . $row['position'] . ';';
			}

			// Overflow
			if ($row['overflow'] != '')
			{
				$return .= $lb . 'overflow:' . $row['overflow'] . ';';
			}

			// Float
			if ($row['floating'] != '')
			{
				$return .= $lb . 'float:' . $row['floating'] . ';';
			}

			// Clear
			if ($row['clear'] != '')
			{
				$return .= $lb . 'clear:' . $row['clear'] . ';';
			}

			// Display
			if ($row['display'] != '')
			{
				$return .= $lb . 'display:' . $row['display'] . ';';
			}
		}

		// Margin, padding and alignment
		if ($row['alignment'])
		{
			// Margin
			if ($row['margin'] != '' || $row['align'] != '')
			{
				$row['margin'] = StringUtil::deserialize($row['margin']);

				if (\is_array($row['margin']))
				{
					$top = $row['margin']['top'];
					$right = $row['margin']['right'];
					$bottom = $row['margin']['bottom'];
					$left = $row['margin']['left'];

					// Overwrite the left and right margin if an alignment is set
					if ($row['align'] != '')
					{
						if ($row['align'] == 'left' || $row['align'] == 'center')
						{
							$right = 'auto';
						}

						if ($row['align'] == 'right' || $row['align'] == 'center')
						{
							$left = 'auto';
						}
					}

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ' ' . $bottom . (($bottom == 'auto' || $bottom === '0') ? '' : $row['margin']['unit']) . ';';
						}
						else
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ' ' . $bottom . (($bottom == 'auto' || $bottom === '0') ? '' : $row['margin']['unit']) . ' ' . $left . (($left == 'auto' || $left === '0') ? '' : $row['margin']['unit']) . ';';
						}
					}
					else
					{
						$arrDir = compact('top', 'right', 'bottom', 'left');

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'margin-' . $k . ':' . $v . (($v == 'auto' || $v === '0') ? '' : $row['margin']['unit']) . ';';
							}
						}
					}
				}
			}

			// Padding
			if ($row['padding'] != '')
			{
				$row['padding'] = StringUtil::deserialize($row['padding']);

				if (\is_array($row['padding']))
				{
					$top = $row['padding']['top'];
					$right = $row['padding']['right'];
					$bottom = $row['padding']['bottom'];
					$left = $row['padding']['left'];

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['padding']['unit']) . ';';
						}
						else
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['padding']['unit']) . ' ' . $left . (($left === '0') ? '' : $row['padding']['unit']) . ';';
						}
					}
					else
					{
						$arrDir = compact('top', 'right', 'bottom', 'left');

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'padding-' . $k . ':' . $v . (($v === '0') ? '' : $row['padding']['unit']) . ';';
							}
						}
					}
				}
			}

			// Vertical alignment
			if ($row['verticalalign'] != '')
			{
				$return .= $lb . 'vertical-align:' . $row['verticalalign'] . ';';
			}

			// Text alignment
			if ($row['textalign'] != '')
			{
				$return .= $lb . 'text-align:' . $row['textalign'] . ';';
			}

			// White space
			if ($row['whitespace'] != '')
			{
				$return .= $lb . 'white-space:' . $row['whitespace'] . ';';
			}
		}

		// Background
		if ($row['background'])
		{
			$bgColor = StringUtil::deserialize($row['bgcolor'], true);

			// Try to shorten the definition
			if ($bgColor[0] != '' && $row['bgimage'] != '' && $row['bgposition'] != '' && $row['bgrepeat'] != '')
			{
				if (($strImage = $this->generateBase64Image($row['bgimage'], $parent)) !== false)
				{
					$return .= $lb . 'background:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ' url("' . $strImage . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ';';
				}
				else
				{
					$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
					$return .= $lb . 'background:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ' url("' . $glue . $row['bgimage'] . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ';';
				}
			}
			else
			{
				// Background color
				if ($bgColor[0] != '')
				{
					$return .= $lb . 'background-color:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ';';
				}

				// Background image
				if ($row['bgimage'] == 'none')
				{
					$return .= $lb . 'background-image:none;';
				}
				elseif ($row['bgimage'] != '')
				{
					if (($strImage = $this->generateBase64Image($row['bgimage'], $parent)) !== false)
					{
						$return .= $lb . 'background-image:url("' . $strImage . '");';
					}
					else
					{
						$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
						$return .= $lb . 'background-image:url("' . $glue . $row['bgimage'] . '");';
					}
				}

				// Background position
				if ($row['bgposition'] != '')
				{
					$return .= $lb . 'background-position:' .$row['bgposition']. ';';
				}

				// Background repeat
				if ($row['bgrepeat'] != '')
				{
					$return .= $lb . 'background-repeat:' .$row['bgrepeat']. ';';
				}
			}

			// Background gradient
			if ($row['gradientAngle'] != '' && $row['gradientColors'] != '')
			{
				$row['gradientColors'] = StringUtil::deserialize($row['gradientColors']);

				if (\is_array($row['gradientColors']) && \count(array_filter($row['gradientColors'])) > 0)
				{
					$bgImage = '';

					// CSS3 PIE only supports -pie-background, so if there is a background image, include it here, too.
					if ($row['bgimage'] != '' && $row['bgposition'] != '' && $row['bgrepeat'] != '')
					{
						$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
						$bgImage = 'url("' . $glue . $row['bgimage'] . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ',';
					}

					// Default starting point
					if ($row['gradientAngle'] == '')
					{
						$row['gradientAngle'] = 'to top';
					}

					$row['gradientColors'] = array_values(array_filter($row['gradientColors']));

					// Add a hash tag to the color values
					foreach ($row['gradientColors'] as $k=>$v)
					{
						$row['gradientColors'][$k] = '#' . $v;
					}

					$angle = '';

					// Convert the angle for the legacy commands (see #4569)
					if (strpos($row['gradientAngle'], 'deg') !== false)
					{
						$angle = (abs((int) $row['gradientAngle'] - 450) % 360) . 'deg';
					}
					else
					{
						switch ($row['gradientAngle'])
						{
							case 'to top':          $angle = 'bottom';       break;
							case 'to right':        $angle = 'left';         break;
							case 'to bottom':       $angle = 'top';          break;
							case 'to left':         $angle = 'right';        break;
							case 'to top left':     $angle = 'bottom right'; break;
							case 'to top right':    $angle = 'bottom left';  break;
							case 'to bottom left':  $angle = 'top right';    break;
							case 'to bottom right': $angle = 'top left';     break;
						}
					}

					$colors = implode(',', $row['gradientColors']);

					$legacy = $angle . ',' . $colors;
					$gradient = $row['gradientAngle'] . ',' . $colors;

					$return .= $lb . 'background:' . $bgImage . '-moz-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-webkit-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-o-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-ms-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . 'linear-gradient(' . $gradient . ');';
					$return .= $lb . '-pie-background:' . $bgImage . 'linear-gradient(' . $legacy . ');';
				}
			}

			// Box shadow
			if ($row['shadowsize'] != '')
			{
				$shColor = StringUtil::deserialize($row['shadowcolor'], true);
				$row['shadowsize'] = StringUtil::deserialize($row['shadowsize']);

				if (\is_array($row['shadowsize']) && $row['shadowsize']['top'] != '' && $row['shadowsize']['right'] != '')
				{
					$offsetx = $row['shadowsize']['top'];
					$offsety = $row['shadowsize']['right'];
					$blursize = $row['shadowsize']['bottom'];
					$radius = $row['shadowsize']['left'];

					$shadow = $offsetx . (($offsetx === '0') ? '' : $row['shadowsize']['unit']);
					$shadow .= ' ' . $offsety . (($offsety === '0') ? '' : $row['shadowsize']['unit']);
					if ($blursize != '')
					{
						$shadow .= ' ' . $blursize . (($blursize === '0') ? '' : $row['shadowsize']['unit']);
					}
					if ($radius != '')
					{
						$shadow .= ' ' . $radius . (($radius === '0') ? '' : $row['shadowsize']['unit']);
					}
					if ($shColor[0] != '')
					{
						$shadow .= ' ' . $this->compileColor($shColor, $blnWriteToFile, $vars);
					}
					$shadow .= ';';

					// Prefix required in Safari <= 5 and Android
					$return .= $lb . '-webkit-box-shadow:' . $shadow;
					$return .= $lb . 'box-shadow:' . $shadow;
				}
			}
		}

		// Border
		if ($row['border'])
		{
			$bdColor = StringUtil::deserialize($row['bordercolor'], true);
			$row['borderwidth'] = StringUtil::deserialize($row['borderwidth']);

			// Border width
			if (\is_array($row['borderwidth']))
			{
				$top = $row['borderwidth']['top'];
				$right = $row['borderwidth']['right'];
				$bottom = $row['borderwidth']['bottom'];
				$left = $row['borderwidth']['left'];

				// Try to shorten the definition
				if ($top != '' && $right != '' && $bottom != '' && $left != '' && $top == $right && $top == $bottom && $top == $left)
				{
					$return .= $lb . 'border:' . $top . $row['borderwidth']['unit'] . (($row['borderstyle'] != '') ? ' ' .$row['borderstyle'] : '') . (($bdColor[0] != '') ? ' ' . $this->compileColor($bdColor, $blnWriteToFile, $vars) : '') . ';';
				}
				elseif ($top != '' && $right != '' && $bottom != '' && $left != '' && $top == $bottom && $left == $right)
				{
					$return .= $lb . 'border-width:' . $top . $row['borderwidth']['unit'] . ' ' . $right . $row['borderwidth']['unit'] . ';';

					if ($row['borderstyle'] != '')
					{
						$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
					}

					if ($bdColor[0] != '')
					{
						$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
					}
				}
				elseif ($top == '' && $right == '' && $bottom == '' && $left == '')
				{
					if ($row['borderstyle'] != '')
					{
						$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
					}

					if ($bdColor[0] != '')
					{
						$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
					}
				}
				else
				{
					$arrDir = compact('top', 'right', 'bottom', 'left');

					foreach ($arrDir as $k=>$v)
					{
						if ($v != '')
						{
							$return .= $lb . 'border-' . $k . ':' . $v . $row['borderwidth']['unit'] . (($row['borderstyle'] != '') ? ' ' . $row['borderstyle'] : '') . (($bdColor[0] != '') ? ' ' . $this->compileColor($bdColor, $blnWriteToFile, $vars) : '') . ';';
						}
					}
				}
			}
			else
			{
				if ($row['borderstyle'] != '')
				{
					$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
				}

				if ($bdColor[0] != '')
				{
					$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
				}
			}

			// Border radius
			if ($row['borderradius'] != '')
			{
				$row['borderradius'] = StringUtil::deserialize($row['borderradius']);

				if (\is_array($row['borderradius']) && ($row['borderradius']['top'] != '' || $row['borderradius']['right'] != '' || $row['borderradius']['bottom'] != '' || $row['borderradius']['left'] != ''))
				{
					$top = $row['borderradius']['top'];
					$right = $row['borderradius']['right'];
					$bottom = $row['borderradius']['bottom'];
					$left = $row['borderradius']['left'];
					$borderradius = '';

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						else
						{
							$borderradius .= $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['borderradius']['unit']) . ' ' . $left . (($left === '0') ? '' : $row['borderradius']['unit']) . ';';
						}

						$return .= $lb . 'border-radius:' . $borderradius;
					}
					else
					{
						$arrDir = array('top-left'=>$top, 'top-right'=>$right, 'bottom-right'=>$bottom, 'bottom-left'=>$left);

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'border-' . $k . '-radius:' . $v . (($v === '0') ? '' : $row['borderradius']['unit']) . ';';
							}
						}
					}
				}
			}

			// Border collapse
			if ($row['bordercollapse'] != '')
			{
				$return .= $lb . 'border-collapse:' . $row['bordercollapse'] . ';';
			}

			// Border spacing
			$row['borderspacing'] = StringUtil::deserialize($row['borderspacing']);

			if (isset($row['borderspacing']['value']) && $row['borderspacing']['value'] != '')
			{
				$return .= $lb . 'border-spacing:' . $row['borderspacing']['value'] . $row['borderspacing']['unit'] . ';';
			}
		}

		// Font
		if ($row['font'])
		{
			$row['fontsize'] = StringUtil::deserialize($row['fontsize']);
			$row['lineheight'] = StringUtil::deserialize($row['lineheight']);
			$row['fontfamily'] = str_replace(', ', ',', $row['fontfamily']);

			// Try to shorten the definition
			if ($row['fontfamily'] != '' && $row['fontfamily'] != 'inherit' && isset($row['fontsize']['value']) && $row['fontsize']['value'] != '' && $row['fontsize']['value'] != 'inherit')
			{
				$return .= $lb . 'font:' . $row['fontsize']['value'] . $row['fontsize']['unit'] . ((isset($row['lineheight']['value']) && $row['lineheight']['value'] != '') ? '/' . $row['lineheight']['value'] . $row['lineheight']['unit'] : '') . ' ' . $row['fontfamily'] . ';';
			}
			else
			{
				// Font family
				if ($row['fontfamily'] != '')
				{
					$return .= $lb . 'font-family:' . $row['fontfamily'] . ';';
				}

				// Font size
				if (isset($row['fontsize']['value']) && $row['fontsize']['value'] != '')
				{
					$return .= $lb . 'font-size:' . $row['fontsize']['value'] . $row['fontsize']['unit'] . ';';
				}

				// Line height
				if (isset($row['lineheight']['value']) && $row['lineheight']['value'] != '')
				{
					$return .= $lb . 'line-height:' . $row['lineheight']['value'] . $row['lineheight']['unit'] . ';';
				}
			}

			// Font style
			$row['fontstyle'] = StringUtil::deserialize($row['fontstyle']);

			if (\is_array($row['fontstyle']))
			{
				if (\in_array('bold', $row['fontstyle']))
				{
					$return .= $lb . 'font-weight:bold;';
				}

				if (\in_array('italic', $row['fontstyle']))
				{
					$return .= $lb . 'font-style:italic;';
				}

				if (\in_array('normal', $row['fontstyle']))
				{
					$return .= $lb . 'font-weight:normal;';
				}

				if (\in_array('underline', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:underline;';
				}

				if (\in_array('line-through', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:line-through;';
				}

				if (\in_array('overline', $row['fontstyle']))
				{
					$return .= $lb. 'text-decoration:overline;';
				}

				if (\in_array('notUnderlined', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:none;';
				}

				if (\in_array('small-caps', $row['fontstyle']))
				{
					$return .= $lb . 'font-variant:small-caps;';
				}
			}

			$fnColor = StringUtil::deserialize($row['fontcolor'], true);

			// Font color
			if ($fnColor[0] != '')
			{
				$return .= $lb . 'color:' . $this->compileColor($fnColor, $blnWriteToFile, $vars) . ';';
			}

			// Text transform
			if ($row['texttransform'] != '')
			{
				$return .= $lb . 'text-transform:' . $row['texttransform'] . ';';
			}

			// Text indent
			$row['textindent'] = StringUtil::deserialize($row['textindent']);

			if (isset($row['textindent']['value']) && $row['textindent']['value'] != '')
			{
				$return .= $lb . 'text-indent:' . $row['textindent']['value'] . $row['textindent']['unit'] . ';';
			}

			// Letter spacing
			$row['letterspacing'] = StringUtil::deserialize($row['letterspacing']);

			if (isset($row['letterspacing']['value']) && $row['letterspacing']['value'] != '')
			{
				$return .= $lb . 'letter-spacing:' . $row['letterspacing']['value'] . $row['letterspacing']['unit'] . ';';
			}

			// Word spacing
			$row['wordspacing'] = StringUtil::deserialize($row['wordspacing']);

			if (isset($row['wordspacing']['value']) && $row['wordspacing']['value'] != '')
			{
				$return .= $lb . 'word-spacing:' . $row['wordspacing']['value'] . $row['wordspacing']['unit'] . ';';
			}
		}

		// List
		if ($row['list'])
		{
			// List bullet
			if ($row['liststyletype'] != '')
			{
				$return .= $lb . 'list-style-type:' . $row['liststyletype'] . ';';
			}

			// List image
			if ($row['liststyleimage'] == 'none')
			{
				$return .= $lb . 'list-style-image:none;';
			}
			elseif ($row['liststyleimage'] != '')
			{
				if (($strImage = $this->generateBase64Image($row['liststyleimage'], $parent)) !== false)
				{
					$return .= $lb . 'list-style-image:url("' . $strImage . '");';
				}
				else
				{
					$glue = (strncmp($row['liststyleimage'], 'data:', 5) !== 0 && strncmp($row['liststyleimage'], 'http://', 7) !== 0 && strncmp($row['liststyleimage'], 'https://', 8) !== 0 && strncmp($row['liststyleimage'], '/', 1) !== 0) ? $strGlue : '';
					$return .= $lb . 'list-style-image:url("' . $glue . $row['liststyleimage'] . '");';
				}
			}
		}

		// Optimize floating-point numbers (see #6634)
		$return = preg_replace('/([^0-9.+-])0\.([0-9]+)/', '$1.$2', $return);

		// Custom code
		if ($row['own'] != '')
		{
			$own = trim(StringUtil::decodeEntities($row['own']));
			$own = preg_replace('/url\("(?!data:|\/)/', 'url("' . $strGlue, $own);
			$own = preg_split('/[\n\r]+/', $own);
			$own = implode(($blnWriteToFile ? '' : $lb), $own);
			$return .= $lb . ((!$blnWriteToFile && !$export) ? StringUtil::specialchars($own) : $own);
		}

		// Allow custom definitions
		if (isset($GLOBALS['TL_HOOKS']['compileDefinition']) && \is_array($GLOBALS['TL_HOOKS']['compileDefinition']))
		{
			foreach ($GLOBALS['TL_HOOKS']['compileDefinition'] as $callback)
			{
				$this->import($callback[0]);
				$strTemp = $this->{$callback[0]}->{$callback[1]}($row, $blnWriteToFile, $vars, $parent);

				if ($strTemp != '')
				{
					$return .= $lb . $strTemp;
				}
			}
		}

		// Close the format definition
		if ($blnWriteToFile)
		{
			// Remove the last semi-colon (;) before the closing bracket
			if (substr($return, -1) == ';')
			{
				$return = substr($return, 0, -1);
			}

			$return .= '}';
		}
		elseif ($export)
		{
			$return .= "\n}\n";
		}
		else
		{
			$return .= "\n}</pre>\n";
		}

		// Replace global variables
		if (strpos($return, '$') !== false && !empty($vars))
		{
			$return = str_replace(array_keys($vars), $vars, $return);
		}

		// Replace insert tags (see #5512)
		return $this->replaceInsertTags($return, false);
	}
public function compileDefinition($row, $blnWriteToFile=false, $vars=array(), $parent=array(), $export=false)
	{
		if ($blnWriteToFile)
		{
			$strGlue = '../../';
			$lb = '';
			$return = '';
		}
		elseif ($export)
		{
			$strGlue = '';
			$lb = "\n    ";
			$return = '';
		}
		else
		{
			$strGlue = '';
			$lb = "\n    ";
			$return = "\n" . '<pre'. ($row['invisible'] ? ' class="disabled"' : '') .'>';
		}

		// Comment
		if ((!$blnWriteToFile || $export) && $row['comment'] != '')
		{
			$search = array('@^\s*/\*+@', '@\*+/\s*$@');
			$comment = preg_replace($search, '', $row['comment']);

			if ($export)
			{
				$return .= "\n/* " . $comment . " */\n";
			}
			else
			{
				$comment = wordwrap(trim($comment), 72);
				$return .= "\n" . '<span class="comment">' . $comment . '</span>' . "\n";
			}
		}

		// Selector
		$arrSelector = StringUtil::trimsplit(',', StringUtil::decodeEntities($row['selector']));
		$return .= implode(($blnWriteToFile ? ',' : ",\n"), $arrSelector) . ($blnWriteToFile ? '' : ' ') . '{';

		// Size
		if ($row['size'])
		{
			// Width
			$row['width'] = StringUtil::deserialize($row['width']);

			if (isset($row['width']['value']) && $row['width']['value'] != '')
			{
				$return .= $lb . 'width:' . $row['width']['value'] . (($row['width']['value'] == 'auto') ? '' : $row['width']['unit']) . ';';
			}

			// Height
			$row['height'] = StringUtil::deserialize($row['height']);

			if (isset($row['height']['value']) && $row['height']['value'] != '')
			{
				$return .= $lb . 'height:' . $row['height']['value'] . (($row['height']['value'] == 'auto') ? '' : $row['height']['unit']) . ';';
			}

			// Min-width
			$row['minwidth'] = StringUtil::deserialize($row['minwidth']);

			if (isset($row['minwidth']['value']) && $row['minwidth']['value'] != '')
			{
				$return .= $lb . 'min-width:' . $row['minwidth']['value'] . (($row['minwidth']['value'] == 'inherit') ? '' : $row['minwidth']['unit']) . ';';
			}

			// Min-height
			$row['minheight'] = StringUtil::deserialize($row['minheight']);

			if (isset($row['minheight']['value']) && $row['minheight']['value'] != '')
			{
				$return .= $lb . 'min-height:' . $row['minheight']['value'] . (($row['minheight']['value'] == 'inherit') ? '' : $row['minheight']['unit']) . ';';
			}

			// Max-width
			$row['maxwidth'] = StringUtil::deserialize($row['maxwidth']);

			if (isset($row['maxwidth']['value']) && $row['maxwidth']['value'] != '')
			{
				$return .= $lb . 'max-width:' . $row['maxwidth']['value'] . (($row['maxwidth']['value'] == 'inherit' || $row['maxwidth']['value'] == 'none') ? '' : $row['maxwidth']['unit']) . ';';
			}

			// Max-height
			$row['maxheight'] = StringUtil::deserialize($row['maxheight']);

			if (isset($row['maxheight']['value']) && $row['maxheight']['value'] != '')
			{
				$return .= $lb . 'max-height:' . $row['maxheight']['value'] . (($row['maxheight']['value'] == 'inherit' || $row['maxheight']['value'] == 'none') ? '' : $row['maxheight']['unit']) . ';';
			}
		}

		// Position
		if ($row['positioning'])
		{
			// Top/right/bottom/left
			$row['trbl'] = StringUtil::deserialize($row['trbl']);

			if (\is_array($row['trbl']))
			{
				foreach ($row['trbl'] as $k=>$v)
				{
					if ($v != '' && $k != 'unit')
					{
						$return .= $lb . $k . ':' . $v . (($v == 'auto' || $v === '0') ? '' : $row['trbl']['unit']) . ';';
					}
				}
			}

			// Position
			if ($row['position'] != '')
			{
				$return .= $lb . 'position:' . $row['position'] . ';';
			}

			// Overflow
			if ($row['overflow'] != '')
			{
				$return .= $lb . 'overflow:' . $row['overflow'] . ';';
			}

			// Float
			if ($row['floating'] != '')
			{
				$return .= $lb . 'float:' . $row['floating'] . ';';
			}

			// Clear
			if ($row['clear'] != '')
			{
				$return .= $lb . 'clear:' . $row['clear'] . ';';
			}

			// Display
			if ($row['display'] != '')
			{
				$return .= $lb . 'display:' . $row['display'] . ';';
			}
		}

		// Margin, padding and alignment
		if ($row['alignment'])
		{
			// Margin
			if ($row['margin'] != '' || $row['align'] != '')
			{
				$row['margin'] = StringUtil::deserialize($row['margin']);

				if (\is_array($row['margin']))
				{
					$top = $row['margin']['top'];
					$right = $row['margin']['right'];
					$bottom = $row['margin']['bottom'];
					$left = $row['margin']['left'];

					// Overwrite the left and right margin if an alignment is set
					if ($row['align'] != '')
					{
						if ($row['align'] == 'left' || $row['align'] == 'center')
						{
							$right = 'auto';
						}

						if ($row['align'] == 'right' || $row['align'] == 'center')
						{
							$left = 'auto';
						}
					}

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ' ' . $bottom . (($bottom == 'auto' || $bottom === '0') ? '' : $row['margin']['unit']) . ';';
						}
						else
						{
							$return .= $lb . 'margin:' . $top . (($top == 'auto' || $top === '0') ? '' : $row['margin']['unit']) . ' ' . $right . (($right == 'auto' || $right === '0') ? '' : $row['margin']['unit']) . ' ' . $bottom . (($bottom == 'auto' || $bottom === '0') ? '' : $row['margin']['unit']) . ' ' . $left . (($left == 'auto' || $left === '0') ? '' : $row['margin']['unit']) . ';';
						}
					}
					else
					{
						$arrDir = compact('top', 'right', 'bottom', 'left');

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'margin-' . $k . ':' . $v . (($v == 'auto' || $v === '0') ? '' : $row['margin']['unit']) . ';';
							}
						}
					}
				}
			}

			// Padding
			if ($row['padding'] != '')
			{
				$row['padding'] = StringUtil::deserialize($row['padding']);

				if (\is_array($row['padding']))
				{
					$top = $row['padding']['top'];
					$right = $row['padding']['right'];
					$bottom = $row['padding']['bottom'];
					$left = $row['padding']['left'];

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['padding']['unit']) . ';';
						}
						else
						{
							$return .= $lb . 'padding:' . $top . (($top === '0') ? '' : $row['padding']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['padding']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['padding']['unit']) . ' ' . $left . (($left === '0') ? '' : $row['padding']['unit']) . ';';
						}
					}
					else
					{
						$arrDir = compact('top', 'right', 'bottom', 'left');

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'padding-' . $k . ':' . $v . (($v === '0') ? '' : $row['padding']['unit']) . ';';
							}
						}
					}
				}
			}

			// Vertical alignment
			if ($row['verticalalign'] != '')
			{
				$return .= $lb . 'vertical-align:' . $row['verticalalign'] . ';';
			}

			// Text alignment
			if ($row['textalign'] != '')
			{
				$return .= $lb . 'text-align:' . $row['textalign'] . ';';
			}

			// White space
			if ($row['whitespace'] != '')
			{
				$return .= $lb . 'white-space:' . $row['whitespace'] . ';';
			}
		}

		// Background
		if ($row['background'])
		{
			$bgColor = StringUtil::deserialize($row['bgcolor'], true);

			// Try to shorten the definition
			if ($bgColor[0] != '' && $row['bgimage'] != '' && $row['bgposition'] != '' && $row['bgrepeat'] != '')
			{
				if (($strImage = $this->generateBase64Image($row['bgimage'], $parent)) !== false)
				{
					$return .= $lb . 'background:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ' url("' . $strImage . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ';';
				}
				else
				{
					$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
					$return .= $lb . 'background:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ' url("' . $glue . $row['bgimage'] . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ';';
				}
			}
			else
			{
				// Background color
				if ($bgColor[0] != '')
				{
					$return .= $lb . 'background-color:' . $this->compileColor($bgColor, $blnWriteToFile, $vars) . ';';
				}

				// Background image
				if ($row['bgimage'] == 'none')
				{
					$return .= $lb . 'background-image:none;';
				}
				elseif ($row['bgimage'] != '')
				{
					if (($strImage = $this->generateBase64Image($row['bgimage'], $parent)) !== false)
					{
						$return .= $lb . 'background-image:url("' . $strImage . '");';
					}
					else
					{
						$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
						$return .= $lb . 'background-image:url("' . $glue . $row['bgimage'] . '");';
					}
				}

				// Background position
				if ($row['bgposition'] != '')
				{
					$return .= $lb . 'background-position:' .$row['bgposition']. ';';
				}

				// Background repeat
				if ($row['bgrepeat'] != '')
				{
					$return .= $lb . 'background-repeat:' .$row['bgrepeat']. ';';
				}
			}

			// Background gradient
			if ($row['gradientAngle'] != '' && $row['gradientColors'] != '')
			{
				$row['gradientColors'] = StringUtil::deserialize($row['gradientColors']);

				if (\is_array($row['gradientColors']) && \count(array_filter($row['gradientColors'])) > 0)
				{
					$bgImage = '';

					// CSS3 PIE only supports -pie-background, so if there is a background image, include it here, too.
					if ($row['bgimage'] != '' && $row['bgposition'] != '' && $row['bgrepeat'] != '')
					{
						$glue = (strncmp($row['bgimage'], 'data:', 5) !== 0 && strncmp($row['bgimage'], 'http://', 7) !== 0 && strncmp($row['bgimage'], 'https://', 8) !== 0 && strncmp($row['bgimage'], '/', 1) !== 0) ? $strGlue : '';
						$bgImage = 'url("' . $glue . $row['bgimage'] . '") ' . $row['bgposition'] . ' ' . $row['bgrepeat'] . ',';
					}

					// Default starting point
					if ($row['gradientAngle'] == '')
					{
						$row['gradientAngle'] = 'to top';
					}

					$row['gradientColors'] = array_values(array_filter($row['gradientColors']));

					// Add a hash tag to the color values
					foreach ($row['gradientColors'] as $k=>$v)
					{
						$row['gradientColors'][$k] = '#' . $v;
					}

					$angle = '';

					// Convert the angle for the legacy commands (see #4569)
					if (strpos($row['gradientAngle'], 'deg') !== false)
					{
						$angle = (abs((int) $row['gradientAngle'] - 450) % 360) . 'deg';
					}
					else
					{
						switch ($row['gradientAngle'])
						{
							case 'to top':          $angle = 'bottom';       break;
							case 'to right':        $angle = 'left';         break;
							case 'to bottom':       $angle = 'top';          break;
							case 'to left':         $angle = 'right';        break;
							case 'to top left':     $angle = 'bottom right'; break;
							case 'to top right':    $angle = 'bottom left';  break;
							case 'to bottom left':  $angle = 'top right';    break;
							case 'to bottom right': $angle = 'top left';     break;
						}
					}

					$colors = implode(',', $row['gradientColors']);

					$legacy = $angle . ',' . $colors;
					$gradient = $row['gradientAngle'] . ',' . $colors;

					$return .= $lb . 'background:' . $bgImage . '-moz-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-webkit-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-o-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . '-ms-linear-gradient(' . $legacy . ');';
					$return .= $lb . 'background:' . $bgImage . 'linear-gradient(' . $gradient . ');';
					$return .= $lb . '-pie-background:' . $bgImage . 'linear-gradient(' . $legacy . ');';
				}
			}

			// Box shadow
			if ($row['shadowsize'] != '')
			{
				$shColor = StringUtil::deserialize($row['shadowcolor'], true);
				$row['shadowsize'] = StringUtil::deserialize($row['shadowsize']);

				if (\is_array($row['shadowsize']) && $row['shadowsize']['top'] != '' && $row['shadowsize']['right'] != '')
				{
					$offsetx = $row['shadowsize']['top'];
					$offsety = $row['shadowsize']['right'];
					$blursize = $row['shadowsize']['bottom'];
					$radius = $row['shadowsize']['left'];

					$shadow = $offsetx . (($offsetx === '0') ? '' : $row['shadowsize']['unit']);
					$shadow .= ' ' . $offsety . (($offsety === '0') ? '' : $row['shadowsize']['unit']);
					if ($blursize != '')
					{
						$shadow .= ' ' . $blursize . (($blursize === '0') ? '' : $row['shadowsize']['unit']);
					}
					if ($radius != '')
					{
						$shadow .= ' ' . $radius . (($radius === '0') ? '' : $row['shadowsize']['unit']);
					}
					if ($shColor[0] != '')
					{
						$shadow .= ' ' . $this->compileColor($shColor, $blnWriteToFile, $vars);
					}
					$shadow .= ';';

					// Prefix required in Safari <= 5 and Android
					$return .= $lb . '-webkit-box-shadow:' . $shadow;
					$return .= $lb . 'box-shadow:' . $shadow;
				}
			}
		}

		// Border
		if ($row['border'])
		{
			$bdColor = StringUtil::deserialize($row['bordercolor'], true);
			$row['borderwidth'] = StringUtil::deserialize($row['borderwidth']);

			// Border width
			if (\is_array($row['borderwidth']))
			{
				$top = $row['borderwidth']['top'];
				$right = $row['borderwidth']['right'];
				$bottom = $row['borderwidth']['bottom'];
				$left = $row['borderwidth']['left'];

				// Try to shorten the definition
				if ($top != '' && $right != '' && $bottom != '' && $left != '' && $top == $right && $top == $bottom && $top == $left)
				{
					$return .= $lb . 'border:' . $top . $row['borderwidth']['unit'] . (($row['borderstyle'] != '') ? ' ' .$row['borderstyle'] : '') . (($bdColor[0] != '') ? ' ' . $this->compileColor($bdColor, $blnWriteToFile, $vars) : '') . ';';
				}
				elseif ($top != '' && $right != '' && $bottom != '' && $left != '' && $top == $bottom && $left == $right)
				{
					$return .= $lb . 'border-width:' . $top . $row['borderwidth']['unit'] . ' ' . $right . $row['borderwidth']['unit'] . ';';

					if ($row['borderstyle'] != '')
					{
						$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
					}

					if ($bdColor[0] != '')
					{
						$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
					}
				}
				elseif ($top == '' && $right == '' && $bottom == '' && $left == '')
				{
					if ($row['borderstyle'] != '')
					{
						$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
					}

					if ($bdColor[0] != '')
					{
						$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
					}
				}
				else
				{
					$arrDir = compact('top', 'right', 'bottom', 'left');

					foreach ($arrDir as $k=>$v)
					{
						if ($v != '')
						{
							$return .= $lb . 'border-' . $k . ':' . $v . $row['borderwidth']['unit'] . (($row['borderstyle'] != '') ? ' ' . $row['borderstyle'] : '') . (($bdColor[0] != '') ? ' ' . $this->compileColor($bdColor, $blnWriteToFile, $vars) : '') . ';';
						}
					}
				}
			}
			else
			{
				if ($row['borderstyle'] != '')
				{
					$return .= $lb . 'border-style:' . $row['borderstyle'] . ';';
				}

				if ($bdColor[0] != '')
				{
					$return .= $lb . 'border-color:' . $this->compileColor($bdColor, $blnWriteToFile, $vars) . ';';
				}
			}

			// Border radius
			if ($row['borderradius'] != '')
			{
				$row['borderradius'] = StringUtil::deserialize($row['borderradius']);

				if (\is_array($row['borderradius']) && ($row['borderradius']['top'] != '' || $row['borderradius']['right'] != '' || $row['borderradius']['bottom'] != '' || $row['borderradius']['left'] != ''))
				{
					$top = $row['borderradius']['top'];
					$right = $row['borderradius']['right'];
					$bottom = $row['borderradius']['bottom'];
					$left = $row['borderradius']['left'];
					$borderradius = '';

					// Try to shorten the definition
					if ($top != '' && $right != '' && $bottom != '' && $left != '')
					{
						if ($top == $right && $top == $bottom && $top == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						elseif ($top == $bottom && $right == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						elseif ($top != $bottom && $right == $left)
						{
							$borderradius = $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['borderradius']['unit']) . ';';
						}
						else
						{
							$borderradius .= $top . (($top === '0') ? '' : $row['borderradius']['unit']) . ' ' . $right . (($right === '0') ? '' : $row['borderradius']['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $row['borderradius']['unit']) . ' ' . $left . (($left === '0') ? '' : $row['borderradius']['unit']) . ';';
						}

						$return .= $lb . 'border-radius:' . $borderradius;
					}
					else
					{
						$arrDir = array('top-left'=>$top, 'top-right'=>$right, 'bottom-right'=>$bottom, 'bottom-left'=>$left);

						foreach ($arrDir as $k=>$v)
						{
							if ($v != '')
							{
								$return .= $lb . 'border-' . $k . '-radius:' . $v . (($v === '0') ? '' : $row['borderradius']['unit']) . ';';
							}
						}
					}
				}
			}

			// Border collapse
			if ($row['bordercollapse'] != '')
			{
				$return .= $lb . 'border-collapse:' . $row['bordercollapse'] . ';';
			}

			// Border spacing
			$row['borderspacing'] = StringUtil::deserialize($row['borderspacing']);

			if (isset($row['borderspacing']['value']) && $row['borderspacing']['value'] != '')
			{
				$return .= $lb . 'border-spacing:' . $row['borderspacing']['value'] . $row['borderspacing']['unit'] . ';';
			}
		}

		// Font
		if ($row['font'])
		{
			$row['fontsize'] = StringUtil::deserialize($row['fontsize']);
			$row['lineheight'] = StringUtil::deserialize($row['lineheight']);
			$row['fontfamily'] = str_replace(', ', ',', $row['fontfamily']);

			// Try to shorten the definition
			if ($row['fontfamily'] != '' && $row['fontfamily'] != 'inherit' && isset($row['fontsize']['value']) && $row['fontsize']['value'] != '' && $row['fontsize']['value'] != 'inherit')
			{
				$return .= $lb . 'font:' . $row['fontsize']['value'] . $row['fontsize']['unit'] . ((isset($row['lineheight']['value']) && $row['lineheight']['value'] != '') ? '/' . $row['lineheight']['value'] . $row['lineheight']['unit'] : '') . ' ' . $row['fontfamily'] . ';';
			}
			else
			{
				// Font family
				if ($row['fontfamily'] != '')
				{
					$return .= $lb . 'font-family:' . $row['fontfamily'] . ';';
				}

				// Font size
				if (isset($row['fontsize']['value']) && $row['fontsize']['value'] != '')
				{
					$return .= $lb . 'font-size:' . $row['fontsize']['value'] . $row['fontsize']['unit'] . ';';
				}

				// Line height
				if (isset($row['lineheight']['value']) && $row['lineheight']['value'] != '')
				{
					$return .= $lb . 'line-height:' . $row['lineheight']['value'] . $row['lineheight']['unit'] . ';';
				}
			}

			// Font style
			$row['fontstyle'] = StringUtil::deserialize($row['fontstyle']);

			if (\is_array($row['fontstyle']))
			{
				if (\in_array('bold', $row['fontstyle']))
				{
					$return .= $lb . 'font-weight:bold;';
				}

				if (\in_array('italic', $row['fontstyle']))
				{
					$return .= $lb . 'font-style:italic;';
				}

				if (\in_array('normal', $row['fontstyle']))
				{
					$return .= $lb . 'font-weight:normal;';
				}

				if (\in_array('underline', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:underline;';
				}

				if (\in_array('line-through', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:line-through;';
				}

				if (\in_array('overline', $row['fontstyle']))
				{
					$return .= $lb. 'text-decoration:overline;';
				}

				if (\in_array('notUnderlined', $row['fontstyle']))
				{
					$return .= $lb . 'text-decoration:none;';
				}

				if (\in_array('small-caps', $row['fontstyle']))
				{
					$return .= $lb . 'font-variant:small-caps;';
				}
			}

			$fnColor = StringUtil::deserialize($row['fontcolor'], true);

			// Font color
			if ($fnColor[0] != '')
			{
				$return .= $lb . 'color:' . $this->compileColor($fnColor, $blnWriteToFile, $vars) . ';';
			}

			// Text transform
			if ($row['texttransform'] != '')
			{
				$return .= $lb . 'text-transform:' . $row['texttransform'] . ';';
			}

			// Text indent
			$row['textindent'] = StringUtil::deserialize($row['textindent']);

			if (isset($row['textindent']['value']) && $row['textindent']['value'] != '')
			{
				$return .= $lb . 'text-indent:' . $row['textindent']['value'] . $row['textindent']['unit'] . ';';
			}

			// Letter spacing
			$row['letterspacing'] = StringUtil::deserialize($row['letterspacing']);

			if (isset($row['letterspacing']['value']) && $row['letterspacing']['value'] != '')
			{
				$return .= $lb . 'letter-spacing:' . $row['letterspacing']['value'] . $row['letterspacing']['unit'] . ';';
			}

			// Word spacing
			$row['wordspacing'] = StringUtil::deserialize($row['wordspacing']);

			if (isset($row['wordspacing']['value']) && $row['wordspacing']['value'] != '')
			{
				$return .= $lb . 'word-spacing:' . $row['wordspacing']['value'] . $row['wordspacing']['unit'] . ';';
			}
		}

		// List
		if ($row['list'])
		{
			// List bullet
			if ($row['liststyletype'] != '')
			{
				$return .= $lb . 'list-style-type:' . $row['liststyletype'] . ';';
			}

			// List image
			if ($row['liststyleimage'] == 'none')
			{
				$return .= $lb . 'list-style-image:none;';
			}
			elseif ($row['liststyleimage'] != '')
			{
				if (($strImage = $this->generateBase64Image($row['liststyleimage'], $parent)) !== false)
				{
					$return .= $lb . 'list-style-image:url("' . $strImage . '");';
				}
				else
				{
					$glue = (strncmp($row['liststyleimage'], 'data:', 5) !== 0 && strncmp($row['liststyleimage'], 'http://', 7) !== 0 && strncmp($row['liststyleimage'], 'https://', 8) !== 0 && strncmp($row['liststyleimage'], '/', 1) !== 0) ? $strGlue : '';
					$return .= $lb . 'list-style-image:url("' . $glue . $row['liststyleimage'] . '");';
				}
			}
		}

		// Optimize floating-point numbers (see #6634)
		$return = preg_replace('/([^0-9.+-])0\.([0-9]+)/', '$1.$2', $return);

		// Custom code
		if ($row['own'] != '')
		{
			$own = trim(StringUtil::decodeEntities($row['own']));
			$own = preg_replace('/url\("(?!data:|\/)/', 'url("' . $strGlue, $own);
			$own = preg_split('/[\n\r]+/', $own);
			$own = implode(($blnWriteToFile ? '' : $lb), $own);
			$return .= $lb . ((!$blnWriteToFile && !$export) ? StringUtil::specialchars($own) : $own);
		}

		// Allow custom definitions
		if (isset($GLOBALS['TL_HOOKS']['compileDefinition']) && \is_array($GLOBALS['TL_HOOKS']['compileDefinition']))
		{
			foreach ($GLOBALS['TL_HOOKS']['compileDefinition'] as $callback)
			{
				$this->import($callback[0]);
				$strTemp = $this->{$callback[0]}->{$callback[1]}($row, $blnWriteToFile, $vars, $parent);

				if ($strTemp != '')
				{
					$return .= $lb . $strTemp;
				}
			}
		}

		// Close the format definition
		if ($blnWriteToFile)
		{
			// Remove the last semi-colon (;) before the closing bracket
			if (substr($return, -1) == ';')
			{
				$return = substr($return, 0, -1);
			}

			$return .= '}';
		}
		elseif ($export)
		{
			$return .= "\n}\n";
		}
		else
		{
			$return .= "\n}</pre>\n";
		}

		// Replace global variables
		if (strpos($return, '$') !== false && !empty($vars))
		{
			$return = str_replace(array_keys($vars), $vars, $return);
		}

		// Replace insert tags (see #5512)
		return $this->replaceInsertTags($return, false);
	}
Compile format definitions and return them as string

@param array   $row
@param boolean $blnWriteToFile
@param array   $vars
@param array   $parent
@param boolean $export

@return string