File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4929,6 +4929,10 @@ function drupal_build_js_cache($files) {
49294929 $ contents .= file_get_contents ($ path ) . "; \n" ;
49304930 }
49314931 }
4932+
4933+ // Allow modules to act on the js_cche before writing to disk.
4934+ drupal_alter ('js_cache ' , $ contents );
4935+
49324936 // Prefix filename to prevent blocking by firewalls which reject files
49334937 // starting with "ad*".
49344938 $ filename = 'js_ ' . drupal_hash_base64 ($ contents ) . '.js ' ;
Original file line number Diff line number Diff line change @@ -744,6 +744,26 @@ function hook_js_alter(&$javascript) {
744744 $ javascript ['misc/jquery.js ' ]['data ' ] = drupal_get_path ('module ' , 'jquery_update ' ) . '/jquery.js ' ;
745745}
746746
747+ /**
748+ * Perform necessary alterations to the concatenated JavaScript before it is
749+ * presented on the page.
750+ *
751+ * @param $contents
752+ * A string of the concatenated JavaScript.
753+ *
754+ * @see drupal_build_js_cache()
755+ */
756+ function hook_js_cache_alter (&$ contents ) {
757+ $ header = <<<HEADER
758+ /**
759+ * Powered by Pressflow
760+ * http://pressflow.org
761+ */
762+ HEADER ;
763+
764+ $ contents = $ header . "\n" . $ contents ;
765+ }
766+
747767/**
748768 * Registers JavaScript/CSS libraries associated with a module.
749769 *
You can’t perform that action at this time.
0 commit comments