[TASK] Fix CGL violations against InlineControlStructure
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 29 Jun 2012 19:24:57 +0000 (21:24 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 29 Jun 2012 19:45:02 +0000 (21:45 +0200)
Fix CGL violations against InlineControlStructure

Change-Id: I4fcde4f6d0b5d0252154f254799b9cef8fedc775
Resolves: #38493
Releases: 6.0
Reviewed-on: http://review.typo3.org/12455
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/alt_shortcut.php
typo3/backend.php
typo3/class.browse_links.php
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/class.file_list.inc
typo3/class.show_rechis.inc
typo3/move_el.php
typo3/tab.js

index 7a0f0b3..f25f634 100644 (file)
@@ -205,7 +205,9 @@ class SC_alt_shortcut {
                        if (isset($_POST['_deletedok_x'])) {
                                $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'uid='.intval($this->whichItem).$addUSERWhere);
                                        // Just to have the checkbox set...
-                               if (!$this->editSC)     $this->editSC = -1;
+                               if (!$this->editSC) {
+                                       $this->editSC = -1;
+                               }
                        }
                }
        }
@@ -312,7 +314,9 @@ class SC_alt_shortcut {
                                $page_id = $this->getLinkedPageId($row['url']);
                                if (t3lib_utility_Math::canBeInterpretedAsInteger($page_id)) {
                                                // Check for webmount access
-                                       if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) continue;
+                                       if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) {
+                                               continue;
+                                       }
 
                                                // Check for record access
                                        $pageRow = t3lib_BEfunc::getRecord('pages', $page_id);
@@ -334,7 +338,9 @@ class SC_alt_shortcut {
                                        } else {
                                                $label = $GLOBALS['LANG']->getLL('shortcut_group_'.abs($sc_group), 1);
                                                        // Fallback label
-                                               if (!$label) $label = $GLOBALS['LANG']->getLL('shortcut_group', 1).' '.abs($sc_group);
+                                               if (!$label) {
+                                                       $label = $GLOBALS['LANG']->getLL('shortcut_group', 1).' '.abs($sc_group);
+                                               }
                                        }
 
                                        if ($sc_group >= 0) {
@@ -385,7 +391,9 @@ class SC_alt_shortcut {
                                        (is_array($this->theEditRec) ? '&nbsp;<strong>' . $GLOBALS['LANG']->getLL('bookmark_loadEdit', 1) . ' \'' . t3lib_BEfunc::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') .
                                        ($this->searchFor?'&nbsp;'.$GLOBALS['LANG']->getLL('bookmark_searchFor', 1).' <strong>\''.htmlspecialchars($this->searchFor).'\'</strong>':'').
                                        '</td>';
-               } else $editIdCode = '';
+               } else {
+                       $editIdCode = '';
+               }
 
                        // Adding CSH:
                $editIdCode .= '<td>&nbsp;'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'bookmarks', $GLOBALS['BACK_PATH'], '', TRUE).'</td>';
