PluginProbe
wpForo Forum / 3.1.6
wpForo Forum v3.1.6
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
← All changes | classes/AIMarkdown.php +7 -7 3.0.73.1.6 View file →
@@ -108,9 +108,9 @@
108 108 // Extract fenced code blocks ```language\ncode\n```
109 109 $text = preg_replace_callback(
110 110 '/```(\w*)\n([\s\S]*?)```/',
111 111 function ( $matches ) use ( &$placeholders, &$index ) {
112 - $placeholder = "\x00CODEBLOCK{$index}\x00";
112 + $placeholder = "%%WPF_CODEBLOCK_{$index}%%";
113 113 $language = ! empty( $matches[1] ) ? ' class="language-' . esc_attr( $matches[1] ) . '"' : '';
114 114 $code = esc_html( trim( $matches[2] ) );
115 115 $placeholders[ $placeholder ] = '<pre><code' . $language . '>' . $code . '</code></pre>';
116 116 $index++;
@@ -122,9 +122,9 @@
122 122 // Extract inline code `code`
123 123 $text = preg_replace_callback(
124 124 '/`([^`\n]+)`/',
125 125 function ( $matches ) use ( &$placeholders, &$index ) {
126 - $placeholder = "\x00INLINECODE{$index}\x00";
126 + $placeholder = "%%WPF_INLINECODE_{$index}%%";
127 127 $placeholders[ $placeholder ] = '<code>' . esc_html( $matches[1] ) . '</code>';
128 128 $index++;
129 129 return $placeholder;
130 130 },
@@ -134,9 +134,9 @@
134 134 // Extract markdown links [text](url)
135 135 $text = preg_replace_callback(
136 136 '/\[([^\]]+)\]\(([^)]+)\)/',
137 137 function ( $matches ) use ( &$placeholders, &$index ) {
138 - $placeholder = "\x00LINK{$index}\x00";
138 + $placeholder = "%%WPF_LINK_{$index}%%";
139 139 $placeholders[ $placeholder ] = '<a href="' . esc_url( $matches[2] ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $matches[1] ) . '</a>';
140 140 $index++;
141 141 return $placeholder;
142 142 },
@@ -148,9 +148,9 @@
148 148 $text = preg_replace_callback(
149 149 '/(?<!["\'])(https?:\/\/[^\s<>\[\]"\']+)/',
150 150 function ( $matches ) use ( &$placeholders, &$index ) {
151 151 $url = rtrim( $matches[1], '.,;:!?' );
152 - $placeholder = "\x00PLAINURL{$index}\x00";
152 + $placeholder = "%%WPF_PLAINURL_{$index}%%";
153 153 $placeholders[ $placeholder ] = '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $url ) . '</a><br class="wpf-ai-br">';
154 154 $index++;
155 155 return $placeholder;
156 156 },
@@ -161,9 +161,9 @@
161 161 // Extract bold **text** or __text__
162 162 $text = preg_replace_callback(
163 163 '/(\*\*|__)(.+?)\1/',
164 164 function ( $matches ) use ( &$placeholders, &$index ) {
165 - $placeholder = "\x00BOLD{$index}\x00";
165 + $placeholder = "%%WPF_BOLD_{$index}%%";
166 166 $placeholders[ $placeholder ] = '<strong>' . esc_html( $matches[2] ) . '</strong>';
167 167 $index++;
168 168 return $placeholder;
169 169 },
@@ -174,9 +174,9 @@
174 174 // Uses [^\*_] to prevent matching horizontal rules or other markers
175 175 $text = preg_replace_callback(
176 176 '/(?<![a-zA-Z0-9\*_])(\*|_)([^\*_\n]+?)\1(?![a-zA-Z0-9\*_])/',
177 177 function ( $matches ) use ( &$placeholders, &$index ) {
178 - $placeholder = "\x00ITALIC{$index}\x00";
178 + $placeholder = "%%WPF_ITALIC_{$index}%%";
179 179 $placeholders[ $placeholder ] = '<em>' . esc_html( $matches[2] ) . '</em>';
180 180 $index++;
181 181 return $placeholder;
182 182 },
@@ -222,9 +222,9 @@
222 222 foreach ( $lines as $line ) {
223 223 $trimmed = trim( $line );
224 224
225 225 // Skip if line is a placeholder (code block)
226 - if ( preg_match( '/^\x00CODEBLOCK\d+\x00$/', $trimmed ) ) {
226 + if ( preg_match( '/^%%WPF_CODEBLOCK_\d+%%$/', $trimmed ) ) {
227 227 if ( $in_list ) {
228 228 $result[] = $list_type === 'ul' ? '</ul>' : '</ol>';
229 229 $in_list = false;
230 230 }