Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data Fields | Protected Member Functions
Html Class Reference
Inheritance diagram for Html:
AbstractAdapter AdapterInterface

Data Fields

const HTML_FILTER = "/i18n:\s?'(?<value>[^'\\\\]*(?:\\\\.[^'\\\\]*)*)'/i"
 

Protected Member Functions

 _parse ()
 
- Protected Member Functions inherited from AbstractAdapter
 _parse ()
 
 _addPhrase ($phrase, $line='')
 
 _stripFirstAndLastChar ($phrase)
 
 _isFirstAndLastCharIsQuote ($phrase)
 
 getEnclosureCharacter ($phrase)
 
 trimEnclosure ($phrase)
 
 isQuote ($char)
 

Additional Inherited Members

- Public Member Functions inherited from AbstractAdapter
 parse ($file)
 
 getPhrases ()
 
- Protected Attributes inherited from AbstractAdapter
 $_file
 
 $_phrases = []
 

Detailed Description

Html parser adapter

Definition at line 13 of file Html.php.

Member Function Documentation

◆ _parse()

_parse ( )
protected

{}

Definition at line 25 of file Html.php.

26  {
27  $data = file_get_contents($this->_file);
28  if ($data === false) {
29  throw new \Exception('Failed to load file from disk.');
30  }
31 
32  $results = [];
33  preg_match_all(Filter::CONSTRUCTION_PATTERN, $data, $results, PREG_SET_ORDER);
34  for ($i = 0; $i < count($results); $i++) {
35  if ($results[$i][1] === Filter::TRANS_DIRECTIVE_NAME) {
36  $directive = [];
37  if (preg_match(Filter::TRANS_DIRECTIVE_REGEX, $results[$i][2], $directive) !== 1) {
38  continue;
39  }
40  $quote = $directive[1];
41  $this->_addPhrase($quote . $directive[2] . $quote);
42  }
43  }
44 
45  preg_match_all(self::HTML_FILTER, $data, $results, PREG_SET_ORDER);
46  for ($i = 0; $i < count($results); $i++) {
47  if (!empty($results[$i]['value'])) {
48  $this->_addPhrase($results[$i]['value']);
49  }
50  }
51  }
$results
Definition: popup.phtml:13
$quote
$i
Definition: gallery.phtml:31

Field Documentation

◆ HTML_FILTER

const HTML_FILTER = "/i18n:\s?'(?<value>[^'\\\\]*(?:\\\\.[^'\\\\]*)*)'/i"

Covers

Definition at line 20 of file Html.php.


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