You are here

function minifyhtml_minify_callback in Minify Source HTML 7

Helper function to catch any errors with preg_replace().

Parameters

string $pattern: The pattern for the search.

string $callback: The callback function to use.

string $content: The subject of the search.

Return value

string The content with placeholders.

1 call to minifyhtml_minify_callback()
minifyhtml_minify in ./minifyhtml.module
Helper function to minify HTML.

File

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

Code

function minifyhtml_minify_callback($pattern, $callback, $content) {
  $content = preg_replace_callback($pattern, $callback, $content);
  $error = preg_last_error();
  if ($error > PREG_NO_ERROR) {
    watchdog('minifyhtml', 'Preg error. The error code is %error. You can view what this error code is by viewing http://php.net/manual/en/function.preg-last-error.php', array(
      '%error' => $error,
    ));
  }
  return $content;
}