1 | <?php |
||
36 | class TagParser extends BaseObject |
||
37 | { |
||
38 | /** |
||
39 | * @var string Base regular expression to determine function, values and value-sub informations. |
||
40 | * @see https://regex101.com/r/hP9nJ1/1 - Online Regex tester |
||
41 | */ |
||
42 | const REGEX = '/(?<function>[a-z]+)\[(?<value>.*?)\]((?<!\\\\)\((?<sub>.*?)(?<!\\\\)\))?/mi'; |
||
43 | |||
44 | private $tags = [ |
||
45 | 'mail' => ['class' => 'luya\tag\tags\MailTag'], |
||
46 | 'tel' => ['class' => 'luya\tag\tags\TelTag'], |
||
47 | 'link' => ['class' => 'luya\tag\tags\LinkTag'], |
||
48 | ]; |
||
49 | |||
50 | private static $_instance; |
||
51 | |||
52 | /** |
||
53 | * Inject a new tag with a given name and a configurable array config. |
||
54 | * |
||
55 | * @param string $name The name of the tag on what the tag should be found. Must be [a-z] chars. |
||
56 | * @param string|array $config The configurable object context can be either a string with a class or a configurable array base on {{yii\base\BaseObject}} concept. |
||
57 | */ |
||
58 | public static function inject($name, $config) |
||
62 | |||
63 | /** |
||
64 | * Convert the CMS-Tags into HTML-Tags. |
||
65 | * |
||
66 | * @param string $text The content where the CMS-Tags should be found and convert into Html-Tags. |
||
67 | * @return string The converted output of $text. |
||
68 | */ |
||
69 | public static function convert($text) |
||
73 | |||
74 | /** |
||
75 | * Convert the CMS-Tags into HTMl-Tags and additional convert GFM Markdown into Html as well. The main purpose |
||
76 | * of this method to fix the conflict between markdown and tag parser when using urls. |
||
77 | * |
||
78 | * @param string $text The content where the CMS-Tags should be found and convert into Html-Tags and Markdown Tags. |
||
79 | * @return string the Converted output of $text. |
||
80 | */ |
||
81 | public static function convertWithMarkdown($text) |
||
85 | |||
86 | /** |
||
87 | * Generate the instance for all registered tags. |
||
88 | * |
||
89 | * The main purpose of this method is to return all tag objects in admin context to provide help informations from the tags. |
||
90 | * |
||
91 | * @return \luya\tag\TagInterface |
||
92 | */ |
||
93 | public static function getInstantiatedTagObjects() |
||
102 | |||
103 | /** |
||
104 | * Get the TagParser object, create new if not exists |
||
105 | * |
||
106 | * @return static |
||
107 | */ |
||
108 | private static function getInstance() |
||
116 | |||
117 | /** |
||
118 | * Internal method to add a tag into the tags array. |
||
119 | */ |
||
120 | private function addTag($identifier, $tagObjectConfig) |
||
124 | |||
125 | /** |
||
126 | * Check if the given tag name exists. |
||
127 | * |
||
128 | * @return boolean |
||
129 | */ |
||
130 | private function hasTag($tag) |
||
134 | |||
135 | /** |
||
136 | * Create the tag instance (object) for a given tag name. |
||
137 | */ |
||
138 | private function instantiatTag($tag) |
||
145 | |||
146 | /** |
||
147 | * Parse the given tag with context informations. |
||
148 | * |
||
149 | * @return string Returns the parsed tag value. |
||
150 | */ |
||
151 | private function parseTag($tag, $context) |
||
165 | |||
166 | /** |
||
167 | * Process a given text. |
||
168 | * |
||
169 | * + This will find all tag based expressions inside the text |
||
170 | * + instantiate the tag if the alias exists. |
||
171 | * + parse the tag and modify the input $text |
||
172 | * |
||
173 | * @param string $text The input text |
||
174 | * @return string The parsed text |
||
175 | */ |
||
176 | private function processText($text) |
||
200 | } |
||
201 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.