Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -514,7 +514,7 @@ |
515 | 515 | // Also replace periods with underlines, since that's what |
516 | 516 | // POST does to strings anyway. |
517 | 517 | $query_template_name = str_replace( '.', '_', $query_template_name ); |
518 | | - // ...and escape apostrophes. |
| 518 | + // ...and escape apostrophes. |
519 | 519 | $query_template_name = str_replace( "'", "\'", $query_template_name ); |
520 | 520 | // Cycle through the other components. |
521 | 521 | for ( $i = 2; $i < count( $tag_components ); $i++ ) { |
— | — | @@ -653,6 +653,14 @@ |
654 | 654 | $field .= $c; |
655 | 655 | } |
656 | 656 | } |
| 657 | + // If there are uncompleted opening brackets, the whole form will get messed up - |
| 658 | + // display a warning. |
| 659 | + // (If there are too many *closing* brackets, some template stuff will end up in |
| 660 | + // the "free text" field - which is bad, but it's harder for the code to detect |
| 661 | + // the problem - though hopefully, easier for users.) |
| 662 | + if ( $uncompleted_curly_brackets > 0 || $uncompleted_square_brackets > 0 ) { |
| 663 | + $form_text .= "\t" . '<div class="warningbox">' . wfMsg( 'sf_formedit_mismatchedbrackets', $this->mPageTitle->getFullURL( array( 'action' => 'edit' ) ) ) . "</div>\n<br clear=\"both\" />\n"; |
| 664 | + } |
657 | 665 | $existing_template_text = substr( $existing_page_content, $start_char, $i - $start_char ); |
658 | 666 | // now remove this template from the text being edited |
659 | 667 | // if this is a partial form, establish a new insertion point |
— | — | @@ -1436,7 +1444,7 @@ |
1437 | 1445 | unset ( $template_label ); |
1438 | 1446 | } |
1439 | 1447 | $form_text = preg_replace( '/' . self::makePlaceholderInFormHTML( $curPlaceholder ) . '/', |
1440 | | - $multipleTemplateString, $form_text ); |
| 1448 | + $multipleTemplateString, $form_text ); |
1441 | 1449 | } |
1442 | 1450 | if ( ! $all_instances_printed ) { |
1443 | 1451 | // This will cause the section to be |