From 8727f27f2a514e3d6d237eb4a199b7e855bd5f7a Mon Sep 17 00:00:00 2001 From: Nik Rolls Date: Wed, 29 Apr 2015 20:17:08 +1200 Subject: [PATCH] Documentation tidy for Requirements.php Documentation-only changes, except where a couple of methods have been moved to live next to other related functions. --- view/Requirements.php | 734 ++++++++++++++++++++++++------------------ 1 file changed, 416 insertions(+), 318 deletions(-) diff --git a/view/Requirements.php b/view/Requirements.php index 932dbe9d6..c87d72cb5 100644 --- a/view/Requirements.php +++ b/view/Requirements.php @@ -1,8 +1,7 @@ set_combined_files_enabled($enable); @@ -26,14 +26,16 @@ class Requirements implements Flushable { /** * Checks whether combining of css/javascript files is enabled. - * @return boolean + * + * @return bool */ public static function get_combined_files_enabled() { return self::backend()->get_combined_files_enabled(); } /** - * Set the relative folder e.g. "assets" for where to store combined files + * 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) { @@ -41,8 +43,10 @@ class Requirements implements Flushable { } /** - * Set whether we want to suffix requirements with the time / - * location on to the requirements + * 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 */ @@ -51,7 +55,7 @@ class Requirements implements Flushable { } /** - * Return whether we want to suffix requirements + * Check whether we want to suffix requirements * * @return bool */ @@ -60,9 +64,10 @@ class Requirements implements Flushable { } /** - * Instance of requirements for storage + * Instance of the requirements for storage. You can create your own backend to change the + * default JS and CSS inclusion behaviour. * - * @var Requirements + * @var Requirements_Backend */ private static $backend = null; @@ -76,74 +81,78 @@ class Requirements implements Flushable { /** * Setter method for changing the Requirements backend * - * @param Requirements $backend + * @param Requirements_Backend $backend */ public static function set_backend(Requirements_Backend $backend) { self::$backend = $backend; } /** - * Register the given javascript file as required. - * - * See {@link Requirements_Backend::javascript()} for more info - * + * Register the given JavaScript file as required. + * + * @param string $file Relative to docroot */ public static function javascript($file) { self::backend()->javascript($file); } /** - * Add the javascript code to the header of the page + * Register the given JavaScript code into the list of requirements * - * See {@link Requirements_Backend::customScript()} for more info - * @param script The script content - * @param uniquenessID Use this to ensure that pieces of code only get added once. + * @param string $script The script content as a string (without enclosing