Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | // remove the '<nowiki>' tags, leaving us with what we need |
160 | 160 | global $sfgDisableWikiTextParsing; |
161 | 161 | if (! $sfgDisableWikiTextParsing) { |
162 | | - $form_def = "__NOEDITSECTION__ " . strtr($form_def, array('{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>')); |
| 162 | + $form_def = "__NOEDITSECTION__" . strtr($form_def, array('{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>')); |
163 | 163 | $wgParser->mOptions = new ParserOptions(); |
164 | 164 | $wgParser->mOptions->initialiseFromUser($wgUser); |
165 | 165 | $form_def = $wgParser->parse($form_def, $this->mPageTitle, $wgParser->mOptions)->getText(); |
— | — | @@ -268,11 +268,9 @@ |
269 | 269 | // once in that page, and multiple values are allowed, repeat this |
270 | 270 | // section |
271 | 271 | $existing_template_text = null; |
272 | | - // special template string for preg_match calls - includes a |
273 | | - // regular expression, to allow matching of either spaces or |
274 | | - // underlines in name |
275 | | - $search_template_str = str_replace('/', '\/', $tif->template_name); |
276 | | - $search_template_str = preg_replace('/[_| ]/', '[_| ]', $search_template_str); |
| 272 | + // replace underlines with spaces in template name, to allow for |
| 273 | + // searching on either |
| 274 | + $search_template_str = str_replace('_', ' ', $tif->template_name); |
277 | 275 | if ($source_is_page || $form_is_partial) { |
278 | 276 | if ($allow_multiple) { |
279 | 277 | // find instances of this template in the page - |
— | — | @@ -282,7 +280,7 @@ |
283 | 281 | // there has to be a more efficient way to handle multiple |
284 | 282 | // instances of templates, one that doesn't involve re-parsing |
285 | 283 | // the same tags, but I don't know what it is. |
286 | | - if (stripos($existing_page_content, '{{' . $search_template_str) !== false) { |
| 284 | + if (stripos(str_replace('_', ' ', $existing_page_content), '{{' . $search_template_str) !== false) { |
287 | 285 | $instance_num++; |
288 | 286 | } else { |
289 | 287 | $all_instances_printed = true; |
— | — | @@ -290,7 +288,7 @@ |
291 | 289 | } |
292 | 290 | // get the first instance of this template on the page being edited, |
293 | 291 | // even if there are more |
294 | | - if (($start_char = stripos($existing_page_content, '{{' . $search_template_str)) !== false) { |
| 292 | + if (($start_char = stripos(str_replace('_', ' ', $existing_page_content), '{{' . $search_template_str)) !== false) { |
295 | 293 | $fields_start_char = $start_char + 2 + strlen($search_template_str); |
296 | 294 | // skip ahead to the first real character |
297 | 295 | while (in_array($existing_page_content[$fields_start_char], array(' ', '\n', '|'))) { |