csstidy_print
in package
CSS Printing class
This class prints CSS data generated by csstidy.
Tags
Table of Contents
Properties
- $charset : mixed
- $css : mixed
- $import : mixed
- $input_css : string
- Saves the input CSS string
- $namespace : mixed
- $output_css : string
- Saves the formatted CSS string
- $output_css_plain : string
- Saves the formatted CSS string (plain text)
- $parser : object
- csstidy object
- $template : mixed
- $tokens : mixed
Methods
- __construct() : mixed
- Constructor
- _convert_raw_css() : mixed
- Converts $this->css array to a raw array ($this->tokens)
- _htmlsp() : string
- Same as htmlspecialchars, only that chars are not replaced if $plain !== true. This makes print_code() cleaner.
- _print() : mixed
- Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain
- _reset() : mixed
- Resets output_css and output_css_plain (new css code)
- _seeknocomment() : mixed
- Gets the next token type which is $move away from $key, excluding comments
- formatted() : string
- Returns the formatted CSS code
- formatted_page() : string
- Returns the formatted CSS code to make a complete webpage
- get_diff() : int|string
- Get difference between the old and new code in bytes and prints the code if necessary.
- get_ratio() : float
- Get compression ratio
- plain() : string
- Returns the CSS code as plain text
- size() : int
- Get the size of either input or output CSS in KB
Properties
$charset
public
mixed
$charset
$css
public
mixed
$css
$import
public
mixed
$import
$input_css
Saves the input CSS string
public
string
$input_css
= ''
Tags
$namespace
public
mixed
$namespace
$output_css
Saves the formatted CSS string
public
string
$output_css
= ''
Tags
$output_css_plain
Saves the formatted CSS string (plain text)
public
string
$output_css_plain
= ''
Tags
$parser
csstidy object
public
object
$parser
$template
public
mixed
$template
$tokens
public
mixed
$tokens
Methods
__construct()
Constructor
public
__construct(csstidy $css) : mixed
Parameters
- $css : csstidy
-
contains the class csstidy
Tags
_convert_raw_css()
Converts $this->css array to a raw array ($this->tokens)
public
_convert_raw_css([string $default_media = '' ]) : mixed
Parameters
- $default_media : string = ''
-
default @media to add to selectors without any @media
Tags
_htmlsp()
Same as htmlspecialchars, only that chars are not replaced if $plain !== true. This makes print_code() cleaner.
public
_htmlsp(string $string, bool $plain) : string
Parameters
- $string : string
- $plain : bool
Tags
Return values
string_print()
Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain
public
_print([bool $plain = false ][, string $default_media = '' ]) : mixed
Parameters
- $plain : bool = false
-
plain text or not
- $default_media : string = ''
-
default @media to add to selectors without any @media
Tags
_reset()
Resets output_css and output_css_plain (new css code)
public
_reset() : mixed
Tags
_seeknocomment()
Gets the next token type which is $move away from $key, excluding comments
public
_seeknocomment(int $key, int $move) : mixed
Parameters
- $key : int
-
current position
- $move : int
-
move this far
Tags
Return values
mixed —a token type
formatted()
Returns the formatted CSS code
public
formatted([string $default_media = '' ]) : string
Parameters
- $default_media : string = ''
-
default @media to add to selectors without any @media
Tags
Return values
stringformatted_page()
Returns the formatted CSS code to make a complete webpage
public
formatted_page([string $doctype = 'html5' ][, bool $externalcss = true ][, string $title = '' ][, string $lang = 'en' ]) : string
Parameters
- $doctype : string = 'html5'
-
shorthand for the document type
- $externalcss : bool = true
-
indicates whether styles to be attached internally or as an external stylesheet
- $title : string = ''
-
title to be added in the head of the document
- $lang : string = 'en'
-
two-letter language code to be added to the output
Tags
Return values
stringget_diff()
Get difference between the old and new code in bytes and prints the code if necessary.
public
get_diff() : int|string
Tags
Return values
int|stringget_ratio()
Get compression ratio
public
get_ratio() : float
Tags
Return values
floatplain()
Returns the CSS code as plain text
public
plain([string $default_media = '' ]) : string
Parameters
- $default_media : string = ''
-
default @media to add to selectors without any @media
Tags
Return values
stringsize()
Get the size of either input or output CSS in KB
public
size([string $loc = 'output' ]) : int
Parameters
- $loc : string = 'output'
-
default is "output"