You are here

public static function XBBCodeParser::parseOption in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x src/Parser/XBBCodeParser.php \Drupal\xbbcode\Parser\XBBCodeParser::parseOption()

Parse an option string.

Parameters

string $argument: The argument string, including the initial =.

Return value

string The parsed option value.

1 call to XBBCodeParser::parseOption()
TagElement::__construct in src/Parser/Tree/TagElement.php
TagElement constructor.

File

src/Parser/XBBCodeParser.php, line 160

Class

XBBCodeParser
The standard XBBCode parser.

Namespace

Drupal\xbbcode\Parser

Code

public static function parseOption($argument) : string {
  if (preg_match("/\n      ^=\n      (?'quote'['\"]|"|&\\#039;)\n      (?'value'.*)\n      \\k'quote'\n      \$/x", $argument, $match)) {
    $value = $match['value'];
  }
  else {
    $value = substr($argument, 1);
  }
  return stripslashes($value);
}