@@ -458,7 +466,7 @@ class SC_alt_shortcut {
                        $this->editLoaded = 1;
 
                        $opt = array();
-                       $opt[]='<option value="0"></option>';
+                       $opt[] = '<option value="0"></option>';
 
                        foreach ($this->groupLabels as $k => $v) {
                                if ($v && strcmp('1', $v)) {
@@ -466,7 +474,9 @@ class SC_alt_shortcut {
                                } else {
                                        $label = $GLOBALS['LANG']->getLL('bookmark_group_'.$k, 1);
                                                // Fallback label
-                                       if (!$label) $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.$k;
+                                       if (!$label) {
+                                               $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.$k;
+                                       }
                                }
                                $opt[] = '<option value="'.$k.'"'.(!strcmp($this->editSC_rec['sc_group'], $k)?' selected="selected"':'').'>'.$label.'</option>';
                        }
@@ -478,7 +488,9 @@ class SC_alt_shortcut {
                                        } else {
                                                $label = $GLOBALS['LANG']->getLL('bookmark_group_'.$k, 1);
                                                        // Fallback label
-                                               if (!$label) $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.$k;
+                                               if (!$label) {
+                                                       $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.$k;
+                                               }
                                        }
                                                // Add a prefix for global groups
                                        $label = $GLOBALS['LANG']->getLL('bookmark_global', 1).': '.$label;
@@ -489,7 +501,7 @@ class SC_alt_shortcut {
                        }
 
                                // border="0" hspace="2" width="21" height="16" - not XHTML compliant in <input type="image" ...>
-                       $manageForm='
+                       $manageForm = '
 
                                <!--
                                        Shortcut Editing Form:
@@ -508,7 +520,9 @@ class SC_alt_shortcut {
                                <input type="hidden" name="whichItem" value="'.$this->editSC_rec['uid'].'" />
 
                                ';
-               } else $manageForm = '';
+               } else {
+                       $manageForm = '';
+               }
 
                if (!$this->editLoaded && count($this->selOpt)>1) {
                        $this->lines[] = '<td>&nbsp;</td>';
@@ -537,7 +551,9 @@ class SC_alt_shortcut {
         * @return void
         */
        function editPageIdFunc() {
-               if (!t3lib_extMgm::isLoaded('cms'))     return;
+               if (!t3lib_extMgm::isLoaded('cms')) {
+                       return;
+               }
 
                        // EDIT page:
                $this->editPage = trim($GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $this->editPage, 'toLower'));
@@ -764,7 +780,9 @@ class SC_alt_shortcut {
                                $label .= '>'.$GLOBALS['LANG']->moduleLabels['tabs'][$modName.'_tab'];
                        }
                }
-               if ($M_modName) $label .= ' ('.$M_modName.')';
+               if ($M_modName) {
+                       $label .= ' ('.$M_modName.')';
+               }
                $label .= ': '.$inlabel;
                return $label;
        }
index 00a78e2..bc6504a 100644 (file)
@@ -336,10 +336,11 @@ class TYPO3backend {
                        if ($menu) {
                                $additionalAttributes = $toolbarItem->getAdditionalAttributes();
                                if (sizeof($this->toolbarItems) > 1 && $i == sizeof($this->toolbarItems) -1) {
-                                       if (strpos($additionalAttributes, 'class="'))
+                                       if (strpos($additionalAttributes, 'class="')) {
                                                str_replace('class="', 'class="separator ', $additionalAttributes);
-                                       else
+                                       } else {
                                                $additionalAttributes .= 'class="separator"';
+                                       }
                                }
                                $toolbar .= '<li' . $additionalAttributes . '>' .$menu. '</li>';
                        }
index a80101f..8aaa813 100644 (file)
@@ -252,7 +252,9 @@ class localPageTree extends t3lib_browseTree {
         */
        function printTree($treeArr = '') {
                $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
-               if (!is_array($treeArr)) $treeArr=$this->tree;
+               if (!is_array($treeArr)) {
+                       $treeArr = $this->tree;
+               }
 
                $out = '';
                $c = 0;
@@ -1103,19 +1105,21 @@ class browse_links {
                $this->doc->JScode.= $this->doc->wrapScriptTags($JScode);
 
                        // Debugging:
-               if (FALSE) debug(array(
-                       'pointer' => $this->pointer,
-                       'act' => $this->act,
-                       'mode' => $this->mode,
-                       'curUrlInfo' => $this->curUrlInfo,
-                       'curUrlArray' => $this->curUrlArray,
-                       'P' => $this->P,
-                       'bparams' => $this->bparams,
-                       'RTEtsConfigParams' => $this->RTEtsConfigParams,
-                       'expandPage' => $this->expandPage,
-                       'expandFolder' => $this->expandFolder,
-                       'PM' => $this->PM,
-               ), 'Internal variables of Script Class:');
+               if (FALSE) {
+                       debug(array(
+                               'pointer' => $this->pointer,
+                               'act' => $this->act,
+                               'mode' => $this->mode,
+                               'curUrlInfo' => $this->curUrlInfo,
+                               'curUrlArray' => $this->curUrlArray,
+                               'P' => $this->P,
+                               'bparams' => $this->bparams,
+                               'RTEtsConfigParams' => $this->RTEtsConfigParams,
+                               'expandPage' => $this->expandPage,
+                               'expandFolder' => $this->expandFolder,
+                               'PM' => $this->PM,
+                       ), 'Internal variables of Script Class:');
+               }
        }
 
        /**
@@ -1362,7 +1366,9 @@ class browse_links {
 
                                                                // URL + onclick event:
                                                        $onClickEvent = '';
-                                                       if (isset($v[$k2i.'.']['target']))      $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');";
+                                                       if (isset($v[$k2i.'.']['target'])) {
+                                                               $onClickEvent .= "browse_links_setTarget('".$v[$k2i.'.']['target']."');";
+                                                       }
                                                        $v[$k2i.'.']['url'] = str_replace('###_URL###', $this->siteURL, $v[$k2i.'.']['url']);
                                                        if (substr($v[$k2i.'.']['url'], 0, 7)=='http://' || substr($v[$k2i.'.']['url'], 0, 7)=='mailto:') {
                                                                $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
index 0ad9135..263cfc1 100644 (file)
@@ -270,7 +270,9 @@ class recordList extends t3lib_recordList {
                                                ? intval($GLOBALS['TCA'][$tableName]['interface']['maxDBListItems'])
                                                : $this->itemsLimitPerTable);
                                }
-                               if ($this->showLimit)   $this->iLimit = $this->showLimit;
+                               if ($this->showLimit) {
+                                       $this->iLimit = $this->showLimit;
+                               }
 
                                        // Setting fields to select:
                                if ($this->allFields) {
@@ -360,7 +362,9 @@ class recordList extends t3lib_recordList {
                $out = '';
 
                        // Checking if extension is loaded:
-               if (!t3lib_extMgm::isLoaded('sys_note')) return '';
+               if (!t3lib_extMgm::isLoaded('sys_note')) {
+                       return '';
+               }
 
                        // Create query for selecting the notes:
                $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_note', 'pid IN (' . $this->id . ') AND (personal=0 OR cruser=' . intval($GLOBALS['BE_USER']->user['uid']) . ')' . t3lib_BEfunc::deleteClause('sys_note') . t3lib_BEfunc::versioningPlaceholderClause('sys_note'));
@@ -478,7 +482,9 @@ class recordList extends t3lib_recordList {
                if ($this->sortField) {
                        if (in_array($this->sortField, $this->makeFieldList($table, 1))) {
                                $orderBy = 'ORDER BY '.$this->sortField;
-                               if ($this->sortRev)     $orderBy.=' DESC';
+                               if ($this->sortRev) {
+                                       $orderBy .= ' DESC';
+                               }
                        }
                }
 
index 0ce7652..6e6c6e9 100644 (file)
@@ -287,7 +287,10 @@ class localRecordList extends recordList {
                $selectFields[] = 'uid';
                $selectFields[] = 'pid';
                        // adding column for thumbnails
-               if ($thumbsCol) $selectFields[] = $thumbsCol;
+               if ($thumbsCol) {
+                       $selectFields[] = $thumbsCol;
+               }
+
                if ($table == 'pages') {
                        if (t3lib_extMgm::isLoaded('cms')) {
                                $selectFields[] = 'module';
@@ -414,13 +417,16 @@ class localRecordList extends recordList {
 
                                // Half line is drawn between tables:
                        if (!$listOnlyInSingleTableMode) {
-                               $theData = Array();
+                               $theData = array();
                                if (!$this->table && !$rowlist) {
                                        $theData[$titleCol] = '<img src="clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1" alt="" />';
-                                       if (in_array('_CONTROL_', $this->fieldArray))
-                                               $theData['_CONTROL_']='';
-                                       if (in_array('_CLIPBOARD_', $this->fieldArray))
-                                               $theData['_CLIPBOARD_']='';
+                                       if (in_array('_CONTROL_', $this->fieldArray)) {
+                                               $theData['_CONTROL_'] = '';
+                                       }
+
+                                       if (in_array('_CLIPBOARD_', $this->fieldArray)) {
+                                               $theData['_CLIPBOARD_'] = '';
+                                       }
                                }
                                $out .= $this->addelement(0, '', $theData, 'class="c-table-row-spacer"', $this->leftMargin);
                        }
@@ -494,7 +500,7 @@ class localRecordList extends recordList {
                                                                $this->currentTable['prevUid'][$row['uid']] = $prevUid;
                                                        }
                                                        $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
-                                                       $prevUid=$row['uid'];
+                                                       $prevUid = $row['uid'];
                                                }
                                        }
                                }
@@ -503,7 +509,9 @@ class localRecordList extends recordList {
                                $this->totalRowCount = count($accRows);
 
                                        // CSV initiated
-                               if ($this->csvOutput) $this->initCSV();
+                               if ($this->csvOutput) {
+                                       $this->initCSV();
+                               }
 
                                        // Render items:
                                $this->CBnames = array();
@@ -587,7 +595,9 @@ class localRecordList extends recordList {
 
                                // Output csv if...
                                // This ends the page with exit.
-                       if ($this->csvOutput)   $this->outputCSV($table);
+                       if ($this->csvOutput) {
+                               $this->outputCSV($table);
+                       }
                }
 
                        // Return content:
@@ -906,8 +916,10 @@ class localRecordList extends recordList {
                                                        // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
                                                if ($permsEdit && $this->table && is_array($currentIdList)) {
                                                        $editIdList = implode(',', $currentIdList);
-                                                       if ($this->clipNumPane())
+                                                       if ($this->clipNumPane()) {
                                                                $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
+                                                       }
+
                                                        $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
                                                        $icon  .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1 )) . '" title="' . $GLOBALS['LANG']->getLL('editShownColumns', TRUE) . '">' .
                                                                        t3lib_iconWorks::getSpriteIcon('actions-document-open') .
@@ -935,8 +947,10 @@ class localRecordList extends recordList {
                                                        // If the table can be edited, add link for editing THIS field for all listed records:
                                                if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
                                                        $editIdList = implode(',', $currentIdList);
-                                                       if ($this->clipNumPane())
+                                                       if ($this->clipNumPane()) {
                                                                $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
+                                                       }
+
                                                        $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                                                        $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'), rtrim(trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol))), ':'));
                                                        $theData[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' .
@@ -1111,8 +1125,9 @@ class localRecordList extends recordList {
         * @return string HTML table with the control panel (unless disabled)
         */
        function makeControl($table, $row) {
-               if ($this->dontShowClipControlPanels)
+               if ($this->dontShowClipControlPanels) {
                        return '';
+               }
 
                $rowUid = $row['uid'];
                if (t3lib_extMgm::isLoaded('version') && isset($row['_ORIG_uid'])) {
@@ -1380,8 +1395,10 @@ class localRecordList extends recordList {
         */
        function makeClip($table, $row) {
                        // Return blank, if disabled:
-               if ($this->dontShowClipControlPanels) return '';
-               $cells=array();
+               if ($this->dontShowClipControlPanels) {
+                       return '';
+               }
+               $cells = array();
 
                $cells['pasteAfter'] = $cells['pasteInto'] = $this->spaceIcon;
                        //enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
@@ -1389,7 +1406,7 @@ class localRecordList extends recordList {
                        // Return blank, if disabled:
                        // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
                        // For the "Normal" pad:
-               if ($this->clipObj->current=='normal') {
+               if ($this->clipObj->current == 'normal') {
 
                                // Show copy/cut icons:
                        $isSel = (string)$this->clipObj->isSelected($table, $row['uid']);
@@ -1554,7 +1571,9 @@ class localRecordList extends recordList {
                                }
                        }
 
-                       if ($lNew)      $out[1].= $lNew;
+                       if ($lNew) {
+                               $out[1] .= $lNew;
+                       }
                } elseif ($row['l18n_parent']) {
                        $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
                }
@@ -1644,7 +1663,9 @@ class localRecordList extends recordList {
         */
        function linkClipboardHeaderIcon($string, $table, $cmd, $warning = '') {
                $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
-               if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
+               if ($warning) {
+                       $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
+               }
                return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
        }
 
@@ -1670,10 +1691,14 @@ class localRecordList extends recordList {
        function addSortLink($code, $field, $table) {
 
                        // Certain circumstances just return string right away (no links):
-               if ($field == '_CONTROL_' || $field == '_LOCALIZATION_' || $field == '_CLIPBOARD_' || $field == '_REF_' || $this->disableSingleTableView)       return $code;
+               if ($field == '_CONTROL_' || $field == '_LOCALIZATION_' || $field == '_CLIPBOARD_' || $field == '_REF_' || $this->disableSingleTableView) {
+                       return $code;
+               }
 
                        // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
-               if ($field == '_PATH_') $field = pid;
+               if ($field == '_PATH_') {
+                       $field = 'pid';
+               }
 
                        //       Create the sort link:
                $sortUrl = $this->listURL('', -1, 'sortField,sortRev,table,firstElementNumber') . '&table=' . $table . '&sortField=' . $field . '&sortRev=' . ($this->sortRev || ($this->sortField != $field) ? 0 : 1);
index afd93c5..28c6d58 100644 (file)
@@ -176,7 +176,9 @@ class fileList extends t3lib_recordList {
         */
        function linkClipboardHeaderIcon($string, $table, $cmd, $warning = '') {
                $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.submit();';
-               if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
+               if ($warning) {
+                       $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
+               }
                return '<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">'.$string.'</a>';
        }
 
index 55199b4..57d7307 100644 (file)
@@ -409,11 +409,12 @@ class recordHistory {
                                        foreach ($tmpFieldList as $key => $value) {
                                                $tmp = str_replace(':', '', $GLOBALS['LANG']->sl(t3lib_BEfunc::getItemLabel($entry['tablename'], $value), 1));
 
-                                               if ($tmp)
+                                               if ($tmp) {
                                                        $tmpFieldList[$key] = $tmp;
-                                               else
-                                                       // remove fields if no label available
+                                               } else {
+                                                               // remove fields if no label available
                                                        unset($tmpFieldList[$key]);
+                                               }
                                        }
                                        $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList));
                                } else {        // Display diff
index 08e7b78..a100162 100644 (file)
@@ -142,7 +142,9 @@ class ext_posMap_tt_content extends t3lib_positionMap {
         * @return string Wrapped title string.
         */
        function wrapRecordTitle($str, $row) {
-               if ($GLOBALS['SOBE']->moveUid==$row['uid'])     $str = '<strong>'.$str.'</strong>';
+               if ($GLOBALS['SOBE']->moveUid==$row['uid']) {
+                       $str = '<strong>'.$str.'</strong>';
+               }
                return parent::wrapRecordTitle($str, $row);
        }
 }
@@ -279,7 +281,9 @@ class SC_move_el {
                                $tt_content_rec = t3lib_BEfunc::getRecord('tt_content', $this->moveUid);
 
                                        // ?
-                               if (!$this->input_moveUid) $this->page_id = $tt_content_rec['pid'];
+                               if (!$this->input_moveUid) {
+                                       $this->page_id = $tt_content_rec['pid'];
+                               }
 
                                        // Checking if the parent page is readable:
                                $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
index 2be0002..145fab9 100644 (file)
@@ -14,22 +14,28 @@ function checkBrowser() {
        browserName = navigator.appName;
        browserVer = parseInt(navigator.appVersion);
 
-       ok=false;
-       if (browserName == "Microsoft Internet Explorer" && browserVer >= 4)    ok=true;
-       else if (browserName == "Netscape" && browserVer >= 3)  ok=true;
+       ok = false;
+       if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {
+               ok = true;
+       } else if (browserName == "Netscape" && browserVer >= 3) {
+               ok = true;
+       }
 
        return ok;
 }
 
        // Automatically change all textarea elements
 function changeTextareaElements() {
-       if(!checkBrowser()) return false;       // Stop unless we're using IE or Netscape (includes Mozilla family)
+       if (!checkBrowser()) {
+                       // Stop unless we're using IE or Netscape (includes Mozilla family)
+               return false;
+       }
 
        document.textAreas = document.getElementsByTagName("textarea");
 
-       for(i=0; i<document.textAreas.length; i++) {
+       for (i = 0; i < document.textAreas.length; i++) {
                        // Only change if the class parameter contains "enable-tab"
-               if(document.textAreas[i].className && document.textAreas[i].className.search(/(^| )enable-tab( |$)/) != -1) {
+               if (document.textAreas[i].className && document.textAreas[i].className.search(/(^| )enable-tab( |$)/) != -1) {
                        document.textAreas[i].textAreaID = i;
                        makeAdvancedTextArea(document.textAreas[i]);
                }
@@ -42,12 +48,16 @@ window.setTimeout("changeTextareaElements();", 200);
 
        // Turn textarea elements into "better" ones. Actually this is just adding some lines of JavaScript...
 function makeAdvancedTextArea(textArea) {
-       if(textArea.tagName.toLowerCase() != "textarea") return false;
+       if (textArea.tagName.toLowerCase() != "textarea") {
+               return false;
+       }
 
                // On attempt to leave the element:
                // Do not leave if this.dontLeave is true
        textArea.onblur = function(e) {
-               if(!this.dontLeave) return;
+               if (!this.dontLeave) {
+                       return;
+               }
                this.dontLeave = null;
                window.setTimeout("document.textAreas[" + this.textAreaID + "].restoreFocus()", 1);
                return false;
@@ -57,7 +67,7 @@ function makeAdvancedTextArea(textArea) {
        textArea.restoreFocus = function() {
                this.focus();
 
-               if(this.caretPos) {
+               if (this.caretPos) {
                        this.caretPos.collapse(false);
                        this.caretPos.select();
                }
@@ -65,9 +75,9 @@ function makeAdvancedTextArea(textArea) {
 
                // Determine the current cursor position
        textArea.getCursorPos = function() {
-               if(this.selectionStart) {
+               if (this.selectionStart) {
                        currPos = this.selectionStart;
-               } else if(this.caretPos)        {       // This is very tricky in IE :-(
+               } else if (this.caretPos) {     // This is very tricky in IE :-(
                        oldText = this.caretPos.text;
                        finder = "--getcurrpos" + Math.round(Math.random() * 10000) + "--";
                        this.caretPos.text += finder;
@@ -77,44 +87,56 @@ function makeAdvancedTextArea(textArea) {
                        this.caretPos.text = "";
 
                        this.caretPos.scrollIntoView(true);
-               } else return;
+               } else {
+                       return;
+               }
 
                return currPos;
        }
 
                // On tab, insert a tabulator. Otherwise, check if a slash (/) was pressed.
        textArea.onkeydown = function(e) {
-               if(this.selectionStart == null &! this.createTextRange) return;
-               if(!e) e = window.event;
+               if (this.selectionStart == null &! this.createTextRange) {
+                       return;
+               }
+               if (!e) {
+                       e = window.event;
+               }
 
                        // Tabulator
-               if(e.keyCode == 9) {
+               if (e.keyCode == 9) {
                        this.dontLeave = true;
                        this.textInsert(String.fromCharCode(9));
                }
 
                        // Newline
-               if(e.keyCode == 13) {
+               if (e.keyCode == 13) {
                                // Get the cursor position
                        currPos = this.getCursorPos();
 
                                // Search the last line
                        lastLine = "";
-                       for(i=currPos-1;i>=0;i--) {
-                               if(this.value.substring(i, i + 1) == '\n') break;
+                       for (i = currPos - 1; i >= 0; i--) {
+                               if(this.value.substring(i, i + 1) == '\n') {
+                                       break;
+                               }
                        }
                        lastLine = this.value.substring(i + 1, currPos);
 
                                // Search for whitespaces in the current line
                        whiteSpace = "";
-                       for(i=0;i<lastLine.length;i++) {
-                               if(lastLine.substring(i, i + 1) == '\t') whiteSpace += "\t";
-                               else if(lastLine.substring(i, i + 1) == ' ') whiteSpace += " ";
-                               else break;
+                       for (i = 0; i < lastLine.length; i++) {
+                               if (lastLine.substring(i, i + 1) == '\t') {
+                                       whiteSpace += "\t";
+                               } else if (lastLine.substring(i, i + 1) == ' ') {
+                                       whiteSpace += " ";
+                               } else {
+                                       break;
+                               }
                        }
 
                                // Another ugly IE hack
-                       if(navigator.appVersion.match(/MSIE/)) {
+                       if (navigator.appVersion.match(/MSIE/)) {
                                whiteSpace = "\\n" + whiteSpace;
                        }
 
@@ -125,18 +147,18 @@ function makeAdvancedTextArea(textArea) {
 
                // Save the current cursor position in IE
        textArea.onkeyup = textArea.onclick = textArea.onselect = function(e) {
-               if(this.createTextRange) {
+               if (this.createTextRange) {
                        this.caretPos = document.selection.createRange().duplicate();
                }
        }
 
                // Insert text at the current cursor position
        textArea.textInsert = function(insertText) {
-               if(this.selectionStart != null) {
+               if (this.selectionStart != null) {
                        var savedScrollTop = this.scrollTop;
                        var begin = this.selectionStart;
                        var end = this.selectionEnd;
-                       if(end > begin + 1) {
+                       if (end > begin + 1) {
                                this.value = this.value.substr(0, begin) + insertText + this.value.substr(end);
                        } else {
                                this.value = this.value.substr(0, begin) + insertText + this.value.substr(begin);
@@ -145,7 +167,7 @@ function makeAdvancedTextArea(textArea) {
                        this.selectionStart = begin + insertText.length;
                        this.selectionEnd = begin + insertText.length;
                        this.scrollTop = savedScrollTop;
-               } else if(this.caretPos) {
+               } else if (this.caretPos) {
                        this.caretPos.text = insertText;
                        this.caretPos.scrollIntoView(true);
                } else {
@@ -154,4 +176,4 @@ function makeAdvancedTextArea(textArea) {
 
                this.focus();
        }
-}
+}
\ No newline at end of file