You are here

public static function XBBCodeParser::parseOption in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 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 162

Class

XBBCodeParser
The standard XBBCode parser.

Namespace

Drupal\xbbcode\Parser

Code

public static function parseOption(string $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);
}