Completed
Push — develop ( 24c9de...c5d946 )
by Zack
16:00
created
vendor/paragonie/sodium_compat/src/Core/Base64/Common.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      * @return string
22 22
      * @throws TypeError
23 23
      */
24
-    public static function encode($src)
24
+    public static function encode( $src )
25 25
     {
26
-        return self::doEncode($src, true);
26
+        return self::doEncode( $src, true );
27 27
     }
28 28
 
29 29
     /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      * @return string
36 36
      * @throws TypeError
37 37
      */
38
-    public static function encodeUnpadded($src)
38
+    public static function encodeUnpadded( $src )
39 39
     {
40
-        return self::doEncode($src, false);
40
+        return self::doEncode( $src, false );
41 41
     }
42 42
 
43 43
     /**
@@ -46,43 +46,43 @@  discard block
 block discarded – undo
46 46
      * @return string
47 47
      * @throws TypeError
48 48
      */
49
-    protected static function doEncode($src, $pad = true)
49
+    protected static function doEncode( $src, $pad = true )
50 50
     {
51 51
         $dest = '';
52
-        $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
52
+        $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
53 53
         // Main loop (no padding):
54
-        for ($i = 0; $i + 3 <= $srcLen; $i += 3) {
54
+        for ( $i = 0; $i + 3 <= $srcLen; $i += 3 ) {
55 55
             /** @var array<int, int> $chunk */
56
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 3));
57
-            $b0 = $chunk[1];
58
-            $b1 = $chunk[2];
59
-            $b2 = $chunk[3];
56
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, 3 ) );
57
+            $b0 = $chunk[ 1 ];
58
+            $b1 = $chunk[ 2 ];
59
+            $b2 = $chunk[ 3 ];
60 60
 
61 61
             $dest .=
62
-                self::encode6Bits(               $b0 >> 2       ) .
63
-                self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) .
64
-                self::encode6Bits((($b1 << 2) | ($b2 >> 6)) & 63) .
65
-                self::encode6Bits(  $b2                     & 63);
62
+                self::encode6Bits( $b0 >> 2 ) .
63
+                self::encode6Bits( ( ( $b0 << 4 ) | ( $b1 >> 4 ) ) & 63 ) .
64
+                self::encode6Bits( ( ( $b1 << 2 ) | ( $b2 >> 6 ) ) & 63 ) .
65
+                self::encode6Bits( $b2                     & 63 );
66 66
         }
67 67
         // The last chunk, which may have padding:
68
-        if ($i < $srcLen) {
68
+        if ( $i < $srcLen ) {
69 69
             /** @var array<int, int> $chunk */
70
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i));
71
-            $b0 = $chunk[1];
72
-            if ($i + 1 < $srcLen) {
73
-                $b1 = $chunk[2];
70
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, $srcLen - $i ) );
71
+            $b0 = $chunk[ 1 ];
72
+            if ( $i + 1 < $srcLen ) {
73
+                $b1 = $chunk[ 2 ];
74 74
                 $dest .=
75
-                    self::encode6Bits($b0 >> 2) .
76
-                    self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) .
77
-                    self::encode6Bits(($b1 << 2) & 63);
78
-                if ($pad) {
75
+                    self::encode6Bits( $b0 >> 2 ) .
76
+                    self::encode6Bits( ( ( $b0 << 4 ) | ( $b1 >> 4 ) ) & 63 ) .
77
+                    self::encode6Bits( ( $b1 << 2 ) & 63 );
78
+                if ( $pad ) {
79 79
                     $dest .= '=';
80 80
                 }
81 81
             } else {
82 82
                 $dest .=
83
-                    self::encode6Bits( $b0 >> 2) .
84
-                    self::encode6Bits(($b0 << 4) & 63);
85
-                if ($pad) {
83
+                    self::encode6Bits( $b0 >> 2 ) .
84
+                    self::encode6Bits( ( $b0 << 4 ) & 63 );
85
+                if ( $pad ) {
86 86
                     $dest .= '==';
87 87
                 }
88 88
             }
@@ -102,86 +102,86 @@  discard block
 block discarded – undo
102 102
      * @throws TypeError
103 103
      * @psalm-suppress RedundantCondition
104 104
      */
105
-    public static function decode($src, $strictPadding = false)
105
+    public static function decode( $src, $strictPadding = false )
106 106
     {
107 107
         // Remove padding
108
-        $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
109
-        if ($srcLen === 0) {
108
+        $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
109
+        if ( $srcLen === 0 ) {
110 110
             return '';
111 111
         }
112 112
 
113
-        if ($strictPadding) {
114
-            if (($srcLen & 3) === 0) {
115
-                if ($src[$srcLen - 1] === '=') {
113
+        if ( $strictPadding ) {
114
+            if ( ( $srcLen & 3 ) === 0 ) {
115
+                if ( $src[ $srcLen - 1 ] === '=' ) {
116 116
                     $srcLen--;
117
-                    if ($src[$srcLen - 1] === '=') {
117
+                    if ( $src[ $srcLen - 1 ] === '=' ) {
118 118
                         $srcLen--;
119 119
                     }
120 120
                 }
121 121
             }
122
-            if (($srcLen & 3) === 1) {
122
+            if ( ( $srcLen & 3 ) === 1 ) {
123 123
                 throw new RangeException(
124 124
                     'Incorrect padding'
125 125
                 );
126 126
             }
127
-            if ($src[$srcLen - 1] === '=') {
127
+            if ( $src[ $srcLen - 1 ] === '=' ) {
128 128
                 throw new RangeException(
129 129
                     'Incorrect padding'
130 130
                 );
131 131
             }
132 132
         } else {
133
-            $src = rtrim($src, '=');
134
-            $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
133
+            $src = rtrim( $src, '=' );
134
+            $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
135 135
         }
136 136
 
137 137
         $err = 0;
138 138
         $dest = '';
139 139
         // Main loop (no padding):
140
-        for ($i = 0; $i + 4 <= $srcLen; $i += 4) {
140
+        for ( $i = 0; $i + 4 <= $srcLen; $i += 4 ) {
141 141
             /** @var array<int, int> $chunk */
142
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 4));
143
-            $c0 = self::decode6Bits($chunk[1]);
144
-            $c1 = self::decode6Bits($chunk[2]);
145
-            $c2 = self::decode6Bits($chunk[3]);
146
-            $c3 = self::decode6Bits($chunk[4]);
142
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, 4 ) );
143
+            $c0 = self::decode6Bits( $chunk[ 1 ] );
144
+            $c1 = self::decode6Bits( $chunk[ 2 ] );
145
+            $c2 = self::decode6Bits( $chunk[ 3 ] );
146
+            $c3 = self::decode6Bits( $chunk[ 4 ] );
147 147
 
148 148
             $dest .= pack(
149 149
                 'CCC',
150
-                ((($c0 << 2) | ($c1 >> 4)) & 0xff),
151
-                ((($c1 << 4) | ($c2 >> 2)) & 0xff),
152
-                ((($c2 << 6) |  $c3      ) & 0xff)
150
+                ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff ),
151
+                ( ( ( $c1 << 4 ) | ( $c2 >> 2 ) ) & 0xff ),
152
+                ( ( ( $c2 << 6 ) | $c3 ) & 0xff )
153 153
             );
154
-            $err |= ($c0 | $c1 | $c2 | $c3) >> 8;
154
+            $err |= ( $c0 | $c1 | $c2 | $c3 ) >> 8;
155 155
         }
156 156
         // The last chunk, which may have padding:
157
-        if ($i < $srcLen) {
157
+        if ( $i < $srcLen ) {
158 158
             /** @var array<int, int> $chunk */
159
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i));
160
-            $c0 = self::decode6Bits($chunk[1]);
159
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, $srcLen - $i ) );
160
+            $c0 = self::decode6Bits( $chunk[ 1 ] );
161 161
 
162
-            if ($i + 2 < $srcLen) {
163
-                $c1 = self::decode6Bits($chunk[2]);
164
-                $c2 = self::decode6Bits($chunk[3]);
162
+            if ( $i + 2 < $srcLen ) {
163
+                $c1 = self::decode6Bits( $chunk[ 2 ] );
164
+                $c2 = self::decode6Bits( $chunk[ 3 ] );
165 165
                 $dest .= pack(
166 166
                     'CC',
167
-                    ((($c0 << 2) | ($c1 >> 4)) & 0xff),
168
-                    ((($c1 << 4) | ($c2 >> 2)) & 0xff)
167
+                    ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff ),
168
+                    ( ( ( $c1 << 4 ) | ( $c2 >> 2 ) ) & 0xff )
169 169
                 );
170
-                $err |= ($c0 | $c1 | $c2) >> 8;
171
-            } elseif ($i + 1 < $srcLen) {
172
-                $c1 = self::decode6Bits($chunk[2]);
170
+                $err |= ( $c0 | $c1 | $c2 ) >> 8;
171
+            } elseif ( $i + 1 < $srcLen ) {
172
+                $c1 = self::decode6Bits( $chunk[ 2 ] );
173 173
                 $dest .= pack(
174 174
                     'C',
175
-                    ((($c0 << 2) | ($c1 >> 4)) & 0xff)
175
+                    ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff )
176 176
                 );
177
-                $err |= ($c0 | $c1) >> 8;
178
-            } elseif ($i < $srcLen && $strictPadding) {
177
+                $err |= ( $c0 | $c1 ) >> 8;
178
+            } elseif ( $i < $srcLen && $strictPadding ) {
179 179
                 $err |= 1;
180 180
             }
181 181
         }
182 182
         /** @var bool $check */
183
-        $check = ($err === 0);
184
-        if (!$check) {
183
+        $check = ( $err === 0 );
184
+        if ( ! $check ) {
185 185
             throw new RangeException(
186 186
                 'Base64::decode() only expects characters in the correct base64 alphabet'
187 187
             );
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param int $src
201 201
      * @return int
202 202
      */
203
-    abstract protected static function decode6Bits($src);
203
+    abstract protected static function decode6Bits( $src );
204 204
 
205 205
     /**
206 206
      * Uses bitwise operators instead of table-lookups to turn 8-bit integers
@@ -209,5 +209,5 @@  discard block
 block discarded – undo
209 209
      * @param int $src
210 210
      * @return string
211 211
      */
212
-    abstract protected static function encode6Bits($src);
212
+    abstract protected static function encode6Bits( $src );
213 213
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Base64/UrlSafe.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
      * @return string
19 19
      * @throws TypeError
20 20
      */
21
-    public static function encode($src)
21
+    public static function encode( $src )
22 22
     {
23
-        return self::doEncode($src, true);
23
+        return self::doEncode( $src, true );
24 24
     }
25 25
 
26 26
     /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
      * @return string
33 33
      * @throws TypeError
34 34
      */
35
-    public static function encodeUnpadded($src)
35
+    public static function encodeUnpadded( $src )
36 36
     {
37
-        return self::doEncode($src, false);
37
+        return self::doEncode( $src, false );
38 38
     }
39 39
 
40 40
     /**
@@ -43,43 +43,43 @@  discard block
 block discarded – undo
43 43
      * @return string
44 44
      * @throws TypeError
45 45
      */
46
-    protected static function doEncode($src, $pad = true)
46
+    protected static function doEncode( $src, $pad = true )
47 47
     {
48 48
         $dest = '';
49
-        $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
49
+        $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
50 50
         // Main loop (no padding):
51
-        for ($i = 0; $i + 3 <= $srcLen; $i += 3) {
51
+        for ( $i = 0; $i + 3 <= $srcLen; $i += 3 ) {
52 52
             /** @var array<int, int> $chunk */
53
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 3));
54
-            $b0 = $chunk[1];
55
-            $b1 = $chunk[2];
56
-            $b2 = $chunk[3];
53
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, 3 ) );
54
+            $b0 = $chunk[ 1 ];
55
+            $b1 = $chunk[ 2 ];
56
+            $b2 = $chunk[ 3 ];
57 57
 
58 58
             $dest .=
59
-                self::encode6Bits(               $b0 >> 2       ) .
60
-                self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) .
61
-                self::encode6Bits((($b1 << 2) | ($b2 >> 6)) & 63) .
62
-                self::encode6Bits(  $b2                     & 63);
59
+                self::encode6Bits( $b0 >> 2 ) .
60
+                self::encode6Bits( ( ( $b0 << 4 ) | ( $b1 >> 4 ) ) & 63 ) .
61
+                self::encode6Bits( ( ( $b1 << 2 ) | ( $b2 >> 6 ) ) & 63 ) .
62
+                self::encode6Bits( $b2                     & 63 );
63 63
         }
64 64
         // The last chunk, which may have padding:
