Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
CssAtVariablesParserPlugin Class Reference
Inheritance diagram for CssAtVariablesParserPlugin:
aCssParserPlugin

Public Member Functions

 getTriggerChars ()
 getTriggerStates ()
 parse ($index, $char, $previousChar, $state)
- Public Member Functions inherited from aCssParserPlugin
 __construct (CssParser $parser, array $configuration=null)

Additional Inherited Members

- Protected Attributes inherited from aCssParserPlugin
 $configuration = array()
 $parser = null
 $buffer = ""

Detailed Description

Definition at line 3954 of file cssmin.php.

Member Function Documentation

CssAtVariablesParserPlugin::getTriggerChars ( )

Implements aCssParserPlugin::getTriggerChars().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 3961 of file cssmin.php.

{
return array("@", "{", "}", ":", ";");
}
CssAtVariablesParserPlugin::getTriggerStates ( )

Implements aCssParserPlugin::getTriggerStates().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 3970 of file cssmin.php.

{
return array("T_DOCUMENT", "T_AT_VARIABLES::PREPARE", "T_AT_VARIABLES", "T_AT_VARIABLES_DECLARATION");
}
CssAtVariablesParserPlugin::parse (   $index,
  $char,
  $previousChar,
  $state 
)

Implements aCssParserPlugin::parse().

Parameters
integer$indexCurrent index
string$charCurrent char
string$previousCharPrevious char
Returns
mixed TRUE will break the processing; FALSE continue with the next plugin; integer set a new index and break the processing

Reimplemented from aCssParserPlugin.

Definition at line 3982 of file cssmin.php.

References CssMin\triggerError().

{
// Start of @variables at-rule block
if ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 10)) === "@variables")
{
$this->parser->pushState("T_AT_VARIABLES::PREPARE");
$this->parser->clearBuffer();
return $index + 10;
}
// Start of @variables declarations
elseif ($char === "{" && $state === "T_AT_VARIABLES::PREPARE")
{
$this->parser->setState("T_AT_VARIABLES");
$mediaTypes = array_filter(array_map("trim", explode(",", $this->parser->getAndClearBuffer("{"))));
$this->parser->appendToken(new CssAtVariablesStartToken($mediaTypes));
}
// Start of @variables declaration
if ($char === ":" && $state === "T_AT_VARIABLES")
{
$this->buffer = $this->parser->getAndClearBuffer(":");
$this->parser->pushState("T_AT_VARIABLES_DECLARATION");
}
// Unterminated @variables declaration
elseif ($char === ":" && $state === "T_AT_VARIABLES_DECLARATION")
{
// Ignore Internet Explorer filter declarations
if ($this->buffer === "filter")
{
return false;
}
CssMin::triggerError(new CssError(__FILE__, __LINE__, __METHOD__ . ": Unterminated @variables declaration", $this->buffer . ":" . $this->parser->getBuffer() . "_"));
}
// End of @variables declaration
elseif (($char === ";" || $char === "}") && $state === "T_AT_VARIABLES_DECLARATION")
{
$value = $this->parser->getAndClearBuffer(";}");
if (strtolower(substr($value, -10, 10)) === "!important")
{
$value = trim(substr($value, 0, -10));
$isImportant = true;
}
else
{
$isImportant = false;
}
$this->parser->popState();
$this->parser->appendToken(new CssAtVariablesDeclarationToken($this->buffer, $value, $isImportant));
$this->buffer = "";
}
// End of @variables at-rule block
elseif ($char === "}" && $state === "T_AT_VARIABLES")
{
$this->parser->popState();
$this->parser->clearBuffer();
$this->parser->appendToken(new CssAtVariablesEndToken());
}
else
{
return false;
}
return true;
}

The documentation for this class was generated from the following file: