\csstidy_print

CSS Printing class

This class prints CSS data generated by csstidy.

Summary

Methods
Properties
Constants
csstidy_print()
_reset()
plain()
formatted()
formatted_page()
_print()
_seeknocomment()
_convert_raw_css()
_htmlsp()
get_ratio()
get_diff()
size()
$input_css
$output_css
$output_css_plain
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$input_css

$input_css : string

Saves the input CSS string

Type

string

$output_css

$output_css : string

Saves the formatted CSS string

Type

string

$output_css_plain

$output_css_plain : string

Saves the formatted CSS string (plain text)

Type

string

Methods

csstidy_print()

csstidy_print(array $css)

Constructor

Parameters

array $css

contains the class csstidy

_reset()

_reset()

Resets output_css and output_css_plain (new css code)

plain()

plain(string $default_media) : string

Returns the CSS code as plain text

Parameters

string $default_media

default @media to add to selectors without any @media

Returns

string

formatted()

formatted(string $default_media) : string

Returns the formatted CSS code

Parameters

string $default_media

default @media to add to selectors without any @media

Returns

string

formatted_page()

formatted_page(string $doctype, bool $externalcss, string $title, string $lang) : string

Returns the formatted CSS code to make a complete webpage

Parameters

string $doctype

shorthand for the document type

bool $externalcss

indicates whether styles to be attached internally or as an external stylesheet

string $title

title to be added in the head of the document

string $lang

two-letter language code to be added to the output

Returns

string

_print()

_print(bool $plain, string $default_media)

Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain

Parameters

bool $plain

plain text or not

string $default_media

default @media to add to selectors without any @media

_seeknocomment()

_seeknocomment(integer $key, integer $move) : mixed

Gets the next token type which is $move away from $key, excluding comments

Parameters

integer $key

current position

integer $move

move this far

Returns

mixed —

a token type

_convert_raw_css()

_convert_raw_css(string $default_media)

Converts $this->css array to a raw array ($this->tokens)

Parameters

string $default_media

default @media to add to selectors without any @media

_htmlsp()

_htmlsp(string $string, bool $plain) : string

Same as htmlspecialchars, only that chars are not replaced if $plain !== true. This makes print_code() cleaner.

Parameters

string $string
bool $plain

Returns

string

get_ratio()

get_ratio() : float

Get compression ratio

Returns

float

get_diff()

get_diff() : string

Get difference between the old and new code in bytes and prints the code if necessary.

Returns

string

size()

size(string $loc) : integer

Get the size of either input or output CSS in KB

Parameters

string $loc

default is "output"

Returns

integer