r81855 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81854‎ | r81855 | r81856 >
Date:22:50, 9 February 2011
Author:yaron
Status:deferred
Tags:
Comment:
Improved comments
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -29,32 +29,32 @@
3030 $super_page = $wgRequest->getVal( 'super_page' );
3131 $params = $wgRequest->getVal( 'params' );
3232
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
3434 if ( ! $form_name ) {
3535 $queryparts = explode( '/', $query, 2 );
3636 $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.
3939 if ( isset( $queryparts[1] ) ) {
4040 $target_name = $queryparts[1];
4141 SFFormStart::doRedirect( $form_name, $target_name, $params );
4242 }
4343
44 - // get namespace from the URL, if it's there
 44+ // Get namespace from the URL, if it's there.
4545 if ( $namespace_label_loc = strpos( $form_name, "/Namespace:" ) ) {
4646 $target_namespace = substr( $form_name, $namespace_label_loc + 11 );
4747 $form_name = substr( $form_name, 0, $namespace_label_loc );
4848 }
4949 }
5050
51 - // remove forbidden characters from form name
 51+ // Remove forbidden characters from the form name.
5252 $forbidden_chars = array( '"', "'", '<', '>', '{', '}', '(', ')', '[', ']', '=' );
5353 $form_name = str_replace( $forbidden_chars, "", $form_name );
5454
55 - // get title of form
 55+ // Get title of form.
5656 $form_title = Title::makeTitleSafe( SF_NS_FORM, $form_name );
5757
58 - // handle submission
 58+ // Handle submission of this form.
5959 $form_submitted = $wgRequest->getCheck( 'page_name' );
6060 if ( $form_submitted ) {
6161 $page_name = $wgRequest->getVal( 'page_name' );
@@ -69,12 +69,12 @@
7070 // if this namespace was not already entered.
7171 if ( strpos( $page_name, $target_namespace . ':' ) === false && $target_namespace != '' )
7272 $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.
7577 $page_title = Title::newFromText( $page_name );
7678 if ( !$page_title ) {
77 - //If there was no page title, it's probably an invalid page name,
78 - // containing forbidden characters.
7979 $wgOut->addHTML( htmlspecialchars( wfMsg( 'sf_formstart_badtitle', $page_name ) ) );
8080 return;
8181 } else {
@@ -101,8 +101,8 @@
102102 <p><input type="text" size="40" name="page_name">
103103
104104 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.
107107 if ( $form_name == '' )
108108 $text .= SFUtils::formDropdownHTML();
109109
@@ -157,9 +157,9 @@
158158 } else {
159159 $fe = SpecialPage::getPage( 'FormEdit' );
160160 $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'
162162 // 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.
164164 foreach ( $_REQUEST as $key => $val ) {
165165 if ( is_array( $val ) ) {
166166 $template_name = $key;
@@ -180,7 +180,8 @@
181181 }
182182
183183 $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.
185186 global $sfgScriptPath;
186187 $text = "<p style=\"position: absolute; left: 45%; top: 45%;\"><img src=\"$sfgScriptPath/skins/loading.gif\" /></p>\n";
187188 $text .= <<<END