Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php |
— | — | @@ -29,32 +29,32 @@ |
30 | 30 | $super_page = $wgRequest->getVal( 'super_page' ); |
31 | 31 | $params = $wgRequest->getVal( 'params' ); |
32 | 32 | |
33 | | - // if query string did not contain form name, try the URL |
| 33 | + // If the query string did not contain a form name, try the URL |
34 | 34 | if ( ! $form_name ) { |
35 | 35 | $queryparts = explode( '/', $query, 2 ); |
36 | 36 | $form_name = isset( $queryparts[0] ) ? $queryparts[0] : ''; |
37 | | - // if a target was specified, it means we should |
38 | | - // redirect to 'FormEdit' for this target page |
| 37 | + // If a target was specified, it means we should |
| 38 | + // redirect to 'FormEdit' for this target page. |
39 | 39 | if ( isset( $queryparts[1] ) ) { |
40 | 40 | $target_name = $queryparts[1]; |
41 | 41 | SFFormStart::doRedirect( $form_name, $target_name, $params ); |
42 | 42 | } |
43 | 43 | |
44 | | - // get namespace from the URL, if it's there |
| 44 | + // Get namespace from the URL, if it's there. |
45 | 45 | if ( $namespace_label_loc = strpos( $form_name, "/Namespace:" ) ) { |
46 | 46 | $target_namespace = substr( $form_name, $namespace_label_loc + 11 ); |
47 | 47 | $form_name = substr( $form_name, 0, $namespace_label_loc ); |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | | - // remove forbidden characters from form name |
| 51 | + // Remove forbidden characters from the form name. |
52 | 52 | $forbidden_chars = array( '"', "'", '<', '>', '{', '}', '(', ')', '[', ']', '=' ); |
53 | 53 | $form_name = str_replace( $forbidden_chars, "", $form_name ); |
54 | 54 | |
55 | | - // get title of form |
| 55 | + // Get title of form. |
56 | 56 | $form_title = Title::makeTitleSafe( SF_NS_FORM, $form_name ); |
57 | 57 | |
58 | | - // handle submission |
| 58 | + // Handle submission of this form. |
59 | 59 | $form_submitted = $wgRequest->getCheck( 'page_name' ); |
60 | 60 | if ( $form_submitted ) { |
61 | 61 | $page_name = $wgRequest->getVal( 'page_name' ); |
— | — | @@ -69,12 +69,12 @@ |
70 | 70 | // if this namespace was not already entered. |
71 | 71 | if ( strpos( $page_name, $target_namespace . ':' ) === false && $target_namespace != '' ) |
72 | 72 | $page_name = $target_namespace . ':' . $page_name; |
73 | | - // find out whether this page already exists, |
74 | | - // and send user to the appropriate form |
| 73 | + // If there was no page title, it's probably an |
| 74 | + // invalid page name, containing forbidden |
| 75 | + // characters - in that case, display an error |
| 76 | + // message. |
75 | 77 | $page_title = Title::newFromText( $page_name ); |
76 | 78 | if ( !$page_title ) { |
77 | | - //If there was no page title, it's probably an invalid page name, |
78 | | - // containing forbidden characters. |
79 | 79 | $wgOut->addHTML( htmlspecialchars( wfMsg( 'sf_formstart_badtitle', $page_name ) ) ); |
80 | 80 | return; |
81 | 81 | } else { |
— | — | @@ -101,8 +101,8 @@ |
102 | 102 | <p><input type="text" size="40" name="page_name"> |
103 | 103 | |
104 | 104 | END; |
105 | | - // if no form was specified, display a dropdown letting |
106 | | - // the user choose the form |
| 105 | + // If no form was specified, display a dropdown letting |
| 106 | + // the user choose the form. |
107 | 107 | if ( $form_name == '' ) |
108 | 108 | $text .= SFUtils::formDropdownHTML(); |
109 | 109 | |
— | — | @@ -157,9 +157,9 @@ |
158 | 158 | } else { |
159 | 159 | $fe = SpecialPage::getPage( 'FormEdit' ); |
160 | 160 | $redirect_url = $fe->getTitle()->getFullURL() . "/" . $form_name . "/" . SFUtils::titleURLString( $page_title ); |
161 | | - // of all the request values, send on to 'FormEdit' |
| 161 | + // Of all the request values, send on to 'FormEdit' |
162 | 162 | // only 'preload' and specific form fields - we can |
163 | | - // tell the latter because they show up as arrays |
| 163 | + // identify the latter because they show up as arrays. |
164 | 164 | foreach ( $_REQUEST as $key => $val ) { |
165 | 165 | if ( is_array( $val ) ) { |
166 | 166 | $template_name = $key; |
— | — | @@ -180,7 +180,8 @@ |
181 | 181 | } |
182 | 182 | |
183 | 183 | $wgOut->setArticleBodyOnly( true ); |
184 | | - // show "loading" animated image while people wait for the redirect |
| 184 | + // Show "loading" animated image while people wait for the |
| 185 | + // redirect. |
185 | 186 | global $sfgScriptPath; |
186 | 187 | $text = "<p style=\"position: absolute; left: 45%; top: 45%;\"><img src=\"$sfgScriptPath/skins/loading.gif\" /></p>\n"; |
187 | 188 | $text .= <<<END |