Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -324,10 +324,11 @@ |
325 | 325 | // once in that page, and multiple values are allowed, repeat this |
326 | 326 | // section |
327 | 327 | $existing_template_text = null; |
328 | | - // replace underlines with spaces in template name, to allow for |
329 | | - // searching on either |
330 | | - $search_template_str = str_replace('_', ' ', $tif->template_name); |
331 | 328 | if ($source_is_page || $form_is_partial) { |
| 329 | + // replace underlines with spaces in template name, to allow for |
| 330 | + // searching on either |
| 331 | + $search_template_str = str_replace('_', ' ', $tif->template_name); |
| 332 | + $found_instance = preg_match('/{{' . $search_template_str . '\s*[\|}]/i', str_replace('_', ' ', $existing_page_content)); |
332 | 333 | if ($allow_multiple) { |
333 | 334 | // find instances of this template in the page - |
334 | 335 | // if there's at least one, re-parse this section of the |
— | — | @@ -336,7 +337,7 @@ |
337 | 338 | // there has to be a more efficient way to handle multiple |
338 | 339 | // instances of templates, one that doesn't involve re-parsing |
339 | 340 | // the same tags, but I don't know what it is. |
340 | | - if (stripos(str_replace('_', ' ', $existing_page_content), '{{' . $search_template_str) !== false) { |
| 341 | + if ($found_instance) { |
341 | 342 | $instance_num++; |
342 | 343 | } else { |
343 | 344 | $all_instances_printed = true; |
— | — | @@ -344,7 +345,7 @@ |
345 | 346 | } |
346 | 347 | // get the first instance of this template on the page being edited, |
347 | 348 | // even if there are more |
348 | | - if (($start_char = stripos(str_replace('_', ' ', $existing_page_content), '{{' . $search_template_str)) !== false) { |
| 349 | + if ($found_instance && ($start_char = stripos(str_replace('_', ' ', $existing_page_content), '{{' . $search_template_str)) !== false) { |
349 | 350 | $fields_start_char = $start_char + 2 + strlen($search_template_str); |
350 | 351 | // skip ahead to the first real character |
351 | 352 | while (in_array($existing_page_content[$fields_start_char], array(' ', '\n', '|'))) { |
— | — | @@ -1146,7 +1147,7 @@ |
1147 | 1148 | global $wgFCKEditorDir; |
1148 | 1149 | if ($wgFCKEditorDir) { |
1149 | 1150 | $showFCKEditor = SFFormUtils::getShowFCKEditor(); |
1150 | | - $free_text = htmlspecialchars( $free_text ); |
| 1151 | + $free_text = str_replace( '"', '"', $free_text ); |
1151 | 1152 | if(!$form_submitted && ($showFCKEditor & RTE_VISIBLE)) { |
1152 | 1153 | $free_text = SFFormUtils::prepareTextForFCK($free_text); |
1153 | 1154 | } |