CssTidy

csstidy_print
in package

CSS Printing class

This class prints CSS data generated by csstidy.

Tags
author

Florian Schmitz (floele at gmail dot com) 2005-2006

version
1.1.0

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

$input_css

Saves the input CSS string

public string $input_css = ''
Tags
access

private

$output_css

Saves the formatted CSS string

public string $output_css = ''
Tags
access

public

$output_css_plain

Saves the formatted CSS string (plain text)

public string $output_css_plain = ''
Tags
access

public

Methods

_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
access

private

version
1.0

_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
see
csstidy_print::_print()
access

private

version
1.0
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
access

private

version
2.0

_reset()

Resets output_css and output_css_plain (new css code)

public _reset() : mixed
Tags
access

private

version
1.0

_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
access

private

version
1.0
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
access

public

version
1.0
Return values
string

formatted_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
access

public

version
1.4
Return values
string

get_diff()

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

public get_diff() : int|string
Tags
access

public

version
1.1
Return values
int|string

get_ratio()

Get compression ratio

public get_ratio() : float
Tags
access

public

version
1.2
Return values
float

plain()

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
access

public

version
1.0
Return values
string

size()

Get the size of either input or output CSS in KB

public size([string $loc = 'output' ]) : int
Parameters
$loc : string = 'output'

default is "output"

Tags
access

public

version
1.0
Return values
int

        
On this page

Search results