Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
CssAtFontFaceParserPlugin Class Reference
Inheritance diagram for CssAtFontFaceParserPlugin:
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 4853 of file cssmin.php.

Member Function Documentation

CssAtFontFaceParserPlugin::getTriggerChars ( )

Implements aCssParserPlugin::getTriggerChars().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 4860 of file cssmin.php.

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

Implements aCssParserPlugin::getTriggerStates().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 4869 of file cssmin.php.

{
return array("T_DOCUMENT", "T_AT_FONT_FACE::PREPARE", "T_AT_FONT_FACE", "T_AT_FONT_FACE_DECLARATION");
}
CssAtFontFaceParserPlugin::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 4881 of file cssmin.php.

References CssMin\triggerError().

{
// Start of @font-face at-rule block
if ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 10)) === "@font-face")
{
$this->parser->pushState("T_AT_FONT_FACE::PREPARE");
$this->parser->clearBuffer();
return $index + 10;
}
// Start of @font-face declarations
elseif ($char === "{" && $state === "T_AT_FONT_FACE::PREPARE")
{
$this->parser->setState("T_AT_FONT_FACE");
$this->parser->clearBuffer();
$this->parser->appendToken(new CssAtFontFaceStartToken());
}
// Start of @font-face declaration
elseif ($char === ":" && $state === "T_AT_FONT_FACE")
{
$this->parser->pushState("T_AT_FONT_FACE_DECLARATION");
$this->buffer = $this->parser->getAndClearBuffer(":", true);
}
// Unterminated @font-face declaration
elseif ($char === ":" && $state === "T_AT_FONT_FACE_DECLARATION")
{
// Ignore Internet Explorer filter declarations
if ($this->buffer === "filter")
{
return false;
}
CssMin::triggerError(new CssError(__FILE__, __LINE__, __METHOD__ . ": Unterminated @font-face declaration", $this->buffer . ":" . $this->parser->getBuffer() . "_"));
}
// End of @font-face declaration
elseif (($char === ";" || $char === "}") && $state === "T_AT_FONT_FACE_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 CssAtFontFaceDeclarationToken($this->buffer, $value, $isImportant));
$this->buffer = "";
// --
if ($char === "}")
{
$this->parser->appendToken(new CssAtFontFaceEndToken());
$this->parser->popState();
}
}
// End of @font-face at-rule block
elseif ($char === "}" && $state === "T_AT_FONT_FACE")
{
$this->parser->appendToken(new CssAtFontFaceEndToken());
$this->parser->clearBuffer();
$this->parser->popState();
}
else
{
return false;
}
return true;
}

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