65
-        if ($i < $srcLen) {
65
+        if ( $i < $srcLen ) {
66 66
             /** @var array<int, int> $chunk */
67
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i));
68
-            $b0 = $chunk[1];
69
-            if ($i + 1 < $srcLen) {
70
-                $b1 = $chunk[2];
67
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, $srcLen - $i ) );
68
+            $b0 = $chunk[ 1 ];
69
+            if ( $i + 1 < $srcLen ) {
70
+                $b1 = $chunk[ 2 ];
71 71
                 $dest .=
72
-                    self::encode6Bits($b0 >> 2) .
73
-                    self::encode6Bits((($b0 << 4) | ($b1 >> 4)) & 63) .
74
-                    self::encode6Bits(($b1 << 2) & 63);
75
-                if ($pad) {
72
+                    self::encode6Bits( $b0 >> 2 ) .
73
+                    self::encode6Bits( ( ( $b0 << 4 ) | ( $b1 >> 4 ) ) & 63 ) .
74
+                    self::encode6Bits( ( $b1 << 2 ) & 63 );
75
+                if ( $pad ) {
76 76
                     $dest .= '=';
77 77
                 }
78 78
             } else {
79 79
                 $dest .=
80
-                    self::encode6Bits( $b0 >> 2) .
81
-                    self::encode6Bits(($b0 << 4) & 63);
82
-                if ($pad) {
80
+                    self::encode6Bits( $b0 >> 2 ) .
81
+                    self::encode6Bits( ( $b0 << 4 ) & 63 );
82
+                if ( $pad ) {
83 83
                     $dest .= '==';
84 84
                 }
85 85
             }
@@ -99,86 +99,86 @@  discard block
 block discarded – undo
99 99
      * @throws TypeError
100 100
      * @psalm-suppress RedundantCondition
101 101
      */
102
-    public static function decode($src, $strictPadding = false)
102
+    public static function decode( $src, $strictPadding = false )
103 103
     {
104 104
         // Remove padding
105
-        $srcLen = ParagonIE_Sodium_Core_Util::strlen($src);
106
-        if ($srcLen === 0) {
105
+        $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
106
+        if ( $srcLen === 0 ) {
107 107
             return '';
108 108
         }
109 109
 
110
-        if ($strictPadding) {
111
-            if (($srcLen & 3) === 0) {
112
-                if ($src[$srcLen - 1] === '=') {
110
+        if ( $strictPadding ) {
111
+            if ( ( $srcLen & 3 ) === 0 ) {
112
+                if ( $src[ $srcLen - 1 ] === '=' ) {
113 113
                     $srcLen--;
114
-                    if ($src[$srcLen - 1] === '=') {
114
+                    if ( $src[ $srcLen - 1 ] === '=' ) {
115 115
                         $srcLen--;
116 116
                     }
117 117
                 }
118 118
             }
119
-            if (($srcLen & 3) === 1) {
119
+            if ( ( $srcLen & 3 ) === 1 ) {
120 120
                 throw new RangeException(
121 121
                     'Incorrect padding'
122 122
                 );
123 123
             }
124
-            if ($src[$srcLen - 1] === '=') {
124
+            if ( $src[ $srcLen - 1 ] === '=' ) {
125 125
                 throw new RangeException(
126 126
                     'Incorrect padding'
127 127
                 );
128 128
             }
129 129
         } else {
130
-            $src = rtrim($src, '=');
131
-            $srcLen =  ParagonIE_Sodium_Core_Util::strlen($src);
130
+            $src = rtrim( $src, '=' );
131
+            $srcLen = ParagonIE_Sodium_Core_Util::strlen( $src );
132 132
         }
133 133
 
134 134
         $err = 0;
135 135
         $dest = '';
136 136
         // Main loop (no padding):
137
-        for ($i = 0; $i + 4 <= $srcLen; $i += 4) {
137
+        for ( $i = 0; $i + 4 <= $srcLen; $i += 4 ) {
138 138
             /** @var array<int, int> $chunk */
139
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, 4));
140
-            $c0 = self::decode6Bits($chunk[1]);
141
-            $c1 = self::decode6Bits($chunk[2]);
142
-            $c2 = self::decode6Bits($chunk[3]);
143
-            $c3 = self::decode6Bits($chunk[4]);
139
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, 4 ) );
140
+            $c0 = self::decode6Bits( $chunk[ 1 ] );
141
+            $c1 = self::decode6Bits( $chunk[ 2 ] );
142
+            $c2 = self::decode6Bits( $chunk[ 3 ] );
143
+            $c3 = self::decode6Bits( $chunk[ 4 ] );
144 144
 
145 145
             $dest .= pack(
146 146
                 'CCC',
147
-                ((($c0 << 2) | ($c1 >> 4)) & 0xff),
148
-                ((($c1 << 4) | ($c2 >> 2)) & 0xff),
149
-                ((($c2 << 6) | $c3) & 0xff)
147
+                ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff ),
148
+                ( ( ( $c1 << 4 ) | ( $c2 >> 2 ) ) & 0xff ),
149
+                ( ( ( $c2 << 6 ) | $c3 ) & 0xff )
150 150
             );
151
-            $err |= ($c0 | $c1 | $c2 | $c3) >> 8;
151
+            $err |= ( $c0 | $c1 | $c2 | $c3 ) >> 8;
152 152
         }
153 153
         // The last chunk, which may have padding:
154
-        if ($i < $srcLen) {
154
+        if ( $i < $srcLen ) {
155 155
             /** @var array<int, int> $chunk */
156
-            $chunk = unpack('C*', ParagonIE_Sodium_Core_Util::substr($src, $i, $srcLen - $i));
157
-            $c0 = self::decode6Bits($chunk[1]);
156
+            $chunk = unpack( 'C*', ParagonIE_Sodium_Core_Util::substr( $src, $i, $srcLen - $i ) );
157
+            $c0 = self::decode6Bits( $chunk[ 1 ] );
158 158
 
159
-            if ($i + 2 < $srcLen) {
160
-                $c1 = self::decode6Bits($chunk[2]);
161
-                $c2 = self::decode6Bits($chunk[3]);
159
+            if ( $i + 2 < $srcLen ) {
160
+                $c1 = self::decode6Bits( $chunk[ 2 ] );
161
+                $c2 = self::decode6Bits( $chunk[ 3 ] );
162 162
                 $dest .= pack(
163 163
                     'CC',
164
-                    ((($c0 << 2) | ($c1 >> 4)) & 0xff),
165
-                    ((($c1 << 4) | ($c2 >> 2)) & 0xff)
164
+                    ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff ),
165
+                    ( ( ( $c1 << 4 ) | ( $c2 >> 2 ) ) & 0xff )
166 166
                 );
167
-                $err |= ($c0 | $c1 | $c2) >> 8;
168
-            } elseif ($i + 1 < $srcLen) {
169
-                $c1 = self::decode6Bits($chunk[2]);
167
+                $err |= ( $c0 | $c1 | $c2 ) >> 8;
168
+            } elseif ( $i + 1 < $srcLen ) {
169
+                $c1 = self::decode6Bits( $chunk[ 2 ] );
170 170
                 $dest .= pack(
171 171
                     'C',
172
-                    ((($c0 << 2) | ($c1 >> 4)) & 0xff)
172
+                    ( ( ( $c0 << 2 ) | ( $c1 >> 4 ) ) & 0xff )
173 173
                 );
174
-                $err |= ($c0 | $c1) >> 8;
175
-            } elseif ($i < $srcLen && $strictPadding) {
174
+                $err |= ( $c0 | $c1 ) >> 8;
175
+            } elseif ( $i < $srcLen && $strictPadding ) {
176 176
                 $err |= 1;
177 177
             }
178 178
         }
179 179
         /** @var bool $check */
180
-        $check = ($err === 0);
181
-        if (!$check) {
180
+        $check = ( $err === 0 );
181
+        if ( ! $check ) {
182 182
             throw new RangeException(
183 183
                 'Base64::decode() only expects characters in the correct base64 alphabet'
184 184
             );
@@ -197,24 +197,24 @@  discard block
 block discarded – undo
197 197
      * @param int $src
198 198
      * @return int
199 199
      */
200
-    protected static function decode6Bits($src)
200
+    protected static function decode6Bits( $src )
201 201
     {
202 202
         $ret = -1;
203 203
 
204 204
         // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64
205
-        $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 64);
205
+        $ret += ( ( ( 0x40 - $src ) & ( $src - 0x5b ) ) >> 8 ) & ( $src - 64 );
206 206
 
207 207
         // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70
208
-        $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 70);
208
+        $ret += ( ( ( 0x60 - $src ) & ( $src - 0x7b ) ) >> 8 ) & ( $src - 70 );
209 209
 
210 210
         // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5
211
-        $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 5);
211
+        $ret += ( ( ( 0x2f - $src ) & ( $src - 0x3a ) ) >> 8 ) & ( $src + 5 );
212 212
 
213 213
         // if ($src == 0x2c) $ret += 62 + 1;
214
-        $ret += (((0x2c - $src) & ($src - 0x2e)) >> 8) & 63;
214
+        $ret += ( ( ( 0x2c - $src ) & ( $src - 0x2e ) ) >> 8 ) & 63;
215 215
 
216 216
         // if ($src == 0x5f) ret += 63 + 1;
217
-        $ret += (((0x5e - $src) & ($src - 0x60)) >> 8) & 64;
217
+        $ret += ( ( ( 0x5e - $src ) & ( $src - 0x60 ) ) >> 8 ) & 64;
218 218
 
219 219
         return $ret;
220 220
     }
@@ -226,22 +226,22 @@  discard block
 block discarded – undo
226 226
      * @param int $src
227 227
      * @return string
228 228
      */
229
-    protected static function encode6Bits($src)
229
+    protected static function encode6Bits( $src )
230 230
     {
231 231
         $diff = 0x41;
232 232
 
233 233
         // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6
234
-        $diff += ((25 - $src) >> 8) & 6;
234
+        $diff += ( ( 25 - $src ) >> 8 ) & 6;
235 235
 
236 236
         // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75
237
-        $diff -= ((51 - $src) >> 8) & 75;
237
+        $diff -= ( ( 51 - $src ) >> 8 ) & 75;
238 238
 
239 239
         // if ($src > 61) $diff += 0x2d - 0x30 - 10; // -13
240
-        $diff -= ((61 - $src) >> 8) & 13;
240
+        $diff -= ( ( 61 - $src ) >> 8 ) & 13;
241 241
 
242 242
         // if ($src > 62) $diff += 0x5f - 0x2b - 1; // 3
243
-        $diff += ((62 - $src) >> 8) & 49;
243
+        $diff += ( ( 62 - $src ) >> 8 ) & 49;
244 244
 
245
-        return pack('C', $src + $diff);
245
+        return pack( 'C', $src + $diff );
246 246
     }
247 247
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Curve25519/Fe.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_Curve25519_Fe', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_Curve25519_Fe', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
      * @param bool $save_indexes
29 29
      * @return self
30 30
      */
31
-    public static function fromArray($array, $save_indexes = null)
31
+    public static function fromArray( $array, $save_indexes = null )
32 32
     {
33
-        $count = count($array);
34
-        if ($save_indexes) {
35
-            $keys = array_keys($array);
33
+        $count = count( $array );
34
+        if ( $save_indexes ) {
35
+            $keys = array_keys( $array );
36 36
         } else {
37
-            $keys = range(0, $count - 1);
37
+            $keys = range( 0, $count - 1 );
38 38
         }
39
-        $array = array_values($array);
39
+        $array = array_values( $array );
40 40
         /** @var array<int, int> $keys */
41 41
 
42 42
         $obj = new ParagonIE_Sodium_Core_Curve25519_Fe();
43
-        if ($save_indexes) {
44
-            for ($i = 0; $i < $count; ++$i) {
45
-                $obj->offsetSet($keys[$i], $array[$i]);
43
+        if ( $save_indexes ) {
44
+            for ( $i = 0; $i < $count; ++$i ) {
45
+                $obj->offsetSet( $keys[ $i ], $array[ $i ] );
46 46
             }
47 47
         } else {
48
-            for ($i = 0; $i < $count; ++$i) {
49
-                $obj->offsetSet($i, $array[$i]);
48
+            for ( $i = 0; $i < $count; ++$i ) {
49
+                $obj->offsetSet( $i, $array[ $i ] );
50 50
             }
51 51
         }
52 52
         return $obj;
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
      * @return void
61 61
      * @psalm-suppress MixedArrayOffset
62 62
      */
63
-    #[ReturnTypeWillChange]
64
-    public function offsetSet($offset, $value)
63
+    #[ReturnTypeWillChange ]
64
+    public function offsetSet( $offset, $value )
65 65
     {
66
-        if (!is_int($value)) {
67
-            throw new InvalidArgumentException('Expected an integer');
66
+        if ( ! is_int( $value ) ) {
67
+            throw new InvalidArgumentException( 'Expected an integer' );
68 68
         }
69
-        if (is_null($offset)) {
70
-            $this->container[] = $value;
69
+        if ( is_null( $offset ) ) {
70
+            $this->container[ ] = $value;
71 71
         } else {
72
-            $this->container[$offset] = $value;
72
+            $this->container[ $offset ] = $value;
73 73
         }
74 74
     }
75 75
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
      * @return bool
81 81
      * @psalm-suppress MixedArrayOffset
82 82
      */
83
-    #[ReturnTypeWillChange]
84
-    public function offsetExists($offset)
83
+    #[ReturnTypeWillChange ]
84
+    public function offsetExists( $offset )
85 85
     {
86
-        return isset($this->container[$offset]);
86
+        return isset( $this->container[ $offset ] );
87 87
     }
88 88
 
89 89
     /**
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
      * @return void
94 94
      * @psalm-suppress MixedArrayOffset
95 95
      */
96
-    #[ReturnTypeWillChange]
97
-    public function offsetUnset($offset)
96
+    #[ReturnTypeWillChange ]
97
+    public function offsetUnset( $offset )
98 98
     {
99
-        unset($this->container[$offset]);
99
+        unset( $this->container[ $offset ] );
100 100
     }
101 101
 
102 102
     /**
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
      * @return int
107 107
      * @psalm-suppress MixedArrayOffset
108 108
      */
109
-    #[ReturnTypeWillChange]
110
-    public function offsetGet($offset)
109
+    #[ReturnTypeWillChange ]
110
+    public function offsetGet( $offset )
111 111
     {
112
-        if (!isset($this->container[$offset])) {
113
-            $this->container[$offset] = 0;
112
+        if ( ! isset( $this->container[ $offset ] ) ) {
113
+            $this->container[ $offset ] = 0;
114 114
         }
115
-        return (int) ($this->container[$offset]);
115
+        return (int)( $this->container[ $offset ] );
116 116
     }
117 117
 
118 118
     /**
@@ -122,6 +122,6 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function __debugInfo()
124 124
     {
125
-        return array(implode(', ', $this->container));
125
+        return array( implode( ', ', $this->container ) );
126 126
     }
127 127
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/HChaCha20.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_HChaCha20', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_HChaCha20', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
      * @return string
17 17
      * @throws TypeError
18 18
      */
19
-    public static function hChaCha20($in = '', $key = '', $c = null)
19
+    public static function hChaCha20( $in = '', $key = '', $c = null )
20 20
     {
21 21
         $ctx = array();
22 22
 
23
-        if ($c === null) {
24
-            $ctx[0] = 0x61707865;
25
-            $ctx[1] = 0x3320646e;
26
-            $ctx[2] = 0x79622d32;
27
-            $ctx[3] = 0x6b206574;
23
+        if ( $c === null ) {
24
+            $ctx[ 0 ] = 0x61707865;
25
+            $ctx[ 1 ] = 0x3320646e;
26
+            $ctx[ 2 ] = 0x79622d32;
27
+            $ctx[ 3 ] = 0x6b206574;
28 28
         } else {
29
-            $ctx[0] = self::load_4(self::substr($c,  0, 4));
30
-            $ctx[1] = self::load_4(self::substr($c,  4, 4));
31
-            $ctx[2] = self::load_4(self::substr($c,  8, 4));
32
-            $ctx[3] = self::load_4(self::substr($c, 12, 4));
29
+            $ctx[ 0 ] = self::load_4( self::substr( $c, 0, 4 ) );
30
+            $ctx[ 1 ] = self::load_4( self::substr( $c, 4, 4 ) );
31
+            $ctx[ 2 ] = self::load_4( self::substr( $c, 8, 4 ) );
32
+            $ctx[ 3 ] = self::load_4( self::substr( $c, 12, 4 ) );
33 33
         }
34
-        $ctx[4]  = self::load_4(self::substr($key,  0, 4));
35
-        $ctx[5]  = self::load_4(self::substr($key,  4, 4));
36
-        $ctx[6]  = self::load_4(self::substr($key,  8, 4));
37
-        $ctx[7]  = self::load_4(self::substr($key, 12, 4));
38
-        $ctx[8]  = self::load_4(self::substr($key, 16, 4));
39
-        $ctx[9]  = self::load_4(self::substr($key, 20, 4));
40
-        $ctx[10] = self::load_4(self::substr($key, 24, 4));
41
-        $ctx[11] = self::load_4(self::substr($key, 28, 4));
42
-        $ctx[12] = self::load_4(self::substr($in,   0, 4));
43
-        $ctx[13] = self::load_4(self::substr($in,   4, 4));
44
-        $ctx[14] = self::load_4(self::substr($in,   8, 4));
45
-        $ctx[15] = self::load_4(self::substr($in,  12, 4));
46
-        return self::hChaCha20Bytes($ctx);
34
+        $ctx[ 4 ]  = self::load_4( self::substr( $key, 0, 4 ) );
35
+        $ctx[ 5 ]  = self::load_4( self::substr( $key, 4, 4 ) );
36
+        $ctx[ 6 ]  = self::load_4( self::substr( $key, 8, 4 ) );
37
+        $ctx[ 7 ]  = self::load_4( self::substr( $key, 12, 4 ) );
38
+        $ctx[ 8 ]  = self::load_4( self::substr( $key, 16, 4 ) );
39
+        $ctx[ 9 ]  = self::load_4( self::substr( $key, 20, 4 ) );
40
+        $ctx[ 10 ] = self::load_4( self::substr( $key, 24, 4 ) );
41
+        $ctx[ 11 ] = self::load_4( self::substr( $key, 28, 4 ) );
42
+        $ctx[ 12 ] = self::load_4( self::substr( $in, 0, 4 ) );
43
+        $ctx[ 13 ] = self::load_4( self::substr( $in, 4, 4 ) );
44
+        $ctx[ 14 ] = self::load_4( self::substr( $in, 8, 4 ) );
45
+        $ctx[ 15 ] = self::load_4( self::substr( $in, 12, 4 ) );
46
+        return self::hChaCha20Bytes( $ctx );
47 47
     }
48 48
 
49 49
     /**
@@ -51,58 +51,58 @@  discard block
 block discarded – undo
51 51
      * @return string
52 52
      * @throws TypeError
53 53
      */
54
-    protected static function hChaCha20Bytes(array $ctx)
54
+    protected static function hChaCha20Bytes( array $ctx )
55 55
     {
56
-        $x0  = (int) $ctx[0];
57
-        $x1  = (int) $ctx[1];
58
-        $x2  = (int) $ctx[2];
59
-        $x3  = (int) $ctx[3];
60
-        $x4  = (int) $ctx[4];
61
-        $x5  = (int) $ctx[5];
62
-        $x6  = (int) $ctx[6];
63
-        $x7  = (int) $ctx[7];
64
-        $x8  = (int) $ctx[8];
65
-        $x9  = (int) $ctx[9];
66
-        $x10 = (int) $ctx[10];
67
-        $x11 = (int) $ctx[11];
68
-        $x12 = (int) $ctx[12];
69
-        $x13 = (int) $ctx[13];
70
-        $x14 = (int) $ctx[14];
71
-        $x15 = (int) $ctx[15];
56
+        $x0  = (int)$ctx[ 0 ];
57
+        $x1  = (int)$ctx[ 1 ];
58
+        $x2  = (int)$ctx[ 2 ];
59
+        $x3  = (int)$ctx[ 3 ];
60
+        $x4  = (int)$ctx[ 4 ];
61
+        $x5  = (int)$ctx[ 5 ];
62
+        $x6  = (int)$ctx[ 6 ];
63
+        $x7  = (int)$ctx[ 7 ];
64
+        $x8  = (int)$ctx[ 8 ];
65
+        $x9  = (int)$ctx[ 9 ];
66
+        $x10 = (int)$ctx[ 10 ];
67
+        $x11 = (int)$ctx[ 11 ];
68
+        $x12 = (int)$ctx[ 12 ];
69
+        $x13 = (int)$ctx[ 13 ];
70
+        $x14 = (int)$ctx[ 14 ];
71
+        $x15 = (int)$ctx[ 15 ];
72 72
 
73
-        for ($i = 0; $i < 10; ++$i) {
73
+        for ( $i = 0; $i < 10; ++$i ) {
74 74
             # QUARTERROUND( x0,  x4,  x8,  x12)
75
-            list($x0, $x4, $x8, $x12) = self::quarterRound($x0, $x4, $x8, $x12);
75
+            list( $x0, $x4, $x8, $x12 ) = self::quarterRound( $x0, $x4, $x8, $x12 );
76 76
 
77 77
             # QUARTERROUND( x1,  x5,  x9,  x13)
78
-            list($x1, $x5, $x9, $x13) = self::quarterRound($x1, $x5, $x9, $x13);
78
+            list( $x1, $x5, $x9, $x13 ) = self::quarterRound( $x1, $x5, $x9, $x13 );
79 79
 
80 80
             # QUARTERROUND( x2,  x6,  x10,  x14)
81
-            list($x2, $x6, $x10, $x14) = self::quarterRound($x2, $x6, $x10, $x14);
81
+            list( $x2, $x6, $x10, $x14 ) = self::quarterRound( $x2, $x6, $x10, $x14 );
82 82
 
83 83
             # QUARTERROUND( x3,  x7,  x11,  x15)
84
-            list($x3, $x7, $x11, $x15) = self::quarterRound($x3, $x7, $x11, $x15);
84
+            list( $x3, $x7, $x11, $x15 ) = self::quarterRound( $x3, $x7, $x11, $x15 );
85 85
 
86 86
             # QUARTERROUND( x0,  x5,  x10,  x15)
87
-            list($x0, $x5, $x10, $x15) = self::quarterRound($x0, $x5, $x10, $x15);
87
+            list( $x0, $x5, $x10, $x15 ) = self::quarterRound( $x0, $x5, $x10, $x15 );
88 88
 
89 89
             # QUARTERROUND( x1,  x6,  x11,  x12)
90
-            list($x1, $x6, $x11, $x12) = self::quarterRound($x1, $x6, $x11, $x12);
90
+            list( $x1, $x6, $x11, $x12 ) = self::quarterRound( $x1, $x6, $x11, $x12 );
91 91
 
92 92
             # QUARTERROUND( x2,  x7,  x8,  x13)
93
-            list($x2, $x7, $x8, $x13) = self::quarterRound($x2, $x7, $x8, $x13);
93
+            list( $x2, $x7, $x8, $x13 ) = self::quarterRound( $x2, $x7, $x8, $x13 );
94 94
 
95 95
             # QUARTERROUND( x3,  x4,  x9,  x14)
96
-            list($x3, $x4, $x9, $x14) = self::quarterRound($x3, $x4, $x9, $x14);
96
+            list( $x3, $x4, $x9, $x14 ) = self::quarterRound( $x3, $x4, $x9, $x14 );
97 97
         }
98 98
 
99
-        return self::store32_le((int) ($x0  & 0xffffffff)) .
100
-            self::store32_le((int) ($x1  & 0xffffffff)) .
101
-            self::store32_le((int) ($x2  & 0xffffffff)) .
102
-            self::store32_le((int) ($x3  & 0xffffffff)) .
103
-            self::store32_le((int) ($x12 & 0xffffffff)) .
104
-            self::store32_le((int) ($x13 & 0xffffffff)) .
105
-            self::store32_le((int) ($x14 & 0xffffffff)) .
106
-            self::store32_le((int) ($x15 & 0xffffffff));
99
+        return self::store32_le( (int)( $x0  & 0xffffffff ) ) .
100
+            self::store32_le( (int)( $x1  & 0xffffffff ) ) .
101
+            self::store32_le( (int)( $x2  & 0xffffffff ) ) .
102
+            self::store32_le( (int)( $x3  & 0xffffffff ) ) .
103
+            self::store32_le( (int)( $x12 & 0xffffffff ) ) .
104
+            self::store32_le( (int)( $x13 & 0xffffffff ) ) .
105
+            self::store32_le( (int)( $x14 & 0xffffffff ) ) .
106
+            self::store32_le( (int)( $x15 & 0xffffffff ) );
107 107
     }
108 108
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Poly1305/State.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_Poly1305_State', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_Poly1305_State', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -48,31 +48,31 @@  discard block
 block discarded – undo
48 48
      * @throws InvalidArgumentException
49 49
      * @throws TypeError
50 50
      */
51
-    public function __construct($key = '')
51
+    public function __construct( $key = '' )
52 52
     {
53
-        if (self::strlen($key) < 32) {
53
+        if ( self::strlen( $key ) < 32 ) {
54 54
             throw new InvalidArgumentException(
55 55
                 'Poly1305 requires a 32-byte key'
56 56
             );
57 57
         }
58 58
         /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
59 59
         $this->r = array(
60
-            (int) ((self::load_4(self::substr($key, 0, 4))) & 0x3ffffff),
61
-            (int) ((self::load_4(self::substr($key, 3, 4)) >> 2) & 0x3ffff03),
62
-            (int) ((self::load_4(self::substr($key, 6, 4)) >> 4) & 0x3ffc0ff),
63
-            (int) ((self::load_4(self::substr($key, 9, 4)) >> 6) & 0x3f03fff),
64
-            (int) ((self::load_4(self::substr($key, 12, 4)) >> 8) & 0x00fffff)
60
+            (int)( ( self::load_4( self::substr( $key, 0, 4 ) ) ) & 0x3ffffff ),
61
+            (int)( ( self::load_4( self::substr( $key, 3, 4 ) ) >> 2 ) & 0x3ffff03 ),
62
+            (int)( ( self::load_4( self::substr( $key, 6, 4 ) ) >> 4 ) & 0x3ffc0ff ),
63
+            (int)( ( self::load_4( self::substr( $key, 9, 4 ) ) >> 6 ) & 0x3f03fff ),
64
+            (int)( ( self::load_4( self::substr( $key, 12, 4 ) ) >> 8 ) & 0x00fffff )
65 65
         );
66 66
 
67 67
         /* h = 0 */
68
-        $this->h = array(0, 0, 0, 0, 0);
68
+        $this->h = array( 0, 0, 0, 0, 0 );
69 69
 
70 70
         /* save pad for later */
71 71
         $this->pad = array(
72
-            self::load_4(self::substr($key, 16, 4)),
73
-            self::load_4(self::substr($key, 20, 4)),
74
-            self::load_4(self::substr($key, 24, 4)),
75
-            self::load_4(self::substr($key, 28, 4)),
72
+            self::load_4( self::substr( $key, 16, 4 ) ),
73
+            self::load_4( self::substr( $key, 20, 4 ) ),
74
+            self::load_4( self::substr( $key, 24, 4 ) ),
75
+            self::load_4( self::substr( $key, 28, 4 ) ),
76 76
         );
77 77
 
78 78
         $this->leftover = 0;
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function __destruct()
86 86
     {
87
-        $this->r[0] ^= $this->r[0];
88
-        $this->r[1] ^= $this->r[1];
89
-        $this->r[2] ^= $this->r[2];
90
-        $this->r[3] ^= $this->r[3];
91
-        $this->r[4] ^= $this->r[4];
92
-        $this->h[0] ^= $this->h[0];
93
-        $this->h[1] ^= $this->h[1];
94
-        $this->h[2] ^= $this->h[2];
95
-        $this->h[3] ^= $this->h[3];
96
-        $this->h[4] ^= $this->h[4];
97
-        $this->pad[0] ^= $this->pad[0];
98
-        $this->pad[1] ^= $this->pad[1];
99
-        $this->pad[2] ^= $this->pad[2];
100
-        $this->pad[3] ^= $this->pad[3];
87
+        $this->r[ 0 ] ^= $this->r[ 0 ];
88
+        $this->r[ 1 ] ^= $this->r[ 1 ];
89
+        $this->r[ 2 ] ^= $this->r[ 2 ];
90
+        $this->r[ 3 ] ^= $this->r[ 3 ];
91
+        $this->r[ 4 ] ^= $this->r[ 4 ];
92
+        $this->h[ 0 ] ^= $this->h[ 0 ];
93
+        $this->h[ 1 ] ^= $this->h[ 1 ];
94
+        $this->h[ 2 ] ^= $this->h[ 2 ];
95
+        $this->h[ 3 ] ^= $this->h[ 3 ];
96
+        $this->h[ 4 ] ^= $this->h[ 4 ];
97
+        $this->pad[ 0 ] ^= $this->pad[ 0 ];
98
+        $this->pad[ 1 ] ^= $this->pad[ 1 ];
99
+        $this->pad[ 2 ] ^= $this->pad[ 2 ];
100
+        $this->pad[ 3 ] ^= $this->pad[ 3 ];
101 101
         $this->leftover = 0;
102 102
         $this->final = true;
103 103
     }
@@ -110,60 +110,60 @@  discard block
 block discarded – undo
110 110
      * @throws SodiumException
111 111
      * @throws TypeError
112 112
      */
113
-    public function update($message = '')
113
+    public function update( $message = '' )
114 114
     {
115
-        $bytes = self::strlen($message);
116
-        if ($bytes < 1) {
115
+        $bytes = self::strlen( $message );
116
+        if ( $bytes < 1 ) {
117 117
             return $this;
118 118
         }
119 119
 
120 120
         /* handle leftover */
121
-        if ($this->leftover) {
121
+        if ( $this->leftover ) {
122 122
             $want = ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE - $this->leftover;
123
-            if ($want > $bytes) {
123
+            if ( $want > $bytes ) {
124 124
                 $want = $bytes;
125 125
             }
126
-            for ($i = 0; $i < $want; ++$i) {
127
-                $mi = self::chrToInt($message[$i]);
128
-                $this->buffer[$this->leftover + $i] = $mi;
126
+            for ( $i = 0; $i < $want; ++$i ) {
127
+                $mi = self::chrToInt( $message[ $i ] );
128
+                $this->buffer[ $this->leftover + $i ] = $mi;
129 129
             }
130 130
             // We snip off the leftmost bytes.
131
-            $message = self::substr($message, $want);
132
-            $bytes = self::strlen($message);
131
+            $message = self::substr( $message, $want );
132
+            $bytes = self::strlen( $message );
133 133
             $this->leftover += $want;
134
-            if ($this->leftover < ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE) {
134
+            if ( $this->leftover < ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE ) {
135 135
                 // We still don't have enough to run $this->blocks()
136 136
                 return $this;
137 137
             }
138 138
 
139 139
             $this->blocks(
140
-                self::intArrayToString($this->buffer),
140
+                self::intArrayToString( $this->buffer ),
141 141
                 ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE
142 142
             );
143 143
             $this->leftover = 0;
144 144
         }
145 145
 
146 146
         /* process full blocks */
147
-        if ($bytes >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE) {
147
+        if ( $bytes >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE ) {
148 148
             /** @var int $want */
149
-            $want = $bytes & ~(ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE - 1);
150
-            if ($want >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE) {
151
-                $block = self::substr($message, 0, $want);
152
-                if (self::strlen($block) >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE) {
153
-                    $this->blocks($block, $want);
154
-                    $message = self::substr($message, $want);
155
-                    $bytes = self::strlen($message);
149
+            $want = $bytes & ~( ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE - 1 );
150
+            if ( $want >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE ) {
151
+                $block = self::substr( $message, 0, $want );
152
+                if ( self::strlen( $block ) >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE ) {
153
+                    $this->blocks( $block, $want );
154
+                    $message = self::substr( $message, $want );
155
+                    $bytes = self::strlen( $message );
156 156
                 }
157 157
             }
158 158
         }
159 159
 
160 160
         /* store leftover */
161
-        if ($bytes) {
162
-            for ($i = 0; $i < $bytes; ++$i) {
163
-                $mi = self::chrToInt($message[$i]);
164
-                $this->buffer[$this->leftover + $i] = $mi;
161
+        if ( $bytes ) {
162
+            for ( $i = 0; $i < $bytes; ++$i ) {
163
+                $mi = self::chrToInt( $message[ $i ] );
164
+                $this->buffer[ $this->leftover + $i ] = $mi;
165 165
             }
166
-            $this->leftover = (int) $this->leftover + $bytes;
166
+            $this->leftover = (int)$this->leftover + $bytes;
167 167
         }
168 168
         return $this;
169 169
     }
@@ -176,77 +176,77 @@  discard block
 block discarded – undo
176 176
      * @return self
177 177
      * @throws TypeError
178 178
      */
179
-    public function blocks($message, $bytes)
179
+    public function blocks( $message, $bytes )
180 180
     {
181
-        if (self::strlen($message) < 16) {
182
-            $message = str_pad($message, 16, "\x00", STR_PAD_RIGHT);
181
+        if ( self::strlen( $message ) < 16 ) {
182
+            $message = str_pad( $message, 16, "\x00", STR_PAD_RIGHT );
183 183
         }
184 184
         /** @var int $hibit */
185 185
         $hibit = $this->final ? 0 : 1 << 24; /* 1 << 128 */
186
-        $r0 = (int) $this->r[0];
187
-        $r1 = (int) $this->r[1];
188
-        $r2 = (int) $this->r[2];
189
-        $r3 = (int) $this->r[3];
190
-        $r4 = (int) $this->r[4];
191
-
192
-        $s1 = self::mul($r1, 5, 3);
193
-        $s2 = self::mul($r2, 5, 3);
194
-        $s3 = self::mul($r3, 5, 3);
195
-        $s4 = self::mul($r4, 5, 3);
196
-
197
-        $h0 = $this->h[0];
198
-        $h1 = $this->h[1];
199
-        $h2 = $this->h[2];
200
-        $h3 = $this->h[3];
201
-        $h4 = $this->h[4];
202
-
203
-        while ($bytes >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE) {
186
+        $r0 = (int)$this->r[ 0 ];
187
+        $r1 = (int)$this->r[ 1 ];
188
+        $r2 = (int)$this->r[ 2 ];
189
+        $r3 = (int)$this->r[ 3 ];
190
+        $r4 = (int)$this->r[ 4 ];
191
+
192
+        $s1 = self::mul( $r1, 5, 3 );
193
+        $s2 = self::mul( $r2, 5, 3 );
194
+        $s3 = self::mul( $r3, 5, 3 );
195
+        $s4 = self::mul( $r4, 5, 3 );
196
+
197
+        $h0 = $this->h[ 0 ];
198
+        $h1 = $this->h[ 1 ];
199
+        $h2 = $this->h[ 2 ];
200
+        $h3 = $this->h[ 3 ];
201
+        $h4 = $this->h[ 4 ];
202
+
203
+        while ( $bytes >= ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE ) {
204 204
             /* h += m[i] */
205
-            $h0 +=  self::load_4(self::substr($message, 0, 4))       & 0x3ffffff;
206
-            $h1 += (self::load_4(self::substr($message, 3, 4)) >> 2) & 0x3ffffff;
207
-            $h2 += (self::load_4(self::substr($message, 6, 4)) >> 4) & 0x3ffffff;
208
-            $h3 += (self::load_4(self::substr($message, 9, 4)) >> 6) & 0x3ffffff;
209
-            $h4 += (self::load_4(self::substr($message, 12, 4)) >> 8) | $hibit;
205
+            $h0 += self::load_4( self::substr( $message, 0, 4 ) )       & 0x3ffffff;
206
+            $h1 += ( self::load_4( self::substr( $message, 3, 4 ) ) >> 2 ) & 0x3ffffff;
207
+            $h2 += ( self::load_4( self::substr( $message, 6, 4 ) ) >> 4 ) & 0x3ffffff;
208
+            $h3 += ( self::load_4( self::substr( $message, 9, 4 ) ) >> 6 ) & 0x3ffffff;
209
+            $h4 += ( self::load_4( self::substr( $message, 12, 4 ) ) >> 8 ) | $hibit;
210 210
 
211 211
             /* h *= r */
212 212
             $d0 = (
213
-                self::mul($h0, $r0, 25) +
214
-                self::mul($s4, $h1, 26) +
215
-                self::mul($s3, $h2, 26) +
216
-                self::mul($s2, $h3, 26) +
217
-                self::mul($s1, $h4, 26)
213
+                self::mul( $h0, $r0, 25 ) +
214
+                self::mul( $s4, $h1, 26 ) +
215
+                self::mul( $s3, $h2, 26 ) +
216
+                self::mul( $s2, $h3, 26 ) +
217
+                self::mul( $s1, $h4, 26 )
218 218
             );
219 219
 
220 220
             $d1 = (
221
-                self::mul($h0, $r1, 25) +
222
-                self::mul($h1, $r0, 25) +
223
-                self::mul($s4, $h2, 26) +
224
-                self::mul($s3, $h3, 26) +
225
-                self::mul($s2, $h4, 26)
221
+                self::mul( $h0, $r1, 25 ) +
222
+                self::mul( $h1, $r0, 25 ) +
223
+                self::mul( $s4, $h2, 26 ) +
224
+                self::mul( $s3, $h3, 26 ) +
225
+                self::mul( $s2, $h4, 26 )
226 226
             );
227 227
 
228 228
             $d2 = (
229
-                self::mul($h0, $r2, 25) +
230
-                self::mul($h1, $r1, 25) +
231
-                self::mul($h2, $r0, 25) +
232
-                self::mul($s4, $h3, 26) +
233
-                self::mul($s3, $h4, 26)
229
+                self::mul( $h0, $r2, 25 ) +
230
+                self::mul( $h1, $r1, 25 ) +
231
+                self::mul( $h2, $r0, 25 ) +
232
+                self::mul( $s4, $h3, 26 ) +
233
+                self::mul( $s3, $h4, 26 )
234 234
             );
235 235
 
236 236
             $d3 = (
237
-                self::mul($h0, $r3, 25) +
238
-                self::mul($h1, $r2, 25) +
239
-                self::mul($h2, $r1, 25) +
240
-                self::mul($h3, $r0, 25) +
241
-                self::mul($s4, $h4, 26)
237
+                self::mul( $h0, $r3, 25 ) +
238
+                self::mul( $h1, $r2, 25 ) +
239
+                self::mul( $h2, $r1, 25 ) +
240
+                self::mul( $h3, $r0, 25 ) +
241
+                self::mul( $s4, $h4, 26 )
242 242
             );
243 243
 
244 244
             $d4 = (
245
-                self::mul($h0, $r4, 25) +
246
-                self::mul($h1, $r3, 25) +
247
-                self::mul($h2, $r2, 25) +
248
-                self::mul($h3, $r1, 25) +
249
-                self::mul($h4, $r0, 25)
245
+                self::mul( $h0, $r4, 25 ) +
246
+                self::mul( $h1, $r3, 25 ) +
247
+                self::mul( $h2, $r2, 25 ) +
248
+                self::mul( $h3, $r1, 25 ) +
249
+                self::mul( $h4, $r0, 25 )
250 250
             );
251 251
 
252 252
             /* (partial) h %= p */
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             $c = $d4 >> 26;
279 279
             /** @var int $h4 */
280 280
             $h4 = $d4 & 0x3ffffff;
281
-            $h0 += (int) self::mul($c, 5, 3);
281
+            $h0 += (int)self::mul( $c, 5, 3 );
282 282
 
283 283
             /** @var int $c */
284 284
             $c = $h0 >> 26;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
         }
296 296
 
297 297
         $this->h = array(
298
-            (int) ($h0 & 0xffffffff),
299
-            (int) ($h1 & 0xffffffff),
300
-            (int) ($h2 & 0xffffffff),
301
-            (int) ($h3 & 0xffffffff),
302
-            (int) ($h4 & 0xffffffff)
298
+            (int)( $h0 & 0xffffffff ),
299
+            (int)( $h1 & 0xffffffff ),
300
+            (int)( $h2 & 0xffffffff ),
301
+            (int)( $h3 & 0xffffffff ),
302
+            (int)( $h4 & 0xffffffff )
303 303
         );
304 304
         return $this;
305 305
     }
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
     public function finish()
314 314
     {
315 315
         /* process the remaining block */
316
-        if ($this->leftover) {
316
+        if ( $this->leftover ) {
317 317
             $i = $this->leftover;
318
-            $this->buffer[$i++] = 1;
319
-            for (; $i < ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE; ++$i) {
320
-                $this->buffer[$i] = 0;
318
+            $this->buffer[ $i++ ] = 1;
319
+            for ( ; $i < ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE; ++$i ) {
320
+                $this->buffer[ $i ] = 0;
321 321
             }
322 322
             $this->final = true;
323 323
             $this->blocks(
324 324
                 self::substr(
325
-                    self::intArrayToString($this->buffer),
325
+                    self::intArrayToString( $this->buffer ),
326 326
                     0,
327 327
                     ParagonIE_Sodium_Core_Poly1305::BLOCK_SIZE
328 328
                 ),
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
             );
331 331
         }
332 332
 
333
-        $h0 = (int) $this->h[0];
334
-        $h1 = (int) $this->h[1];
335
-        $h2 = (int) $this->h[2];
336
-        $h3 = (int) $this->h[3];
337
-        $h4 = (int) $this->h[4];
333
+        $h0 = (int)$this->h[ 0 ];
334
+        $h1 = (int)$this->h[ 1 ];
335
+        $h2 = (int)$this->h[ 2 ];
336
+        $h3 = (int)$this->h[ 3 ];
337
+        $h4 = (int)$this->h[ 4 ];
338 338
 
339 339
         /** @var int $c */
340 340
         $c = $h1 >> 26;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $c = $h4 >> 26;
356 356
         $h4 &= 0x3ffffff;
357 357
         /** @var int $h0 */
358
-        $h0 += self::mul($c, 5, 3);
358
+        $h0 += self::mul( $c, 5, 3 );
359 359
         /** @var int $c */
360 360
         $c = $h0 >> 26;
361 361
         /** @var int $h0 */
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
         $g3 &= 0x3ffffff;
393 393
 
394 394
         /** @var int $g4 */
395
-        $g4 = ($h4 + $c - (1 << 26)) & 0xffffffff;
395
+        $g4 = ( $h4 + $c - ( 1 << 26 ) ) & 0xffffffff;
396 396
 
397 397
         /* select h if h < p, or h + -p if h >= p */
398 398
         /** @var int $mask */
399
-        $mask = ($g4 >> 31) - 1;
399
+        $mask = ( $g4 >> 31 ) - 1;
400 400
 
401 401
         $g0 &= $mask;
402 402
         $g1 &= $mask;
@@ -407,39 +407,39 @@  discard block
 block discarded – undo
407 407
         /** @var int $mask */
408 408
         $mask = ~$mask & 0xffffffff;
409 409
         /** @var int $h0 */
410
-        $h0 = ($h0 & $mask) | $g0;
410
+        $h0 = ( $h0 & $mask ) | $g0;
411 411
         /** @var int $h1 */
412
-        $h1 = ($h1 & $mask) | $g1;
412
+        $h1 = ( $h1 & $mask ) | $g1;
413 413
         /** @var int $h2 */
414
-        $h2 = ($h2 & $mask) | $g2;
414
+        $h2 = ( $h2 & $mask ) | $g2;
415 415
         /** @var int $h3 */
416
-        $h3 = ($h3 & $mask) | $g3;
416
+        $h3 = ( $h3 & $mask ) | $g3;
417 417
         /** @var int $h4 */
418
-        $h4 = ($h4 & $mask) | $g4;
418
+        $h4 = ( $h4 & $mask ) | $g4;
419 419
 
420 420
         /* h = h % (2^128) */
421 421
         /** @var int $h0 */
422
-        $h0 = (($h0) | ($h1 << 26)) & 0xffffffff;
422
+        $h0 = ( ( $h0 ) | ( $h1 << 26 ) ) & 0xffffffff;
423 423
         /** @var int $h1 */
424
-        $h1 = (($h1 >>  6) | ($h2 << 20)) & 0xffffffff;
424
+        $h1 = ( ( $h1 >> 6 ) | ( $h2 << 20 ) ) & 0xffffffff;
425 425
         /** @var int $h2 */
426
-        $h2 = (($h2 >> 12) | ($h3 << 14)) & 0xffffffff;
426
+        $h2 = ( ( $h2 >> 12 ) | ( $h3 << 14 ) ) & 0xffffffff;
427 427
         /** @var int $h3 */
428
-        $h3 = (($h3 >> 18) | ($h4 <<  8)) & 0xffffffff;
428
+        $h3 = ( ( $h3 >> 18 ) | ( $h4 << 8 ) ) & 0xffffffff;
429 429
 
430 430
         /* mac = (h + pad) % (2^128) */
431
-        $f = (int) ($h0 + $this->pad[0]);
432
-        $h0 = (int) $f;
433
-        $f = (int) ($h1 + $this->pad[1] + ($f >> 32));
434
-        $h1 = (int) $f;
435
-        $f = (int) ($h2 + $this->pad[2] + ($f >> 32));
436
-        $h2 = (int) $f;
437
-        $f = (int) ($h3 + $this->pad[3] + ($f >> 32));
438
-        $h3 = (int) $f;
439
-
440
-        return self::store32_le($h0 & 0xffffffff) .
441
-            self::store32_le($h1 & 0xffffffff) .
442
-            self::store32_le($h2 & 0xffffffff) .
443
-            self::store32_le($h3 & 0xffffffff);
431
+        $f = (int)( $h0 + $this->pad[ 0 ] );
432
+        $h0 = (int)$f;
433
+        $f = (int)( $h1 + $this->pad[ 1 ] + ( $f >> 32 ) );
434
+        $h1 = (int)$f;
435
+        $f = (int)( $h2 + $this->pad[ 2 ] + ( $f >> 32 ) );
436
+        $h2 = (int)$f;
437
+        $f = (int)( $h3 + $this->pad[ 3 ] + ( $f >> 32 ) );
438
+        $h3 = (int)$f;
439
+
440
+        return self::store32_le( $h0 & 0xffffffff ) .
441
+            self::store32_le( $h1 & 0xffffffff ) .
442
+            self::store32_le( $h2 & 0xffffffff ) .
443
+            self::store32_le( $h3 & 0xffffffff );
444 444
     }
445 445
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/ChaCha20.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_ChaCha20', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_ChaCha20', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
      * @param int $n
19 19
      * @return int
20 20
      */
21
-    public static function rotate($v, $n)
21
+    public static function rotate( $v, $n )
22 22
     {
23 23
         $v &= 0xffffffff;
24 24
         $n &= 31;
25
-        return (int) (
25
+        return (int)(
26 26
             0xffffffff & (
27
-                ($v << $n)
27
+                ( $v << $n )
28 28
                     |
29
-                ($v >> (32 - $n))
29
+                ( $v >> ( 32 - $n ) )
30 30
             )
31 31
         );
32 32
     }
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
      * @param int $d
43 43
      * @return array<int, int>
44 44
      */
45
-    protected static function quarterRound($a, $b, $c, $d)
45
+    protected static function quarterRound( $a, $b, $c, $d )
46 46
     {
47 47
         # a = PLUS(a,b); d = ROTATE(XOR(d,a),16);
48 48
         /** @var int $a */
49
-        $a = ($a + $b) & 0xffffffff;
50
-        $d = self::rotate($d ^ $a, 16);
49
+        $a = ( $a + $b ) & 0xffffffff;
50
+        $d = self::rotate( $d ^ $a, 16 );
51 51
 
52 52
         # c = PLUS(c,d); b = ROTATE(XOR(b,c),12);
53 53
         /** @var int $c */
54
-        $c = ($c + $d) & 0xffffffff;
55
-        $b = self::rotate($b ^ $c, 12);
54
+        $c = ( $c + $d ) & 0xffffffff;
55
+        $b = self::rotate( $b ^ $c, 12 );
56 56
 
57 57
         # a = PLUS(a,b); d = ROTATE(XOR(d,a), 8);
58 58
         /** @var int $a */
59
-        $a = ($a + $b) & 0xffffffff;
60
-        $d = self::rotate($d ^ $a, 8);
59
+        $a = ( $a + $b ) & 0xffffffff;
60
+        $d = self::rotate( $d ^ $a, 8 );
61 61
 
62 62
         # c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
63 63
         /** @var int $c */
64
-        $c = ($c + $d) & 0xffffffff;
65
-        $b = self::rotate($b ^ $c, 7);
66
-        return array((int) $a, (int) $b, (int) $c, (int) $d);
64
+        $c = ( $c + $d ) & 0xffffffff;
65
+        $b = self::rotate( $b ^ $c, 7 );
66
+        return array( (int)$a, (int)$b, (int)$c, (int)$d );
67 67
     }
68 68
 
69 69
     /**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         ParagonIE_Sodium_Core_ChaCha20_Ctx $ctx,
81 81
         $message = ''
82 82
     ) {
83
-        $bytes = self::strlen($message);
83
+        $bytes = self::strlen( $message );
84 84
 
85 85
         /*
86 86
         j0 = ctx->input[0];
@@ -100,71 +100,71 @@  discard block
 block discarded – undo
100 100
         j14 = ctx->input[14];
101 101
         j15 = ctx->input[15];
102 102
         */
103
-        $j0  = (int) $ctx[0];
104
-        $j1  = (int) $ctx[1];
105
-        $j2  = (int) $ctx[2];
106
-        $j3  = (int) $ctx[3];
107
-        $j4  = (int) $ctx[4];
108
-        $j5  = (int) $ctx[5];
109
-        $j6  = (int) $ctx[6];
110
-        $j7  = (int) $ctx[7];
111
-        $j8  = (int) $ctx[8];
112
-        $j9  = (int) $ctx[9];
113
-        $j10 = (int) $ctx[10];
114
-        $j11 = (int) $ctx[11];
115
-        $j12 = (int) $ctx[12];
116
-        $j13 = (int) $ctx[13];
117
-        $j14 = (int) $ctx[14];
118
-        $j15 = (int) $ctx[15];
103
+        $j0  = (int)$ctx[ 0 ];
104
+        $j1  = (int)$ctx[ 1 ];
105
+        $j2  = (int)$ctx[ 2 ];
106
+        $j3  = (int)$ctx[ 3 ];
107
+        $j4  = (int)$ctx[ 4 ];
108
+        $j5  = (int)$ctx[ 5 ];
109
+        $j6  = (int)$ctx[ 6 ];
110
+        $j7  = (int)$ctx[ 7 ];
111
+        $j8  = (int)$ctx[ 8 ];
112
+        $j9  = (int)$ctx[ 9 ];
113
+        $j10 = (int)$ctx[ 10 ];
114
+        $j11 = (int)$ctx[ 11 ];
115
+        $j12 = (int)$ctx[ 12 ];
116
+        $j13 = (int)$ctx[ 13 ];
117
+        $j14 = (int)$ctx[ 14 ];
118
+        $j15 = (int)$ctx[ 15 ];
119 119
 
120 120
         $c = '';
121
-        for (;;) {
122
-            if ($bytes < 64) {
123
-                $message .= str_repeat("\x00", 64 - $bytes);
121
+        for ( ;; ) {
122
+            if ( $bytes < 64 ) {
123
+                $message .= str_repeat( "\x00", 64 - $bytes );
124 124
             }
125 125
 
126
-            $x0 =  (int) $j0;
127
-            $x1 =  (int) $j1;
128
-            $x2 =  (int) $j2;
129
-            $x3 =  (int) $j3;
130
-            $x4 =  (int) $j4;
131
-            $x5 =  (int) $j5;
132
-            $x6 =  (int) $j6;
133
-            $x7 =  (int) $j7;
134
-            $x8 =  (int) $j8;
135
-            $x9 =  (int) $j9;
136
-            $x10 = (int) $j10;
137
-            $x11 = (int) $j11;
138
-            $x12 = (int) $j12;
139
-            $x13 = (int) $j13;
140
-            $x14 = (int) $j14;
141
-            $x15 = (int) $j15;
126
+            $x0 = (int)$j0;
127
+            $x1 = (int)$j1;
128
+            $x2 = (int)$j2;
129
+            $x3 = (int)$j3;
130
+            $x4 = (int)$j4;
131
+            $x5 = (int)$j5;
132
+            $x6 = (int)$j6;
133
+            $x7 = (int)$j7;
134
+            $x8 = (int)$j8;
135
+            $x9 = (int)$j9;
136
+            $x10 = (int)$j10;
137
+            $x11 = (int)$j11;
138
+            $x12 = (int)$j12;
139
+            $x13 = (int)$j13;
140
+            $x14 = (int)$j14;
141
+            $x15 = (int)$j15;
142 142
 
143 143
             # for (i = 20; i > 0; i -= 2) {
144
-            for ($i = 20; $i > 0; $i -= 2) {
144
+            for ( $i = 20; $i > 0; $i -= 2 ) {
145 145
                 # QUARTERROUND( x0,  x4,  x8,  x12)
146
-                list($x0, $x4, $x8, $x12) = self::quarterRound($x0, $x4, $x8, $x12);
146
+                list( $x0, $x4, $x8, $x12 ) = self::quarterRound( $x0, $x4, $x8, $x12 );
147 147
 
148 148
                 # QUARTERROUND( x1,  x5,  x9,  x13)
149
-                list($x1, $x5, $x9, $x13) = self::quarterRound($x1, $x5, $x9, $x13);
149
+                list( $x1, $x5, $x9, $x13 ) = self::quarterRound( $x1, $x5, $x9, $x13 );
150 150
 
151 151
                 # QUARTERROUND( x2,  x6,  x10,  x14)
152
-                list($x2, $x6, $x10, $x14) = self::quarterRound($x2, $x6, $x10, $x14);
152
+                list( $x2, $x6, $x10, $x14 ) = self::quarterRound( $x2, $x6, $x10, $x14 );
153 153
 
154 154
                 # QUARTERROUND( x3,  x7,  x11,  x15)
155
-                list($x3, $x7, $x11, $x15) = self::quarterRound($x3, $x7, $x11, $x15);
155
+                list( $x3, $x7, $x11, $x15 ) = self::quarterRound( $x3, $x7, $x11, $x15 );
156 156
 
157 157
                 # QUARTERROUND( x0,  x5,  x10,  x15)
158
-                list($x0, $x5, $x10, $x15) = self::quarterRound($x0, $x5, $x10, $x15);
158
+                list( $x0, $x5, $x10, $x15 ) = self::quarterRound( $x0, $x5, $x10, $x15 );
159 159
 
160 160
                 # QUARTERROUND( x1,  x6,  x11,  x12)
161
-                list($x1, $x6, $x11, $x12) = self::quarterRound($x1, $x6, $x11, $x12);
161
+                list( $x1, $x6, $x11, $x12 ) = self::quarterRound( $x1, $x6, $x11, $x12 );
162 162
 
163 163
                 # QUARTERROUND( x2,  x7,  x8,  x13)
164
-                list($x2, $x7, $x8, $x13) = self::quarterRound($x2, $x7, $x8, $x13);
164
+                list( $x2, $x7, $x8, $x13 ) = self::quarterRound( $x2, $x7, $x8, $x13 );
165 165
 
166 166
                 # QUARTERROUND( x3,  x4,  x9,  x14)
167
-                list($x3, $x4, $x9, $x14) = self::quarterRound($x3, $x4, $x9, $x14);
167
+                list( $x3, $x4, $x9, $x14 ) = self::quarterRound( $x3, $x4, $x9, $x14 );
168 168
             }
169 169
             /*
170 170
             x0 = PLUS(x0, j0);
@@ -185,37 +185,37 @@  discard block
 block discarded – undo
185 185
             x15 = PLUS(x15, j15);
186 186
             */
187 187
             /** @var int $x0 */
188
-            $x0  = ($x0 & 0xffffffff) + $j0;
188
+            $x0  = ( $x0 & 0xffffffff ) + $j0;
189 189
             /** @var int $x1 */
190
-            $x1  = ($x1 & 0xffffffff) + $j1;
190
+            $x1  = ( $x1 & 0xffffffff ) + $j1;
191 191
             /** @var int $x2 */
192
-            $x2  = ($x2 & 0xffffffff) + $j2;
192
+            $x2  = ( $x2 & 0xffffffff ) + $j2;
193 193
             /** @var int $x3 */
194
-            $x3  = ($x3 & 0xffffffff) + $j3;
194
+            $x3  = ( $x3 & 0xffffffff ) + $j3;
195 195
             /** @var int $x4 */
196
-            $x4  = ($x4 & 0xffffffff) + $j4;
196
+            $x4  = ( $x4 & 0xffffffff ) + $j4;
197 197
             /** @var int $x5 */
198
-            $x5  = ($x5 & 0xffffffff) + $j5;
198
+            $x5  = ( $x5 & 0xffffffff ) + $j5;
199 199
             /** @var int $x6 */
200
-            $x6  = ($x6 & 0xffffffff) + $j6;
200
+            $x6  = ( $x6 & 0xffffffff ) + $j6;
201 201
             /** @var int $x7 */
202
-            $x7  = ($x7 & 0xffffffff) + $j7;
202
+            $x7  = ( $x7 & 0xffffffff ) + $j7;
203 203
             /** @var int $x8 */
204
-            $x8  = ($x8 & 0xffffffff) + $j8;
204
+            $x8  = ( $x8 & 0xffffffff ) + $j8;
205 205
             /** @var int $x9 */
206
-            $x9  = ($x9 & 0xffffffff) + $j9;
206
+            $x9  = ( $x9 & 0xffffffff ) + $j9;
207 207
             /** @var int $x10 */
208
-            $x10 = ($x10 & 0xffffffff) + $j10;
208
+            $x10 = ( $x10 & 0xffffffff ) + $j10;
209 209
             /** @var int $x11 */
210
-            $x11 = ($x11 & 0xffffffff) + $j11;
210
+            $x11 = ( $x11 & 0xffffffff ) + $j11;
211 211
             /** @var int $x12 */
212
-            $x12 = ($x12 & 0xffffffff) + $j12;
212
+            $x12 = ( $x12 & 0xffffffff ) + $j12;
213 213
             /** @var int $x13 */
214
-            $x13 = ($x13 & 0xffffffff) + $j13;
214
+            $x13 = ( $x13 & 0xffffffff ) + $j13;
215 215
             /** @var int $x14 */
216
-            $x14 = ($x14 & 0xffffffff) + $j14;
216
+            $x14 = ( $x14 & 0xffffffff ) + $j14;
217 217
             /** @var int $x15 */
218
-            $x15 = ($x15 & 0xffffffff) + $j15;
218
+            $x15 = ( $x15 & 0xffffffff ) + $j15;
219 219
 
220 220
             /*
221 221
             x0 = XOR(x0, LOAD32_LE(m + 0));
@@ -235,22 +235,22 @@  discard block
 block discarded – undo
235 235
             x14 = XOR(x14, LOAD32_LE(m + 56));
236 236
             x15 = XOR(x15, LOAD32_LE(m + 60));
237 237
             */
238
-            $x0  ^= self::load_4(self::substr($message, 0, 4));
239
-            $x1  ^= self::load_4(self::substr($message, 4, 4));
240
-            $x2  ^= self::load_4(self::substr($message, 8, 4));
241
-            $x3  ^= self::load_4(self::substr($message, 12, 4));
242
-            $x4  ^= self::load_4(self::substr($message, 16, 4));
243
-            $x5  ^= self::load_4(self::substr($message, 20, 4));
244
-            $x6  ^= self::load_4(self::substr($message, 24, 4));
245
-            $x7  ^= self::load_4(self::substr($message, 28, 4));
246
-            $x8  ^= self::load_4(self::substr($message, 32, 4));
247
-            $x9  ^= self::load_4(self::substr($message, 36, 4));
248
-            $x10 ^= self::load_4(self::substr($message, 40, 4));
249
-            $x11 ^= self::load_4(self::substr($message, 44, 4));
250
-            $x12 ^= self::load_4(self::substr($message, 48, 4));
251
-            $x13 ^= self::load_4(self::substr($message, 52, 4));
252
-            $x14 ^= self::load_4(self::substr($message, 56, 4));
253
-            $x15 ^= self::load_4(self::substr($message, 60, 4));
238
+            $x0  ^= self::load_4( self::substr( $message, 0, 4 ) );
239
+            $x1  ^= self::load_4( self::substr( $message, 4, 4 ) );
240
+            $x2  ^= self::load_4( self::substr( $message, 8, 4 ) );
241
+            $x3  ^= self::load_4( self::substr( $message, 12, 4 ) );
242
+            $x4  ^= self::load_4( self::substr( $message, 16, 4 ) );
243
+            $x5  ^= self::load_4( self::substr( $message, 20, 4 ) );
244
+            $x6  ^= self::load_4( self::substr( $message, 24, 4 ) );
245
+            $x7  ^= self::load_4( self::substr( $message, 28, 4 ) );
246
+            $x8  ^= self::load_4( self::substr( $message, 32, 4 ) );
247
+            $x9  ^= self::load_4( self::substr( $message, 36, 4 ) );
248
+            $x10 ^= self::load_4( self::substr( $message, 40, 4 ) );
249
+            $x11 ^= self::load_4( self::substr( $message, 44, 4 ) );
250
+            $x12 ^= self::load_4( self::substr( $message, 48, 4 ) );
251
+            $x13 ^= self::load_4( self::substr( $message, 52, 4 ) );
252
+            $x14 ^= self::load_4( self::substr( $message, 56, 4 ) );
253
+            $x15 ^= self::load_4( self::substr( $message, 60, 4 ) );
254 254
 
255 255
             /*
256 256
                 j12 = PLUSONE(j12);
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
                 }
260 260
              */
261 261
             ++$j12;
262
-            if ($j12 & 0xf0000000) {
263
-                throw new SodiumException('Overflow');
262
+            if ( $j12 & 0xf0000000 ) {
263
+                throw new SodiumException( 'Overflow' );
264 264
             }
265 265
 
266 266
             /*
@@ -281,41 +281,41 @@  discard block
 block discarded – undo
281 281
             STORE32_LE(c + 56, x14);
282 282
             STORE32_LE(c + 60, x15);
283 283
             */
284
-            $block = self::store32_le((int) ($x0  & 0xffffffff)) .
285
-                 self::store32_le((int) ($x1  & 0xffffffff)) .
286
-                 self::store32_le((int) ($x2  & 0xffffffff)) .
287
-                 self::store32_le((int) ($x3  & 0xffffffff)) .
288
-                 self::store32_le((int) ($x4  & 0xffffffff)) .
289
-                 self::store32_le((int) ($x5  & 0xffffffff)) .
290
-                 self::store32_le((int) ($x6  & 0xffffffff)) .
291
-                 self::store32_le((int) ($x7  & 0xffffffff)) .
292
-                 self::store32_le((int) ($x8  & 0xffffffff)) .
293
-                 self::store32_le((int) ($x9  & 0xffffffff)) .
294
-                 self::store32_le((int) ($x10 & 0xffffffff)) .
295
-                 self::store32_le((int) ($x11 & 0xffffffff)) .
296
-                 self::store32_le((int) ($x12 & 0xffffffff)) .
297
-                 self::store32_le((int) ($x13 & 0xffffffff)) .
298
-                 self::store32_le((int) ($x14 & 0xffffffff)) .
299
-                 self::store32_le((int) ($x15 & 0xffffffff));
284
+            $block = self::store32_le( (int)( $x0  & 0xffffffff ) ) .
285
+                 self::store32_le( (int)( $x1  & 0xffffffff ) ) .
286
+                 self::store32_le( (int)( $x2  & 0xffffffff ) ) .
287
+                 self::store32_le( (int)( $x3  & 0xffffffff ) ) .
288
+                 self::store32_le( (int)( $x4  & 0xffffffff ) ) .
289
+                 self::store32_le( (int)( $x5  & 0xffffffff ) ) .
290
+                 self::store32_le( (int)( $x6  & 0xffffffff ) ) .
291
+                 self::store32_le( (int)( $x7  & 0xffffffff ) ) .
292
+                 self::store32_le( (int)( $x8  & 0xffffffff ) ) .
293
+                 self::store32_le( (int)( $x9  & 0xffffffff ) ) .
294
+                 self::store32_le( (int)( $x10 & 0xffffffff ) ) .
295
+                 self::store32_le( (int)( $x11 & 0xffffffff ) ) .
296
+                 self::store32_le( (int)( $x12 & 0xffffffff ) ) .
297
+                 self::store32_le( (int)( $x13 & 0xffffffff ) ) .
298
+                 self::store32_le( (int)( $x14 & 0xffffffff ) ) .
299
+                 self::store32_le( (int)( $x15 & 0xffffffff ) );
300 300
 
301 301
             /* Partial block */
302
-            if ($bytes < 64) {
303
-                $c .= self::substr($block, 0, $bytes);
302
+            if ( $bytes < 64 ) {
303
+                $c .= self::substr( $block, 0, $bytes );
304 304
                 break;
305 305
             }
306 306
 
307 307
             /* Full block */
308 308
             $c .= $block;
309 309
             $bytes -= 64;
310
-            if ($bytes <= 0) {
310
+            if ( $bytes <= 0 ) {
311 311
                 break;
312 312
             }
313
-            $message = self::substr($message, 64);
313
+            $message = self::substr( $message, 64 );
314 314
         }
315 315
         /* end for(;;) loop */
316 316
 
317
-        $ctx[12] = $j12;
318
-        $ctx[13] = $j13;
317
+        $ctx[ 12 ] = $j12;
318
+        $ctx[ 13 ] = $j13;
319 319
         return $c;
320 320
     }
321 321
 
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
      * @throws SodiumException
330 330
      * @throws TypeError
331 331
      */
332
-    public static function stream($len = 64, $nonce = '', $key = '')
332
+    public static function stream( $len = 64, $nonce = '', $key = '' )
333 333
     {
334 334
         return self::encryptBytes(
335
-            new ParagonIE_Sodium_Core_ChaCha20_Ctx($key, $nonce),
336
-            str_repeat("\x00", $len)
335
+            new ParagonIE_Sodium_Core_ChaCha20_Ctx( $key, $nonce ),
336
+            str_repeat( "\x00", $len )
337 337
         );
338 338
     }
339 339
 
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
      * @throws SodiumException
348 348
      * @throws TypeError
349 349
      */
350
-    public static function ietfStream($len, $nonce = '', $key = '')
350
+    public static function ietfStream( $len, $nonce = '', $key = '' )
351 351
     {
352 352
         return self::encryptBytes(
353
-            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx($key, $nonce),
354
-            str_repeat("\x00", $len)
353
+            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx( $key, $nonce ),
354
+            str_repeat( "\x00", $len )
355 355
         );
356 356
     }
357 357
 
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
      * @throws SodiumException
367 367
      * @throws TypeError
368 368
      */
369
-    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
369
+    public static function ietfStreamXorIc( $message, $nonce = '', $key = '', $ic = '' )
370 370
     {
371 371
         return self::encryptBytes(
372
-            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx($key, $nonce, $ic),
372
+            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx( $key, $nonce, $ic ),
373 373
             $message
374 374
         );
375 375
     }
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
      * @throws SodiumException
386 386
      * @throws TypeError
387 387
      */
388
-    public static function streamXorIc($message, $nonce = '', $key = '', $ic = '')
388
+    public static function streamXorIc( $message, $nonce = '', $key = '', $ic = '' )
389 389
     {
390 390
         return self::encryptBytes(
391
-            new ParagonIE_Sodium_Core_ChaCha20_Ctx($key, $nonce, $ic),
391
+            new ParagonIE_Sodium_Core_ChaCha20_Ctx( $key, $nonce, $ic ),
392 392
             $message
393 393
         );
394 394
     }
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function is_add_oembed_preview() {
71 71
 		/** The preview request is a parse-embed AJAX call without a type set. */
72
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
72
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
73 73
 	}
74 74
 
75 75
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return boolean
88 88
 	 */
89 89
 	public static function is_rest() {
90
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
90
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
91 91
 	}
92 92
 
93 93
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 					return false;
163 163
 				}
164 164
 
165
-				if ( ! in_array( $e['form_id'], $valid_forms ) ) {
165
+				if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) {
166 166
 					return false;
167 167
 				}
168 168
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			}
179 179
 
180 180
 			$entry = Multi_Entry::from_entries( array_filter( $multientry ) );
181
-		}  else {
181
+		} else {
182 182
 			/**
183 183
 			 * A regular one.
184 184
 			 */
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 			$get = $_GET;
237 237
 		}
238 238
 
239
-		unset( $get['mode'] );
239
+		unset( $get[ 'mode' ] );
240 240
 
241 241
 		$get = array_filter( $get, 'gravityview_is_not_empty_string' );
242 242
 
243
-		if( $has_field_key = $this->_has_field_key( $get ) ) {
243
+		if ( $has_field_key = $this->_has_field_key( $get ) ) {
244 244
 			return true;
245 245
 		}
246 246
 
247
-		return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] );
247
+		return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] );
248 248
 	}
249 249
 
250 250
 	/**
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 
268 268
 		$meta = array();
269 269
 		foreach ( $fields as $field ) {
270
-			if( empty( $field->_gf_field_class_name ) ) {
271
-				$meta[] = preg_quote( $field->name );
270
+			if ( empty( $field->_gf_field_class_name ) ) {
271
+				$meta[ ] = preg_quote( $field->name );
272 272
 			}
273 273
 		}
274 274
 
275 275
 		foreach ( $get as $key => $value ) {
276
-			if ( preg_match('/^(filter|input)_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) {
276
+			if ( preg_match( '/^(filter|input)_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) {
277 277
 				$has_field_key = true;
278 278
 				break;
279 279
 			}
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			'search_clear' => array(
56 56
 				'type'  => 'checkbox',
57 57
 				'label' => __( 'Show Clear button', 'gravityview' ),
58
-				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'),
58
+				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ),
59 59
 				'value' => true,
60 60
 			),
61 61
 			'search_fields' => array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				'type' => 'radio',
69 69
 				'full_width' => true,
70 70
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
71
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
71
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
72 72
 				'value' => 'any',
73 73
 				'class' => 'hide-if-js',
74 74
 				'options' => array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
89 89
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
90
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
90
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
91 91
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
92 92
 
93 93
 			// ajax - get the searchable fields
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function add_reserved_args( $args ) {
125 125
 
126
-		$args[] = 'gv_search';
127
-		$args[] = 'gv_start';
128
-		$args[] = 'gv_end';
129
-		$args[] = 'gv_id';
130
-		$args[] = 'gv_by';
131
-		$args[] = 'mode';
126
+		$args[ ] = 'gv_search';
127
+		$args[ ] = 'gv_start';
128
+		$args[ ] = 'gv_end';
129
+		$args[ ] = 'gv_id';
130
+		$args[ ] = 'gv_by';
131
+		$args[ ] = 'mode';
132 132
 
133
-		$get = (array) $_GET;
133
+		$get = (array)$_GET;
134 134
 
135 135
 		// If the fields being searched as reserved; not to be considered user-passed variables
136 136
 		foreach ( $get as $key => $value ) {
137 137
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
138
-				$args[] = $key;
138
+				$args[ ] = $key;
139 139
 			}
140 140
 		}
141 141
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
260 260
 		$script_source = empty( $script_min ) ? '/source' : '';
261 261
 
262
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
262
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
263 263
 
264 264
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
265 265
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
282 282
 	 */
283 283
 	public function register_no_conflict( $allowed ) {
284
-		$allowed[] = 'gravityview_searchwidget_admin';
284
+		$allowed[ ] = 'gravityview_searchwidget_admin';
285 285
 		return $allowed;
286 286
 	}
287 287
 
@@ -293,24 +293,24 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public static function get_searchable_fields() {
295 295
 
296
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
296
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
297 297
 			exit( '0' );
298 298
 		}
299 299
 
300 300
 		$form = '';
301 301
 
302 302
 		// Fetch the form for the current View
303
-		if ( ! empty( $_POST['view_id'] ) ) {
303
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
304 304
 
305
-			$form = gravityview_get_form_id( $_POST['view_id'] );
305
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
306 306
 
307
-		} elseif ( ! empty( $_POST['formid'] ) ) {
307
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
308 308
 
309
-			$form = (int) $_POST['formid'];
309
+			$form = (int)$_POST[ 'formid' ];
310 310
 
311
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
311
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
312 312
 
313
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
313
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
314 314
 
315 315
 		}
316 316
 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
363
-			$custom_fields['is_approved'] = array(
363
+			$custom_fields[ 'is_approved' ] = array(
364 364
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
365 365
 				'type' => 'multi',
366 366
 			);
367 367
 		}
368 368
 
369
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
370
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
369
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
370
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
371 371
 		}
372 372
 
373 373
 		// Get fields with sub-inputs and no parent
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 
390 390
 			foreach ( $fields as $id => $field ) {
391 391
 
392
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
392
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
393 393
 					continue;
394 394
 				}
395 395
 
396
-				$types = self::get_search_input_types( $id, $field['type'] );
396
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
397 397
 
398
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
398
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
399 399
 			}
400 400
 		}
401 401
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
419 419
 
420 420
 		// @todo - This needs to be improved - many fields have . including products and addresses
421
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
421
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
422 422
 			$input_type = 'boolean'; // on/off checkbox
423 423
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
424 424
 			$input_type = 'multi'; //multiselect
@@ -464,19 +464,19 @@  discard block
 block discarded – undo
464 464
 			$post_id = 0;
465 465
 
466 466
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
467
-			if ( ! empty( $widget_args['post_id'] ) ) {
468
-				$post_id = absint( $widget_args['post_id'] );
467
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
468
+				$post_id = absint( $widget_args[ 'post_id' ] );
469 469
 			}
470 470
 			// We're in the WordPress Widget context, and the base View ID should be used
471
-			else if ( ! empty( $widget_args['view_id'] ) ) {
472
-				$post_id = absint( $widget_args['view_id'] );
471
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
472
+				$post_id = absint( $widget_args[ 'view_id' ] );
473 473
 			}
474 474
 
475 475
 			$args = gravityview_get_permalink_query_args( $post_id );
476 476
 
477 477
 			// Add hidden fields to the search form
478 478
 			foreach ( $args as $key => $value ) {
479
-				$search_fields[] = array(
479
+				$search_fields[ ] = array(
480 480
 					'name'  => $key,
481 481
 					'input' => 'hidden',
482 482
 					'value' => $value,
@@ -515,28 +515,28 @@  discard block
 block discarded – undo
515 515
 		/**
516 516
 		 * Include the sidebar Widgets.
517 517
 		 */
518
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
518
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
519 519
 
520 520
 		foreach ( $widgets as $widget ) {
521
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
522
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
521
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
522
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
523 523
 					foreach ( $_fields as $field ) {
524
-						if ( empty( $field['form_id'] ) ) {
525
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
524
+						if ( empty( $field[ 'form_id' ] ) ) {
525
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
526 526
 						}
527
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
527
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
528 528
 					}
529 529
 				}
530 530
 			}
531 531
 		}
532 532
 
533 533
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
534
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
534
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
535 535
 				foreach ( $_fields as $field ) {
536
-					if ( empty( $field['form_id'] ) ) {
537
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
536
+					if ( empty( $field[ 'form_id' ] ) ) {
537
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
538 538
 					}
539
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
539
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
540 540
 				}
541 541
 			}
542 542
 		}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
583 583
 		}
584 584
 
585
-		if( 'post' === $this->search_method ) {
585
+		if ( 'post' === $this->search_method ) {
586 586
 			$get = $_POST;
587 587
 		} else {
588 588
 			$get = $_GET;
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		$get = gv_map_deep( $get, 'rawurldecode' );
604 604
 
605 605
 		// Make sure array key is set up
606
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
606
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
607 607
 
608 608
 		$searchable_fields = $this->get_view_searchable_fields( $view );
609 609
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
624 624
 
625 625
 		// add free search
626
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
626
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
627 627
 
628
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
628
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
629 629
 
630 630
 			if ( $split_words ) {
631 631
 				// Search for a piece
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 			}
642 642
 
643 643
 			foreach ( $words as $word ) {
644
-				$search_criteria['field_filters'][] = array(
644
+				$search_criteria[ 'field_filters' ][ ] = array(
645 645
 					'key' => null, // The field ID to search
646 646
 					'value' => $word, // The value to search
647 647
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -654,14 +654,14 @@  discard block
 block discarded – undo
654 654
 			/**
655 655
 			 * Get and normalize the dates according to the input format.
656 656
 			 */
657
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
658
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
657
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
658
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
659 659
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
660 660
 				}
661 661
 			}
662 662
 
663
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
664
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
663
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
664
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
665 665
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
666 666
 				}
667 667
 			}
@@ -697,22 +697,22 @@  discard block
 block discarded – undo
697 697
 			 */
698 698
 			if ( ! empty( $curr_start ) ) {
699 699
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
700
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
700
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
701 701
 			}
702 702
 
703 703
 			if ( ! empty( $curr_end ) ) {
704 704
 				// Fast-forward 24 hour on the end time
705 705
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
706
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
707
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
708
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
706
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
707
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
708
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
709 709
 				}
710 710
 			}
711 711
 		}
712 712
 
713 713
 		// search for a specific entry ID
714 714
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
715
-			$search_criteria['field_filters'][] = array(
715
+			$search_criteria[ 'field_filters' ][ ] = array(
716 716
 				'key' => 'id',
717 717
 				'value' => absint( $get[ 'gv_id' ] ),
718 718
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -721,15 +721,15 @@  discard block
 block discarded – undo
721 721
 
722 722
 		// search for a specific Created_by ID
723 723
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
724
-			$search_criteria['field_filters'][] = array(
724
+			$search_criteria[ 'field_filters' ][ ] = array(
725 725
 				'key' => 'created_by',
726
-				'value' => $get['gv_by'],
726
+				'value' => $get[ 'gv_by' ],
727 727
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
728 728
 			);
729 729
 		}
730 730
 
731 731
 		// Get search mode passed in URL
732
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
732
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
733 733
 
734 734
 		// get the other search filters
735 735
 		foreach ( $get as $key => $value ) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
748 748
 			}
749 749
 
750
-			if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
750
+			if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
751 751
 				/**
752 752
 				 * @filter `gravityview/search/ignore-empty-values` Filter to control if empty field values should be ignored or strictly matched (default: true)
753 753
 				 * @since  2.14.2.1
@@ -778,21 +778,21 @@  discard block
 block discarded – undo
778 778
 				continue;
779 779
 			}
780 780
 
781
-			if ( ! isset( $filter['operator'] ) ) {
782
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
781
+			if ( ! isset( $filter[ 'operator' ] ) ) {
782
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
783 783
 			}
784 784
 
785
-			if ( isset( $filter[0]['value'] ) ) {
786
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
785
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
786
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
787 787
 
788
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
788
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
789 789
 
790 790
 				// if date range type, set search mode to ALL
791
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
791
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
792 792
 					$mode = 'all';
793 793
 				}
794
-			} elseif( !empty( $filter ) ) {
795
-				$search_criteria['field_filters'][] = $filter;
794
+			} elseif ( ! empty( $filter ) ) {
795
+				$search_criteria[ 'field_filters' ][ ] = $filter;
796 796
 			}
797 797
 		}
798 798
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		 * @since 1.5.1
802 802
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
803 803
 		 */
804
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
804
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
805 805
 
806 806
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
807 807
 
@@ -835,19 +835,19 @@  discard block
 block discarded – undo
835 835
 
836 836
 		$query_class = $view->get_query_class();
837 837
 
838
-		if ( empty( $search_criteria['field_filters'] ) ) {
838
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
839 839
 			return;
840 840
 		}
841 841
 
842 842
 		$widgets = $view->widgets->by_id( $this->widget_id );
843 843
 		if ( $widgets->count() ) {
844 844
 			$widgets = $widgets->all();
845
-			$widget  = $widgets[0];
845
+			$widget  = $widgets[ 0 ];
846 846
 
847 847
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
848 848
 
849
-			foreach ( (array) $search_fields as $search_field ) {
850
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
849
+			foreach ( (array)$search_fields as $search_field ) {
850
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
851 851
 					$created_by_text_mode = true;
852 852
 				}
853 853
 			}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		$extra_conditions = array();
857 857
 		$mode = 'any';
858 858
 
859
-		foreach ( $search_criteria['field_filters'] as $key => &$filter ) {
859
+		foreach ( $search_criteria[ 'field_filters' ] as $key => &$filter ) {
860 860
 			if ( ! is_array( $filter ) ) {
861 861
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
862 862
 					$mode = $filter;
@@ -865,13 +865,13 @@  discard block
 block discarded – undo
865 865
 			}
866 866
 
867 867
 			// Construct a manual query for unapproved statuses
868
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
869
-				$_tmp_query       = new $query_class( $view->form->ID, array(
868
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
869
+				$_tmp_query = new $query_class( $view->form->ID, array(
870 870
 					'field_filters' => array(
871 871
 						array(
872 872
 							'operator' => 'in',
873 873
 							'key'      => 'is_approved',
874
-							'value'    => (array) $filter['value'],
874
+							'value'    => (array)$filter[ 'value' ],
875 875
 						),
876 876
 						array(
877 877
 							'operator' => 'is',
@@ -883,30 +883,30 @@  discard block
 block discarded – undo
883 883
 				) );
884 884
 				$_tmp_query_parts = $_tmp_query->_introspect();
885 885
 
886
-				$extra_conditions[] = $_tmp_query_parts['where'];
886
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
887 887
 
888 888
 				$filter = false;
889 889
 				continue;
890 890
 			}
891 891
 
892 892
 			// Construct manual query for text mode creator search
893
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
894
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
893
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
894
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
895 895
 				$filter = false;
896 896
 				continue;
897 897
 			}
898 898
 
899 899
 			// By default, we want searches to be wildcard for each field.
900
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
900
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
901 901
 
902 902
 			// For multichoice, let's have an in (OR) search.
903
-			if ( is_array( $filter['value'] ) ) {
904
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
903
+			if ( is_array( $filter[ 'value' ] ) ) {
904
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
905 905
 			}
906 906
 
907 907
 			// Default form with joins functionality
908
-			if ( empty( $filter['form_id'] ) ) {
909
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
908
+			if ( empty( $filter[ 'form_id' ] ) ) {
909
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
910 910
 			}
911 911
 
912 912
 			/**
@@ -916,32 +916,32 @@  discard block
 block discarded – undo
916 916
 			 * @param array $filter array with `key`, `value`, `operator`, `type` keys
917 917
 			 * @param \GV\View $view The View we're operating on.
918 918
 			 */
919
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
919
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
920 920
 
921
-			if ( 'is' !== $filter['operator'] && '' === $filter['value'] ) {
922
-				unset( $search_criteria['field_filters'][ $key ] );
921
+			if ( 'is' !== $filter[ 'operator' ] && '' === $filter[ 'value' ] ) {
922
+				unset( $search_criteria[ 'field_filters' ][ $key ] );
923 923
 			}
924 924
 		}
925 925
 
926
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
926
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
927 927
 			$date_criteria = array();
928 928
 
929
-			if ( isset( $search_criteria['start_date'] ) ) {
930
-				$date_criteria['start_date'] = $search_criteria['start_date'];
929
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
930
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
931 931
 			}
932 932
 
933
-			if ( isset( $search_criteria['end_date'] ) ) {
934
-				$date_criteria['end_date'] = $search_criteria['end_date'];
933
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
934
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
935 935
 			}
936 936
 
937 937
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
938 938
 			$_tmp_query_parts   = $_tmp_query->_introspect();
939
-			$extra_conditions[] = $_tmp_query_parts['where'];
939
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
940 940
 		}
941 941
 
942 942
 		$search_conditions = array();
943 943
 
944
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
944
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
945 945
 			foreach ( $filters as &$filter ) {
946 946
 				if ( ! is_array( $filter ) ) {
947 947
 					continue;
@@ -953,12 +953,12 @@  discard block
 block discarded – undo
953 953
 				 * code by reusing what's inside GF_Query already as they
954 954
 				 * take care of many small things like forcing numeric, etc.
955 955
 				 */
956
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
956
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
957 957
 				$_tmp_query_parts = $_tmp_query->_introspect();
958
-				$search_condition = $_tmp_query_parts['where'];
958
+				$search_condition = $_tmp_query_parts[ 'where' ];
959 959
 
960
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
961
-					$search_conditions[] = $search_condition;
960
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
961
+					$search_conditions[ ] = $search_condition;
962 962
 				} else {
963 963
 					$left = $search_condition->left;
964 964
 
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 
971 971
 							$value = $reflectionProperty->getValue( $left );
972 972
 
973
-							if ( ! empty( $value[0] ) && $value[0] instanceof GF_Query_Column ) {
974
-								$left = $value[0];
973
+							if ( ! empty( $value[ 0 ] ) && $value[ 0 ] instanceof GF_Query_Column ) {
974
+								$left = $value[ 0 ];
975 975
 							} else {
976 976
 								continue;
977 977
 							}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 							$on = $_join->join_on;
988 988
 							$join = $_join->join;
989 989
 
990
-							$search_conditions[] = GF_Query_Condition::_or(
990
+							$search_conditions[ ] = GF_Query_Condition::_or(
991 991
 								// Join
992 992
 								new GF_Query_Condition(
993 993
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 							);
1004 1004
 						}
1005 1005
 					} else {
1006
-						$search_conditions[] = new GF_Query_Condition(
1006
+						$search_conditions[ ] = new GF_Query_Condition(
1007 1007
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
1008 1008
 							$search_condition->operator,
1009 1009
 							$search_condition->right
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		/**
1026 1026
 		 * Combine the parts as a new WHERE clause.
1027 1027
 		 */
1028
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
1028
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
1029 1029
 		$query->where( $where );
1030 1030
 	}
1031 1031
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 		$field_id = str_replace( array( 'filter_', 'input_' ), '', $key );
1049 1049
 
1050 1050
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
1051
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
1051
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
1052 1052
 			$field_id = str_replace( '_', '.', $field_id );
1053 1053
 		}
1054 1054
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			// form is in searchable fields
1106 1106
 			$found = false;
1107 1107
 			foreach ( $searchable_fields as $field ) {
1108
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1108
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1109 1109
 					$found = true;
1110 1110
 					break;
1111 1111
 				}
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 			case 'select':
1147 1147
 			case 'radio':
1148
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1148
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1149 1149
 				break;
1150 1150
 
1151 1151
 			case 'post_category':
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 				foreach ( $value as $val ) {
1161 1161
 					$cat = get_term( $val, 'category' );
1162
-					$filter[] = array(
1162
+					$filter[ ] = array(
1163 1163
 						'key'      => $field_id,
1164 1164
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1165 1165
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 				$filter = array();
1179 1179
 
1180 1180
 				foreach ( $value as $val ) {
1181
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1181
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1182 1182
 				}
1183 1183
 
1184 1184
 				break;
@@ -1187,9 +1187,9 @@  discard block
 block discarded – undo
1187 1187
 				// convert checkbox on/off into the correct search filter
1188 1188
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1189 1189
 					foreach ( $form_field->inputs as $k => $input ) {
1190
-						if ( $input['id'] == $field_id ) {
1191
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1192
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1190
+						if ( $input[ 'id' ] == $field_id ) {
1191
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1192
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1193 1193
 							break;
1194 1194
 						}
1195 1195
 					}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 					$filter = array();
1200 1200
 
1201 1201
 					foreach ( $value as $val ) {
1202
-						$filter[] = array(
1202
+						$filter[ ] = array(
1203 1203
 							'key'      => $field_id,
1204 1204
 							'value'    => $val,
1205 1205
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
 					foreach ( $words as $word ) {
1221 1221
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1222 1222
 							// Keep the same key for each filter
1223
-							$filter['value'] = $word;
1223
+							$filter[ 'value' ] = $word;
1224 1224
 							// Add a search for the value
1225
-							$filters[] = $filter;
1225
+							$filters[ ] = $filter;
1226 1226
 						}
1227 1227
 					}
1228 1228
 
@@ -1236,19 +1236,19 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 					foreach ( $searchable_fields as $searchable_field ) {
1238 1238
 
1239
-						if( $form_field->ID !== $searchable_field['field'] ) {
1239
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1240 1240
 							continue;
1241 1241
 						}
1242 1242
 
1243 1243
 						// Only exact-match dropdowns, not text search
1244
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1244
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1245 1245
 							continue;
1246 1246
 						}
1247 1247
 
1248 1248
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1249 1249
 
1250 1250
 						if ( 4 === $input_id ) {
1251
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1251
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1252 1252
 						};
1253 1253
 					}
1254 1254
 				}
@@ -1276,12 +1276,12 @@  discard block
 block discarded – undo
1276 1276
 						 * @since 1.16.3
1277 1277
 						 * Safeguard until GF implements '<=' operator
1278 1278
 						 */
1279
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1279
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1280 1280
 							$operator = '<';
1281 1281
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1282 1282
 						}
1283 1283
 
1284
-						$filter[] = array(
1284
+						$filter[ ] = array(
1285 1285
 							'key'      => $field_id,
1286 1286
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1287 1287
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1289,12 +1289,12 @@  discard block
 block discarded – undo
1289 1289
 					}
1290 1290
 				} else {
1291 1291
 					$date = $value;
1292
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1293
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1292
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1293
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1294 1294
 				}
1295 1295
 
1296
-				if ('payment_date' === $key) {
1297
-					$filter['operator'] = 'contains';
1296
+				if ( 'payment_date' === $key ) {
1297
+					$filter[ 'operator' ] = 'contains';
1298 1298
 				}
1299 1299
 
1300 1300
 				break;
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 			'ymd_dot' => 'Y.m.d',
1324 1324
 		);
1325 1325
 
1326
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1326
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1327 1327
 			$format = $datepicker[ $field->dateFormat ];
1328 1328
 		}
1329 1329
 
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 	public function add_template_path( $file_paths ) {
1361 1361
 
1362 1362
 		// Index 100 is the default GravityView template path.
1363
-		$file_paths[102] = self::$file . 'templates/';
1363
+		$file_paths[ 102 ] = self::$file . 'templates/';
1364 1364
 
1365 1365
 		return $file_paths;
1366 1366
 	}
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		$has_date = false;
1380 1380
 
1381 1381
 		foreach ( $search_fields as $k => $field ) {
1382
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1382
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1383 1383
 				$has_date = true;
1384 1384
 				break;
1385 1385
 			}
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1409 1409
 
1410 1410
 		// get configured search fields
1411
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1411
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1412 1412
 
1413 1413
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1414 1414
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1422,39 +1422,39 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1424 1424
 
1425
-			switch ( $field['field'] ) {
1425
+			switch ( $field[ 'field' ] ) {
1426 1426
 
1427 1427
 				case 'search_all':
1428
-					$updated_field['key'] = 'search_all';
1429
-					$updated_field['input'] = 'search_all';
1430
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1428
+					$updated_field[ 'key' ] = 'search_all';
1429
+					$updated_field[ 'input' ] = 'search_all';
1430
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1431 1431
 					break;
1432 1432
 
1433 1433
 				case 'entry_date':
1434
-					$updated_field['key'] = 'entry_date';
1435
-					$updated_field['input'] = 'entry_date';
1436
-					$updated_field['value'] = array(
1434
+					$updated_field[ 'key' ] = 'entry_date';
1435
+					$updated_field[ 'input' ] = 'entry_date';
1436
+					$updated_field[ 'value' ] = array(
1437 1437
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1438 1438
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1439 1439
 					);
1440 1440
 					break;
1441 1441
 
1442 1442
 				case 'entry_id':
1443
-					$updated_field['key'] = 'entry_id';
1444
-					$updated_field['input'] = 'entry_id';
1445
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1443
+					$updated_field[ 'key' ] = 'entry_id';
1444
+					$updated_field[ 'input' ] = 'entry_id';
1445
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1446 1446
 					break;
1447 1447
 
1448 1448
 				case 'created_by':
1449
-					$updated_field['key'] = 'created_by';
1450
-					$updated_field['name'] = 'gv_by';
1451
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1449
+					$updated_field[ 'key' ] = 'created_by';
1450
+					$updated_field[ 'name' ] = 'gv_by';
1451
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1452 1452
 					break;
1453 1453
 
1454 1454
 				case 'is_approved':
1455
-					$updated_field['key'] = 'is_approved';
1456
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1457
-					$updated_field['choices'] = self::get_is_approved_choices();
1455
+					$updated_field[ 'key' ] = 'is_approved';
1456
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1457
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1458 1458
 					break;
1459 1459
 			}
1460 1460
 
@@ -1475,16 +1475,16 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1477 1477
 
1478
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1478
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1479 1479
 
1480 1480
 		/** @since 1.14 */
1481
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1481
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1482 1482
 
1483
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1483
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1484 1484
 
1485 1485
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1486 1486
 
1487
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1487
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1488 1488
 
1489 1489
 		if ( $this->has_date_field( $search_fields ) ) {
1490 1490
 			// enqueue datepicker stuff only if needed!
@@ -1506,10 +1506,10 @@  discard block
 block discarded – undo
1506 1506
 	public static function get_search_class( $custom_class = '' ) {
1507 1507
 		$gravityview_view = GravityView_View::getInstance();
1508 1508
 
1509
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1509
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1510 1510
 
1511
-		if ( ! empty( $custom_class )  ) {
1512
-			$search_class .= ' '.$custom_class;
1511
+		if ( ! empty( $custom_class ) ) {
1512
+			$search_class .= ' ' . $custom_class;
1513 1513
 		}
1514 1514
 
1515 1515
 		/**
@@ -1560,9 +1560,9 @@  discard block
 block discarded – undo
1560 1560
 
1561 1561
 		if ( ! $label ) {
1562 1562
 
1563
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1563
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1564 1564
 
1565
-			switch( $field['field'] ) {
1565
+			switch ( $field[ 'field' ] ) {
1566 1566
 				case 'search_all':
1567 1567
 					$label = __( 'Search Entries:', 'gravityview' );
1568 1568
 					break;
@@ -1574,10 +1574,10 @@  discard block
 block discarded – undo
1574 1574
 					break;
1575 1575
 				default:
1576 1576
 					// If this is a field input, not a field
1577
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1577
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1578 1578
 
1579 1579
 						// Get the label for the field in question, which returns an array
1580
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1580
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1581 1581
 
1582 1582
 						// Get the item with the `label` key
1583 1583
 						$values = wp_list_pluck( $items, 'label' );
@@ -1618,13 +1618,13 @@  discard block
 block discarded – undo
1618 1618
 		$form = $gravityview_view->getForm();
1619 1619
 
1620 1620
 		// for advanced field ids (eg, first name / last name )
1621
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1621
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1622 1622
 
1623 1623
 		// get searched value from $_GET/$_POST (string or array)
1624 1624
 		$value = $this->rgget_or_rgpost( $name );
1625 1625
 
1626 1626
 		// get form field details
1627
-		$form_field = gravityview_get_field( $form, $field['field'] );
1627
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1628 1628
 
1629 1629
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1630 1630
 
@@ -1638,22 +1638,22 @@  discard block
 block discarded – undo
1638 1638
 		);
1639 1639
 
1640 1640
 		// collect choices
1641
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1642
-			$filter['choices'] = gravityview_get_terms_choices();
1643
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1644
-			$filter['choices'] = $form_field['choices'];
1641
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1642
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1643
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1644
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1645 1645
 		}
1646 1646
 
1647
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1648
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1647
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1648
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1649 1649
 		}
1650 1650
 
1651
-		if ( 'created_by' === $field['field'] ) {
1652
-			$filter['choices'] = self::get_created_by_choices( $context->view );
1653
-			$filter['type'] = 'created_by';
1651
+		if ( 'created_by' === $field[ 'field' ] ) {
1652
+			$filter[ 'choices' ] = self::get_created_by_choices( $context->view );
1653
+			$filter[ 'type' ] = 'created_by';
1654 1654
 		}
1655 1655
 
1656
-		if ( ! empty( $filter['choices'] ) ) {
1656
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1657 1657
 			/**
1658 1658
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1659 1659
 			 * @param[in,out] bool Yes or no.
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 			 * @param \GV\Context The context.
1662 1662
 			 */
1663 1663
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1664
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1664
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1665 1665
 			}
1666 1666
 		}
1667 1667
 
@@ -1690,12 +1690,12 @@  discard block
 block discarded – undo
1690 1690
 	 * @return array The filter choices.
1691 1691
 	 */
1692 1692
 	private function sieve_filter_choices( $filter, $context ) {
1693
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1693
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1694 1694
 			return $filter; // @todo Populate plugins might give us empty choices
1695 1695
 		}
1696 1696
 
1697 1697
 		// Allow only created_by and field-ids to be sieved.
1698
-		if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) {
1698
+		if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) {
1699 1699
 			return $filter;
1700 1700
 		}
1701 1701
 
@@ -1706,13 +1706,13 @@  discard block
 block discarded – undo
1706 1706
 		$entry_table_name = GFFormsModel::get_entry_table_name();
1707 1707
 		$entry_meta_table_name = GFFormsModel::get_entry_meta_table_name();
1708 1708
 
1709
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1709
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1710 1710
 
1711 1711
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1712 1712
 			case 'post_category':
1713 1713
 				$choices = $wpdb->get_col( $wpdb->prepare(
1714 1714
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1715
-					$key_like, $filter['key'], $form_id
1715
+					$key_like, $filter[ 'key' ], $form_id
1716 1716
 				) );
1717 1717
 				break;
1718 1718
 			case 'created_by':
@@ -1724,17 +1724,17 @@  discard block
 block discarded – undo
1724 1724
 			default:
1725 1725
 				$choices = $wpdb->get_col( $wpdb->prepare(
1726 1726
 					"SELECT DISTINCT meta_value FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1727
-					$key_like, $filter['key'], $form_id
1727
+					$key_like, $filter[ 'key' ], $form_id
1728 1728
 				) );
1729 1729
 
1730
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1730
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1731 1731
 					$choices = array_map( 'json_decode', $choices );
1732 1732
 					$_choices_array = array();
1733 1733
 					foreach ( $choices as $choice ) {
1734 1734
 						if ( is_array( $choice ) ) {
1735 1735
 							$_choices_array = array_merge( $_choices_array, $choice );
1736 1736
 						} else {
1737
-							$_choices_array []= $choice;
1737
+							$_choices_array [ ] = $choice;
1738 1738
 						}
1739 1739
 					}
1740 1740
 					$choices = array_unique( $_choices_array );
@@ -1744,9 +1744,9 @@  discard block
 block discarded – undo
1744 1744
 		endswitch;
1745 1745
 
1746 1746
 		$filter_choices = array();
1747
-		foreach ( $filter['choices'] as $choice ) {
1748
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1749
-				$filter_choices[] = $choice;
1747
+		foreach ( $filter[ 'choices' ] as $choice ) {
1748
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1749
+				$filter_choices[ ] = $choice;
1750 1750
 			}
1751 1751
 		}
1752 1752
 
@@ -1781,7 +1781,7 @@  discard block
 block discarded – undo
1781 1781
 			 * @param \GV\View $view The view.
1782 1782
 			 */
1783 1783
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1784
-			$choices[] = array(
1784
+			$choices[ ] = array(
1785 1785
 				'value' => $user->ID,
1786 1786
 				'text' => $text,
1787 1787
 			);
@@ -1801,9 +1801,9 @@  discard block
 block discarded – undo
1801 1801
 
1802 1802
 		$choices = array();
1803 1803
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1804
-			$choices[] = array(
1805
-				'value' => $status['value'],
1806
-				'text' => $status['label'],
1804
+			$choices[ ] = array(
1805
+				'value' => $status[ 'value' ],
1806
+				'text' => $status[ 'label' ],
1807 1807
 			);
1808 1808
 		}
1809 1809
 
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 	 */
1856 1856
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1857 1857
 
1858
-		$js_dependencies[] = 'jquery-ui-datepicker';
1858
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1859 1859
 
1860 1860
 		return $js_dependencies;
1861 1861
 	}
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 			'isRTL'             => is_rtl(),
1900 1900
 		), $view_data );
1901 1901
 
1902
-		$localizations['datepicker'] = $datepicker_settings;
1902
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1903 1903
 
1904 1904
 		return $localizations;
1905 1905
 
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 	 * @return void
1927 1927
 	 */
1928 1928
 	private function maybe_enqueue_flexibility() {
1929
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1929
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1930 1930
 			wp_enqueue_script( 'gv-flexibility' );
1931 1931
 		}
1932 1932
 	}
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1949 1949
 
1950 1950
 		$scheme = is_ssl() ? 'https://' : 'http://';
1951
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1951
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1952 1952
 
1953 1953
 		/**
1954 1954
 		 * @filter `gravityview_search_datepicker_class`
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 	public function add_preview_inputs() {
2028 2028
 		global $wp;
2029 2029
 
2030
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
2030
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
2031 2031
 			return;
2032 2032
 		}
2033 2033
 
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
  */
2086 2086
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2087 2087
 	public function __construct( $filter, $view ) {
2088
-		$this->value = $filter['value'];
2088
+		$this->value = $filter[ 'value' ];
2089 2089
 		$this->view = $view;
2090 2090
 	}
2091 2091
 
@@ -2117,11 +2117,11 @@  discard block
 block discarded – undo
2117 2117
 		$conditions = array();
2118 2118
 
2119 2119
 		foreach ( $user_fields as $user_field ) {
2120
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2120
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2121 2121
 		}
2122 2122
 
2123 2123
 		foreach ( $user_meta_fields as $meta_field ) {
2124
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2124
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2125 2125
 		}
2126 2126
 
2127 2127
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-chainedselect.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 }
20 20
 
21 21
 // Make sure that there are choices to display
22
-if( empty( $search_field['choices'] ) ) {
22
+if ( empty( $search_field[ 'choices' ] ) ) {
23 23
 	gravityview()->log->debug( 'search-field-chainedselect.php - No choices for field' );
24 24
 	return;
25 25
 }
26 26
 
27 27
 $form = \GV\GF_Form::from_form( $gravityview_view->getForm() );
28 28
 
29
-$field = \GV\GF_Field::by_id( $form, $search_field['key'] );
29
+$field = \GV\GF_Field::by_id( $form, $search_field[ 'key' ] );
30 30
 
31 31
 /** @var GF_Chained_Field_Select $gf_field */
32 32
 $gf_field = $field->field;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 $gf_field->chainedSelectsAlignment = $gravityview_view->search_layout;
53 53
 ?>
54 54
 <div class="gv-search-box gv-search-field-chainedselect">
55
-	<?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?>
56
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
55
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?>
56
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
57 57
 	<?php
58 58
 	}
59 59
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 <script>
68 68
 ( function( $ ) {
69 69
 	$( 'select', '.gv-search-field-chainedselect').on( 'change', function( e ) {
70
-		window.gform.doAction( 'gform_input_change', e.target, <?php echo (int) $form->ID; ?>, <?php echo (int) $field->ID; ?> );
70
+		window.gform.doAction( 'gform_input_change', e.target, <?php echo (int)$form->ID; ?>, <?php echo (int)$field->ID; ?> );
71 71
 	});
72 72
 <?php
73 73
 	echo strtr( 'new GFChainedSelects( {form_id}, {field_id}, {hide_inactive}, "{search_layout}" );', array(
74 74
 			'{form_id}'       => $form->ID,
75 75
 			'{field_id}'      => $field->ID,
76
-			'{hide_inactive}' => (int) $hide_inactive,
76
+			'{hide_inactive}' => (int)$hide_inactive,
77 77
 			'{search_layout}' => $gravityview_view->search_layout,
78 78
 	) );
79 79
 ?>
Please login to merge, or discard this patch.