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

Member Function Documentation

CssAtImportParserPlugin::getTriggerChars ( )

Implements aCssParserPlugin::getTriggerChars().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 4752 of file cssmin.php.

{
return array("@", ";", ",", "\n");
}
CssAtImportParserPlugin::getTriggerStates ( )

Implements aCssParserPlugin::getTriggerStates().

Returns
array

Reimplemented from aCssParserPlugin.

Definition at line 4761 of file cssmin.php.

{
return array("T_DOCUMENT", "T_AT_IMPORT");
}
CssAtImportParserPlugin::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 4773 of file cssmin.php.

References CssMin\triggerError().

{
if ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 7)) === "@import")
{
$this->parser->pushState("T_AT_IMPORT");
$this->parser->clearBuffer();
return $index + 7;
}
elseif (($char === ";" || $char === "\n") && $state === "T_AT_IMPORT")
{
$this->buffer = $this->parser->getAndClearBuffer(";");
$pos = false;
foreach (array(")", "\"", "'") as $needle)
{
if (($pos = strrpos($this->buffer, $needle)) !== false)
{
break;
}
}
$import = substr($this->buffer, 0, $pos + 1);
if (stripos($import, "url(") === 0)
{
$import = substr($import, 4, -1);
}
$import = trim($import, " \t\n\r\0\x0B'\"");
$mediaTypes = array_filter(array_map("trim", explode(",", trim(substr($this->buffer, $pos + 1), " \t\n\r\0\x0B{"))));
if ($pos)
{
$this->parser->appendToken(new CssAtImportToken($import, $mediaTypes));
}
else
{
CssMin::triggerError(new CssError(__FILE__, __LINE__, __METHOD__ . ": Invalid @import at-rule syntax", $this->parser->buffer));
}
$this->parser->popState();
}
else
{
return false;
}
return true;
}

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