function advagg_js_compress_jsminplus

cis7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)
cle7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)
elmsmedia7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)
icor7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)
meedjum_blog7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)
mooc7 advagg_js_compress.advagg.inc advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE)

Compress a JS string using jsmin+.

Parameters

string $contents: Javascript string.

bool $log_errors: FALSE to disable logging to watchdog on failure.

1 call to advagg_js_compress_jsminplus()
advagg_js_compress_prep in sites/all/modules/ulmus/advagg/advagg_js_compress/advagg_js_compress.advagg.inc
Compress a JS string.

File

sites/all/modules/ulmus/advagg/advagg_js_compress/advagg_js_compress.advagg.inc, line 248
Advanced CSS/JS aggregation js compression module.

Code

function advagg_js_compress_jsminplus(&$contents, $log_errors = TRUE) {
  $contents_before = $contents;

  // Only include jsminplus.inc if the JSMinPlus class doesn't exist.
  if (!class_exists('JSMinPlus')) {
    include drupal_get_path('module', 'advagg_js_compress') . '/jsminplus.inc';
  }
  ob_start();
  try {
    // JSMin+ the contents of the aggregated file.
    $contents = JSMinPlus::minify($contents);

    // Capture any output from JSMinPlus.
    $error = trim(ob_get_contents());
    if (!empty($error)) {
      throw new Exception($error);
    }
  }
  catch (Exception $e) {
    // Log the exception thrown by JSMin+ and roll back to uncompressed content.
    if ($log_errors) {
      watchdog('advagg_js_compress', $e->getMessage() . '<pre>' . $contents_before . '</pre>', NULL, WATCHDOG_WARNING);
    }
    $contents = $contents_before;
  }
  ob_end_clean();
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.