You are here

function minifyhtml_placeholder_callback_style in Minify Source HTML 7

Helper function to add place holder for <style> tag.

Parameters

array $matches: Matches from initial preg_replace().

Return value

string The placeholder string.

File

./minifyhtml.module, line 308
Hook and helper functions for the Minify HTML module.

Code

function minifyhtml_placeholder_callback_style(array $matches) {
  $search = array();
  $replace = array();

  // Only strip multi-line comments in <style> if required.
  if (variable_get('minifyhtml_strip_comments', TRUE)) {
    $search[] = '!/\\*.*?\\*/!s';
    $replace[] = '';
  }

  // Trim each line.
  $search[] = '/^\\s+|\\s+$/m';
  $replace[] = '';
  $style = preg_replace($search, $replace, $matches[0]);
  return minifyhtml_placeholder_replace(trim($style));
}