You are here

function minify_process_html in Minify 7

Implements hook_process_html()

File

./minify.module, line 104

Code

function minify_process_html(&$variables) {
  global $theme;
  $theme_default = variable_get('theme_default', null);

  /* Check Monify HTML is selected and it is for front end theme */
  if (intval(variable_get('minify_html', 0)) && $theme == $theme_default) {

    /* Constant used as replacement tag key in global placeholders array */
    define('REPLACEMENT_HASH', 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']));

    /* Get active theme regions */
    $visible_theme_region = system_region_list($theme_default, REGIONS_ALL);

    /* Add page region to array */
    $visible_theme_region = array_merge(array(
      'page' => 'Page',
      'page_top' => 'Page top',
      'page_bottom' => 'Page bottom',
    ), $visible_theme_region);

    /* Prase and check if region is exist then minify HTML */
    foreach ($visible_theme_region as $key => $value) {
      if (isset($variables[$key])) {
        $variables[$key] = _minify_html($variables[$key]);
      }
    }
  }
}