[TASK] Fix CGL violations against LogicalOperatorSpacing
authorAndy Grunwald <andygrunwald@gmail.com>
Sat, 7 Jul 2012 21:53:18 +0000 (23:53 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 8 Jul 2012 09:14:13 +0000 (11:14 +0200)
In the TYPO3 core and two system extensions, there are some
CGL violations against Squiz.WhiteSpace.LogicalOperatorSpacing.

Change-Id: I63d345b5a1f9024938574467f90d4d2662abe944
Fixes: #38740
Releases: 6.0
Reviewed-on: http://review.typo3.org/12701
Reviewed-by: Oliver Klee
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
t3lib/js/extjs/ExtDirect.StateProvider.js
t3lib/jsfunc.evalfield.js
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/UndoRedo/undo-redo.js
typo3/sysext/statictemplates/media/scripts/jsfunc.foldout.js
typo3/sysext/statictemplates/media/scripts/jsfunc.layermenu.js

index fb88288..f9ef13f 100644 (file)
@@ -262,7 +262,7 @@ Ext.extend(TYPO3.state.ExtDirectProvider, Ext.state.Provider, {
                                var name = item[this.paramNames.name];
                                var value = item[this.paramNames.value];
 
-                               if (value === undefined  || value === null) {
+                               if (value === undefined || value === null) {
                                        TYPO3.state.ExtDirectProvider.superclass.clear.call(this, name);
                                } else {
                                                // parent sets value and fires event
index 411113d..0666c54 100644 (file)
@@ -98,8 +98,8 @@ function evalFunc_caseSwitch(type,inVal) {
                case "alphanum_x":
                        for (var a=0;a<theVal.length;a++) {
                                var theChar = theVal.substr(a,1);
-                               var special = (theChar=='_'||theChar=='-');
-                               var alpha = (theChar>='a'&&theChar<='z') || (theChar>='A'&&theChar<='Z');
+                               var special = (theChar == '_' || theChar == '-');
+                               var alpha = (theChar >= 'a' && theChar <= 'z') || (theChar >= 'A' && theChar <= 'Z');
                                var num = (theChar>='0' && theChar<='9');
                                switch(type) {
                                        case "alphanum":        special=0;              break;
@@ -327,7 +327,7 @@ function evalFunc_input(type,inVal) {
                                                add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
                                        }
                                        var year = (values.values[1])?this.parseInt(values.values[1]):this.getYear(today);
-                                       if (  (year>=0&&year<38) || (year>=70&&year<100) || (year>=1902&&year<2038)     ) {
+                                       if ((year >= 0 && year < 38) || (year >= 70 && year<100) || (year >= 1902 && year < 2038)) {
                                                if (year<100) {
                                                        year = (year<38) ? year+=2000 : year+=1900;
                                                }
@@ -369,7 +369,7 @@ function evalFunc_input(type,inVal) {
                                        }
 
                                        var year = (values.values[3])?this.parseInt(values.values[3]):this.getYear(today);
-                                       if ( (year>=0&&year<38) || (year>=70&&year<100) || (year>=1902&&year<2038) ) {
+                                       if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year<2038)) {
                                                if (year<100) {
                                                        year = (year<38) ? year+=2000 : year+=1900;
                                                }
index 35971df..84160c0 100644 (file)
@@ -883,7 +883,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * In all browsers, it breaks the evaluation of the framework dimensions
         */
        initStyleChangeEventListener: function () {
-               if (this.isNested  && Ext.isGecko) {
+               if (this.isNested && Ext.isGecko) {
                        var options = {
                                stopEvent: true,
                                delay: 50
@@ -4314,7 +4314,7 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                                                        break;
                                                                }
                                                                var m = selection.anchorNode.data.match(HTMLArea.RE_url);
-                                                               if (m &&  a.href.match(selection.anchorNode.data.trim())) {
+                                                               if (m && a.href.match(selection.anchorNode.data.trim())) {
                                                                        var textNode = selection.anchorNode;
                                                                        var fn = function() {
                                                                                var m = textNode.data.match(HTMLArea.RE_url);
index 4841915..ce56829 100644 (file)
@@ -111,7 +111,7 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
                                        // Add each item
                                Ext.each(group, function (itemId) {
                                        convertedItemId = this.editorConfiguration.convertButtonId[itemId];
-                                       if ((!this.showButtons  || this.showButtons.indexOf(convertedItemId) !== -1)
+                                       if ((!this.showButtons || this.showButtons.indexOf(convertedItemId) !== -1)
                                                && (!this.hideButtons || this.hideButtons.indexOf(convertedItemId) === -1)) {
                                                var button = this.getButton(itemId);
                                                if (button && button.getXType() === 'htmlareabutton' && !button.hideInContextMenu) {
index d40ab28..14b524e 100644 (file)
@@ -129,10 +129,10 @@ HTMLArea.UndoRedo = Ext.extend(HTMLArea.Plugin, {
                }
                        // Get the html text
                var text = this.editor.getInnerHTML();
-               
+
                if (newSnapshot) {
                                // If previous slot contains the same text, a new one should not be used
-                       if (this.undoPosition == 0  || this.undoQueue[this.undoPosition - 1].text != text) {
+                       if (this.undoPosition == 0 || this.undoQueue[this.undoPosition - 1].text != text) {
                                this.undoQueue[this.undoPosition] = this.buildSnapshot();
                                this.undoQueue[this.undoPosition].time = currentTime;
                                this.undoQueue.length = this.undoPosition + 1;
index 2d7e20c..1b7281d 100644 (file)
@@ -6,11 +6,11 @@
 *
 *  Copyright notice
 *
-*  (c) 1998-2010 Kasper Skårhøj
+*  (c) 1998-2010 Kasper Skårhøj
 *  All rights reserved
 *
 *  This script is part of the TYPO3 tslib/ library provided by
-*  Kasper Skårhøj <kasper@typo3.com> together with TYPO3
+*  Kasper Skårhøj <kasper@typo3.com> together with TYPO3
 *
 *  Released under GNU/GPL (see license file in tslib/)
 *
@@ -27,15 +27,15 @@ function GF_makeMenu(obj,nest,adjustH){
        this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj);
        this.css= bw.ns4?this.el:this.el.style;
        this.ref= bw.ns4?this.el.document:document;
-       this.x= (bw.ns4||bw.opera)?this.css.left:this.el.offsetLeft;
-       this.y= (bw.ns4||bw.opera)?this.css.top:this.el.offsetTop;
-       this.height= (bw.ie4||bw.ie5||bw.ns6)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.opera?this.css.pixelHeight:0;
+       this.x= (bw.ns4 || bw.opera) ? this.css.left: this.el.offsetLeft;
+       this.y= (bw.ns4 || bw.opera) ? this.css.top: this.el.offsetTop;
+       this.height= (bw.ie4 || bw.ie5 || bw.ns6) ? this.el.offsetHeight: bw.ns4 ? this.ref.height: bw.opera ? this.css.pixelHeight: 0;
     this.vis= GF_visible;
        this.hideIt= GF_hideIt;
     this.showIt= GF_showIt;
     this.moveIt= GF_moveIt;
     this.moveBy= GF_moveBy;
-               // Added by Kasper Skårhøj:
+               // Added by Kasper Skårhøj:
        if (adjustH)    this.height = this.height+adjustH;
        return this
 }
index 7cd7425..5fb0763 100644 (file)
@@ -6,11 +6,11 @@
 *
 *  Copyright notice
 *
-*  (c) 1998-2010 Kasper Skårhøj
+*  (c) 1998-2010 Kasper Skårhøj
 *  All rights reserved
 *
 *  This script is part of the TYPO3 tslib/ library provided by
-*  Kasper Skårhøj <kasper@typo3.com> together with TYPO3
+*  Kasper Skårhøj <kasper@typo3.com> together with TYPO3
 *
 *  Released under GNU/GPL (see license file in tslib/)
 *
@@ -96,10 +96,10 @@ function GL_getObj(obj){
        this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document."+obj):document.getElementById(obj);
        this.css= bw.ns4?this.el:this.el.style;
        this.ref= bw.ns4?this.el.document:document;
-       this.x= (bw.ns4||bw.op5)?this.css.left:this.el.offsetLeft;
-       this.y= (bw.ns4||bw.op5)?this.css.top:this.el.offsetTop;
-       this.height= (bw.ie4||bw.ie5||bw.ns6||bw.op7)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.op4?this.css.pixelHeight:0;
-       this.width= (bw.ie4||bw.ie5||bw.ns6||bw.op7)?this.el.offsetWidth:bw.ns4?this.ref.width:bw.op4?this.css.pixelWidth:0;
+       this.x = (bw.ns4 || bw.op5) ? this.css.left: this.el.offsetLeft;
+       this.y = (bw.ns4 || bw.op5) ? this.css.top: this.el.offsetTop;
+       this.height = (bw.ie4 || bw.ie5 || bw.ns6 || bw.op7) ? this.el.offsetHeight: bw.ns4 ? this.ref.height: bw.op4 ? this.css.pixelHeight: 0;
+       this.width = (bw.ie4 || bw.ie5 || bw.ns6 || bw.op7) ? this.el.offsetWidth: bw.ns4 ? this.ref.width: bw.op4 ? this.css.pixelWidth: 0;
 
        return this;
 }
@@ -170,8 +170,8 @@ function GL_doTop(WMid,id) {
 }
        //Capturing mousemove
 function GL_getMouse(e) {
-       GLV_x= (bw.ns4||bw.ns5)?e.pageX:(bw.ie4||bw.op4)?event.x:(event.x-2)+document.body.scrollLeft;
-       GLV_y= (bw.ns4||bw.ns5)?e.pageY:(bw.ie4||bw.op4)?event.y:(event.y-2)+document.body.scrollTop;
+       GLV_x = (bw.ns4 || bw.ns5) ? e.pageX: (bw.ie4 || bw.op4) ? event.x: (event.x - 2) + document.body.scrollLeft;
+       GLV_y = (bw.ns4 || bw.ns5) ? e.pageY: (bw.ie4 || bw.op4) ? event.y: (event.y - 2) + document.body.scrollTop;
 }
 function GL_mouseMoveEvaluate(WMid)    {
        if (GLV_gap[WMid] && GLV_currentLayer[WMid]!=null)      {
@@ -194,7 +194,7 @@ function GL_hideAll(WMid)   {
 }
 
 function GL_iframer(WMid,id,state)     {
-       if (bw.ie4||bw.ie5) {
+       if (bw.ie4 || bw.ie5) {
                ifrmObj = bw.ie4?document.all["Iframe"+WMid]:document.getElementById("Iframe"+WMid);
                if (state) {
                        parentObj = bw.ie4?document.all[id]:document.getElementById(id);