[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/ -> LinkReferences.php (source)

   1  <?php
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2022 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Plugins\Litedown\Parser\Passes;
   9  
  10  class LinkReferences extends AbstractPass
  11  {
  12      /**
  13      * {@inheritdoc}
  14      */
  15  	public function parse()
  16      {
  17          if ($this->text->indexOf(']:') === false)
  18          {
  19              return;
  20          }
  21  
  22          $regexp = '/^\\x1A* {0,3}\\[([^\\x17\\]]+)\\]: *([^[\\s\\x17]+ *(?:"[^\\x17]*?"|\'[^\\x17]*?\'|\\([^\\x17)]*\\))?) *(?=$|\\x17)\\n?/m';
  23          preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
  24          foreach ($matches as $m)
  25          {
  26              $this->parser->addIgnoreTag($m[0][1], strlen($m[0][0]));
  27  
  28              // Only add the reference if it does not already exist
  29              $id = strtolower($m[1][0]);
  30              if (!isset($this->text->linkReferences[$id]))
  31              {
  32                  $this->text->hasReferences       = true;
  33                  $this->text->linkReferences[$id] = $m[2][0];
  34              }
  35          }
  36      }
  37  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1