get(static::class, 'disable_flush_combined'); if (!$disabled) { self::delete_all_combined_files(); } } /** * Enable combining of css/javascript files. * * @param bool $enable */ public static function set_combined_files_enabled($enable) { self::backend()->setCombinedFilesEnabled($enable); } /** * Checks whether combining of css/javascript files is enabled. * * @return bool */ public static function get_combined_files_enabled() { return self::backend()->getCombinedFilesEnabled(); } /** * Set the relative folder e.g. 'assets' for where to store combined files * * @param string $folder Path to folder */ public static function set_combined_files_folder($folder) { self::backend()->setCombinedFilesFolder($folder); } /** * Set whether to add caching query params to the requests for file-based requirements. * Eg: themes/myTheme/js/main.js?m=123456789. The parameter is a timestamp generated by * filemtime. This has the benefit of allowing the browser to cache the URL infinitely, * while automatically busting this cache every time the file is changed. * * @param bool */ public static function set_suffix_requirements($var) { self::backend()->setSuffixRequirements($var); } /** * Check whether we want to suffix requirements * * @return bool */ public static function get_suffix_requirements() { return self::backend()->getSuffixRequirements(); } /** * Instance of the requirements for storage. You can create your own backend to change the * default JS and CSS inclusion behaviour. * * @var Requirements_Backend */ private static $backend = null; /** * @return Requirements_Backend */ public static function backend() { if (!self::$backend) { self::$backend = Requirements_Backend::create(); } return self::$backend; } /** * Setter method for changing the Requirements backend * * @param Requirements_Backend $backend */ public static function set_backend(Requirements_Backend $backend) { self::$backend = $backend; } /** * Register the given JavaScript file as required. * * @param string $file Relative to docroot * @param array $options List of options. Available options include: * - 'provides' : List of scripts files included in this file * - 'async' : Boolean value to set async attribute to script tag * - 'defer' : Boolean value to set defer attribute to script tag */ public static function javascript($file, $options = array()) { self::backend()->javascript($file, $options); } /** * Register the given JavaScript code into the list of requirements * * @param string $script The script content as a string (without enclosing