Empty block


GET Parameters

  • MAIN PARAMETERS Expect some stylesheets.css with: /cm/?cat=$properValue Expect some javascripts.js with: /cm/?mice=%proper.value --- Whitelisted parameters within OPT_ARGUMENT constant are the only ones that can go alonside cat or mice. Other, runtime parameters cannot have their values changed via _GET request, as those are responsible for the underlying catmice behaviour and setup in general.

Auto-Instance Arguments

  • Anonymous class constructor arguments [ catmice @ line:13 ] ---- @1st: &hrs=INT; 'How many hours for cache ?' ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Predefined 'hrs' falls for $this-> hours 0 = nothing is going to be cached. 128 = One hundred and twenty eight hours for both js and css requests. Hint: Setting ZERO_HOUR_SKEPTIC to true would be a wise decision for the production servers. ---- @2nd: &sq=INT 0|1; 'sq' => '$this-> squeeze' ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Squeezing the content, yes or no. After removing all comments, all unnecesary white space will be wiped as well. Response will be a similar to uglified js file, but far more prettier. No vital part of the file will be touched and modified. 1, true -> remove ALL comments and white space bloat. 0, false -> do not modify collected source. ATTENTION! - Template literals. Keep in mind that template literals will get squashed as well. That means You need to reconsider whether You'll want Your .js requests that have multi-line text squeezed. Before You do, and want to have single-line file, You may want to use single/double quoted strings instead, or break the multi-line literals and concat them. That's shit, but it is the way it is. Also note that with sq=1 both `&c` and `&bc` will have no effect. ---- @3rd: &c=INT 0|1; 'c' => '$this-> comments' (mices only) ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 1, true -> leave single line comments alone 0, false -> removes single line comments WARNING strict rule! - Before You intend to remove js line comments with CatMice, You need to make sure that ALL OF YOUR .. // comment line text ... .. actually begin/look like this .. //~ comment line text ... .. or something like this (which is ugly and ... no. But, yes. Exists as option) .. //\* comment line text ... ~ (tilda) or \ (escape) as suffix character, right after //. Why torture ?!? In Javasript // is used for preg_pattern scope. It is also used for http(s):// .. and finally as a line comment. One preg rule can solve that, however, it comes with a cost. And in systems like this one is, we need as less cost as possible - everywhere. By just placing one tilda character, after //, it is clearly distinguished what is what, therefore native PHP per-line substring can occur, which is, whether You want to believe or not way faster than any preg or pcre lookup. If this was about PHP files, native Tokenizer would work as breeze, but it isn't about PHP files. Be aware, tilda right after C-style line comment is nowadays a default comment line standard in many IDE's and syntax editors, and for a good reason. -- If You have many line comments without mentioned suffix within Your JS files, You still can cache and concat Your files, no problem, but don't try to use other than '&bc' (remove block-comments) runtime override. '&sq=1' (source_squeeze) for instance will cause HAVOC - 1010% guaranteed, unless this particular rule is applied. ---- @4th: &bc=INT 0|1; 'bc' => '$this-> blockCmt' ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 1, true -> leave block comments alone 0, false -> remove all block comments This parameter is for both style and script requests, and has no special perks and gotchas. Block comments are awesome! ---- @5th: &s=INT 0|1; 's' => '$this-> sig' ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ If 1, catmice will attach block comment with the request signature details at the bottom of the generated source. Zero - prints nothing. ---- @6th: &ex=INT 0|1; 'ex' => '$this-> expandExternals' (cats only) ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - Converts (suitable only) external resources to base64 string Suitable means any CSS rule that has url() with path to an image or font in it. This option saves You from more additional requests, as external resources will be directly embeded into stylesheet as encoded string. Your page will recieve images and fonts directly from memory, but there's automatic trade-off as fetched file with this parameter will/might become INSANELY HUGE. For mobile or desktop applications, this is not a problem. But for public websites it is a completely different story if stylesheets are not cached, which is very rare. Even then, that very first load will be hard one to swallow for older client machines or users with slower connections, so You may want to be aware of that. ---- @7th: __DIR__ Root-Fallback Directory for the catmice sourcing; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ This value should remain __DIR__. It is compared against _SERVER['SCRIPT_FILENAME'] so that both real and `symlinked` catimce can work. If scenario where this parameter is other than __DIR__, catmice script should not exist as symbolic link. That's one reason why this parameter is not of dynamic type. The second, and more important: this parameter requires absolute path. Slapping backend paths in public _GET variable was never encouraging practice.

File System

  • ™ Directory

    private const TRADEMARK; [ catmice @ line: 26 ] Special "Trademark" directory name This is automatically generated directory name and it should hide behind a single character which is hardly reachable by an ordinary person on the other side. There can be three of them. - One in catmice root directory with mime.types apache list inside. Serialized mime.types list as file is also, automatically created. - The other two are for scripts and stylesheets from their well known trademark brands. An example: - Source path like this: /cm/script/™/ace/ace.js - is fetched like this: /cm/?mice=`ace|ace -- Production Value: Any other than default `™` Development Value: depends
  • Directory Mask

    private const DIRECTORY_MASK; [ catmice @ line: 30 ] Comment one and comment-out other line. Note that there MUST BE exactly two keys, always. Those are 'script' and 'style' Example: 'script' => 'js', 'style' => 'css', Whichever You put as value, such directory will be created via first run. And those directories will behave like defaults for `?cat=` and `?mice=` PRIMARY _GET variable names within url bar. Something like this: /cm/?mice=%ace.fly will load the following: /cm/script/pot.ace/fly.js -- Production Value: Any reasonable for both Development Value: Any reasonable for both

Runtime Parameters

  • CSS charset

    private const AT_CHARSET; [ catmice @ line: 42 ] If true, '@charset "UTF-8";' will be automatically prepended to the very beginning after automatically removing all found charset declaration suspects. If false, it will not mock or prepend anything, but will leave collection as is. Each and every external stylesheet should have charset declaration at the top most of the file, therefore settings this to true, might result as very helpful if sylesheets are created very often. -- Production Value: depends Development Value: depends
  • No Literal Zero Cache

    private const ZERO_HOUR_SKEPTIC; [ catmice @ line: 46 ] Tries to prevent TOTAL fresh content. Hours will turn into approx. 7 seconds only if 'hrs' value is set to 0 and this value is set to TRUE. This will force Cache/Expires headers towards client at all costs. That doesn't necessarily mean it surely will handle all rapid flood or DDOS attackes efficiently, but it kinda provides a bit of preventive support for such scenarios. -- Production Value: true Development Value: false
  • Zero Cache Tune

    private const ZERO_POINT_IMMUTABLE; [ catmice @ line: 50 ] Works only if $hours === 0 and self::ZERO_HOUR_SKEPTIC === true This float with its default value will force all 0 hour requests into +7 seconds. As stated above, it depends on ZERO_HOUR_SKEPTIC constant will it behave like so. The default calculation goes like this: - ((int)(60 * (60 * $hours))) This very constant self::ZERO_POINT_IMMUTABLE will replace $hours value either from the default parameter of via _GET['hrs'] Default self::ZERO_POINT_IMMUTABLE value for multiplier is 0.0020. So, You may want to tune it more. -- Production Value: depends Development Value: depends
Empty block