Completed
Push — develop ( d22d9f...f27933 )
by
unknown
17:42
created
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/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.
class-gravityview-plugin-hooks-gravity-forms-chainedselects.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 			return $searchable_fields;
60 60
 		}
61 61
 
62
-		foreach( $searchable_fields as $searchable_field ) {
62
+		foreach ( $searchable_fields as $searchable_field ) {
63 63
 
64 64
 			if ( self::INPUT_TYPE !== \GV\Utils::get( $searchable_field, 'input' ) ) {
65 65
 				continue;
66 66
 			}
67 67
 
68
-			$field = GFAPI::get_field( $searchable_field['form_id'], $searchable_field['field'] );
68
+			$field = GFAPI::get_field( $searchable_field[ 'form_id' ], $searchable_field[ 'field' ] );
69 69
 
70
-			foreach( $field->get_entry_inputs() as $input ) {
71
-				$searchable_fields[] = array(
72
-					'field' => $input['id'],
70
+			foreach ( $field->get_entry_inputs() as $input ) {
71
+				$searchable_fields[ ] = array(
72
+					'field' => $input[ 'id' ],
73 73
 				);
74 74
 			}
75 75
 		}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function print_styles( $search_widget, $search_field ) {
89 89
 
90
-		if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
90
+		if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
91 91
 			return;
92 92
 		}
93 93
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function print_scripts( $search_widget, $search_field ) {
140 140
 
141
-		if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
141
+		if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) {
142 142
 			return;
143 143
 		}
144 144
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 		foreach ( $gf_field->get_entry_inputs() as $input ) {
179 179
 
180 180
 			// Inputs are converted from . to _
181
-			$input_url_arg = 'input_' . str_replace( '.', '_', $input['id'] );
181
+			$input_url_arg = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
182 182
 
183
-			$field_values[ $input['id'] ] = \GV\Utils::_REQUEST( $input_url_arg );
183
+			$field_values[ $input[ 'id' ] ] = \GV\Utils::_REQUEST( $input_url_arg );
184 184
 		}
185 185
 
186 186
 		return $field_values;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	function modify_searchable_fields( $fields, $form_id ) {
207 207
 
208
-		foreach( $fields as $key => $field ) {
209
-			if( 'chainedselect' === $field['type'] && ! empty( $field['parent'] ) ) {
208
+		foreach ( $fields as $key => $field ) {
209
+			if ( 'chainedselect' === $field[ 'type' ] && ! empty( $field[ 'parent' ] ) ) {
210 210
 				unset( $fields[ $key ] );
211 211
 			}
212 212
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return string
237 237
 	 */
238
-	public function set_input_type( $input_type, $field_type, $field_id  ) {
238
+	public function set_input_type( $input_type, $field_type, $field_id ) {
239 239
 
240 240
 		if ( ! in_array( $field_type, array( 'chainedselect' ) ) ) {
241 241
 			return $input_type;
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-no-conflict.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		if( ! is_admin() ) { return; }
21
+		if ( ! is_admin() ) { return; }
22 22
 		
23 23
 		$this->add_hooks();
24 24
 	}
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	private function add_hooks() {
34 34
 		//Hooks for no-conflict functionality
35
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
36
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
35
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
36
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
37 37
 
38
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
39
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
40
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
41
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
38
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
39
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
40
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
41
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function no_conflict_scripts() {
52 52
 		global $wp_scripts;
53 53
 
54
-		if( ! gravityview()->request->is_admin( '', null ) ) {
54
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
55 55
 			return;
56 56
 		}
57 57
 
58 58
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
59 59
 
60
-		if( empty( $no_conflict_mode ) ) {
60
+		if ( empty( $no_conflict_mode ) ) {
61 61
 			return;
62 62
 		}
63 63
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	function no_conflict_styles() {
117 117
 		global $wp_styles;
118 118
 
119
-		if( ! gravityview()->request->is_admin( '', null ) ) {
119
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
126
-			foreach ($wp_styles->registered as $key => $style) {
127
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
125
+		if ( ! empty( $wp_styles->registered ) ) {
126
+			foreach ( $wp_styles->registered as $key => $style ) {
127
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
129 129
 				}
130 130
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
134 134
 
135 135
 		// If no conflict is off, jQuery will suffice.
136
-		if( empty( $no_conflict_mode ) ) {
136
+		if ( empty( $no_conflict_mode ) ) {
137 137
 			return;
138 138
 		}
139 139
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		/**
162 162
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
163 163
 		 */
164
-		do_action('gravityview_remove_conflicts_after');
164
+		do_action( 'gravityview_remove_conflicts_after' );
165 165
 	}
166 166
 
167 167
 	/**
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
 		//reset queue
196 196
 		$queue = array();
197
-		foreach( $wp_objects->queue as $object ) {
198
-			if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
-				$queue[] = $object;
197
+		foreach ( $wp_objects->queue as $object ) {
198
+			if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
+				$queue[ ] = $object;
200 200
 			}
201 201
 		}
202 202
 		$wp_objects->queue = $queue;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach ( $wp_objects->registered as $handle => $script_registration ) {
209
+			if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $registered [description]
222 222
 	 * @param array $scripts    [description]
223 223
 	 */
224
-	private function add_script_dependencies($registered, $scripts) {
224
+	private function add_script_dependencies( $registered, $scripts ) {
225 225
 
226 226
 		//gets all dependent scripts linked to the $scripts array passed
227 227
 		do {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
231 231
 				foreach ( $deps as $dep ) {
232 232
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
233
-						$dependents[] = $dep;
233
+						$dependents[ ] = $dep;
234 234
 					}
235 235
 				}
236 236
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
181 181
 
182 182
 		// Force the screen to be GravityView
183
-		$tab['screen'] = 'gravityview';
183
+		$tab[ 'screen' ] = 'gravityview';
184 184
 
185 185
 		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
186
-			$metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
186
+			$metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
187 187
 			\GravityView_Metabox_Tabs::add( $metabox );
188 188
 		} else {
189
-			add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
189
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
190 190
 		}
191 191
 	}
192 192
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
214
-		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible );
214
+		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible );
215 215
 
216 216
 		if ( ! function_exists( 'gravityview' ) ) {
217 217
 			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) );
218
-		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) {
219
-			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' );
220
-		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) {
221
-			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' );
218
+		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) {
219
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' );
220
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
221
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' );
222 222
 		} else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) {
223 223
 			$message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) );
224 224
 		} else {
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$locale = get_locale();
260 260
 
261
-		if ( function_exists('get_user_locale') && is_admin() ) {
261
+		if ( function_exists( 'get_user_locale' ) && is_admin() ) {
262 262
 			$locale = get_user_locale();
263 263
 		}
264 264
 
265 265
 		// Traditional WordPress plugin locale filter
266
-		$locale = apply_filters( 'plugin_locale',  $locale, $this->_text_domain );
266
+		$locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain );
267 267
 
268 268
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
269 269
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	public function settings() {
292 292
 
293 293
 		// If doing ajax, get outta here.
294
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) )  {
294
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) {
295 295
 			return;
296 296
 		}
297 297
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             	'version'	=> $this->_version, // current version number
315 315
             	'license'	=> \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ),
316 316
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
317
-            	'item_name' => $this->_title,  // name of this plugin
318
-            	'author' 	=> strip_tags( $this->_author ),  // author of this plugin
317
+            	'item_name' => $this->_title, // name of this plugin
318
+            	'author' 	=> strip_tags( $this->_author ), // author of this plugin
319 319
 	            'php_version' => phpversion(),
320 320
 	            'wp_version' => get_bloginfo( 'version' ),
321 321
 	            'gv_version' => \GV\Plugin::$version,
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public static function add_notice( $notice = array() ) {
349 349
 
350
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
350
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
351 351
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
352 352
 			return;
353 353
 		} else if ( is_string( $notice ) ) {
354 354
 			$notice = array( 'message' => $notice );
355 355
 		}
356 356
 
357
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
357
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
358 358
 
359
-		self::$admin_notices []= $notice;
359
+		self::$admin_notices [ ] = $notice;
360 360
 	}
361 361
 
362 362
 	/**
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 		}
371 371
 
372 372
 		foreach ( self::$admin_notices as $key => $notice ) {
373
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
374
-			echo wpautop( $notice['message'] );
373
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
374
+			echo wpautop( $notice[ 'message' ] );
375 375
 			echo '<div class="clear"></div>';
376 376
 			echo '</div>';
377 377
 		}
Please login to merge, or discard this patch.
trustedlogin/autoload-classmap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 // autoload-classmap.php @generated by Strauss
4 4
 
5
-$trustedlogin = dirname(__FILE__);
5
+$trustedlogin = dirname( __FILE__ );
6 6
 
7 7
 return array(
8 8
    'GravityView\Psr\Log\LoggerAwareTrait' => $trustedlogin . '/psr/log/Psr/Log/LoggerAwareTrait.php',
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) );
80 80
 
81
-			$return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false);
81
+			$return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false );
82 82
 		}
83 83
 
84 84
 		foreach ( $modifiers as $passed_modifier ) {
85 85
 
86
-			foreach( $gv_modifiers as $gv_modifier => $method ) {
86
+			foreach ( $gv_modifiers as $gv_modifier => $method ) {
87 87
 
88 88
 				// Uses ^ to only match the first modifier, to enforce same order as passed by GF
89 89
 				preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches );
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	private static function modifier_timestamp( $raw_value, $matches ) {
134 134
 
135
-		if( empty( $matches[0] ) ) {
135
+		if ( empty( $matches[ 0 ] ) ) {
136 136
 			return $raw_value;
137 137
 		}
138 138
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	private static function modifier_maxwords( $raw_value, $matches, $field = null ) {
163 163
 
164
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
164
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
165 165
 			return $raw_value;
166 166
 		}
167 167
 
168
-		$max = intval( $matches[1] );
168
+		$max = intval( $matches[ 1 ] );
169 169
 
170 170
 		$more_placeholder = '[GVMORE]';
171 171
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	private static function modifier_explode( $raw_value, $matches, $value, $field = null ) {
235 235
 
236 236
 		// For JSON-encoded arrays
237
-		if( $json_array = json_decode( $raw_value, true ) ) {
237
+		if ( $json_array = json_decode( $raw_value, true ) ) {
238 238
 			return implode( ' ', $json_array );
239 239
 		}
240 240
 
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) {
257 257
 
258
-		if( empty( $matches[0] ) ) {
258
+		if ( empty( $matches[ 0 ] ) ) {
259 259
 			return $raw_value;
260 260
 		}
261 261
 
262 262
 		$return = $raw_value;
263 263
 
264
-		switch( $matches[0] ) {
264
+		switch ( $matches[ 0 ] ) {
265 265
 			case 'urlencode':
266 266
 				$return = urlencode( $raw_value );
267 267
 				break;
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		 * @internal Fixed $form['title'] in Gravity Forms
349 349
 		 * @see      https://github.com/gravityforms/gravityforms/pull/27/files
350 350
 		 */
351
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
352
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
353
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
351
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
352
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
353
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
354 354
 
355 355
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data );
356 356
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
 		$site_url = get_site_url();
444 444
 
445
-		if( $url_encode ) {
445
+		if ( $url_encode ) {
446 446
 			$site_url = urlencode( $site_url );
447 447
 		}
448 448
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 		// Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag?
470 470
 		preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER );
471 471
 
472
-		if( empty( $matches ) ) {
472
+		if ( empty( $matches ) ) {
473 473
 			return $original_text;
474 474
 		}
475 475
 
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
 		 * }
491 491
 		 */
492 492
 		foreach ( $matches as $match ) {
493
-			$full_tag = $match[0];
493
+			$full_tag = $match[ 0 ];
494 494
 
495 495
 			$link_args = array(
496 496
 				'return' => 'url',
497
-				'entry_id' => $entry['id'],
497
+				'entry_id' => $entry[ 'id' ],
498 498
 				'post_id' => \GV\Utils::get( $match, 1, null ),
499 499
 				'action' => \GV\Utils::get( $match, 2, 'read' ),
500 500
 			);
501 501
 
502 502
 			$entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' );
503 503
 
504
-			if( $url_encode ) {
504
+			if ( $url_encode ) {
505 505
 				$entry_link = urlencode( $entry_link );
506 506
 			}
507 507
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
540 540
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
541 541
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
542
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
542
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
543 543
 		);
544 544
 
545 545
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 			return $original_text;
617 617
 		}
618 618
 
619
-		foreach ( (array) $matches as $match ) {
620
-			$full_tag = $match[0];
619
+		foreach ( (array)$matches as $match ) {
620
+			$full_tag = $match[ 0 ];
621 621
 			$modifier = \GV\Utils::get( $match, 2, 'permalink' );
622 622
 
623 623
 			$replacement = false;
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 					$replacement = esc_html( $replacement );
636 636
 				}
637 637
 
638
-				if( $url_encode ) {
638
+				if ( $url_encode ) {
639 639
 					$replacement = urlencode( $replacement );
640 640
 				}
641 641
 
@@ -675,14 +675,14 @@  discard block
 block discarded – undo
675 675
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
676 676
 
677 677
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
678
-		if( empty( $matches ) ) {
678
+		if ( empty( $matches ) ) {
679 679
 			return $text;
680 680
 		}
681 681
 
682 682
 		foreach ( $matches as $match ) {
683 683
 
684
-			$full_tag = $match[0];
685
-			$property = $match[1];
684
+			$full_tag = $match[ 0 ];
685
+			$property = $match[ 1 ];
686 686
 
687 687
 			$value = stripslashes_deep( \GV\Utils::_GET( $property ) );
688 688
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 			 * @since 1.15
707 707
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
708 708
 			 */
709
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
709
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
710 710
 
711 711
 			$value = $esc_html ? esc_html( $value ) : $value;
712 712
 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			 * @param array $form Gravity Forms form array
718 718
 			 * @param array $entry Entry array
719 719
 			 */
720
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
720
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
721 721
 
722 722
 			$text = str_replace( $full_tag, $value, $text );
723 723
 		}
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$is_table_layout = preg_match( '/table/ism', $template_id );
55 55
 
56
-		if( 'field' === $field_type ) {
56
+		if ( 'field' === $field_type ) {
57 57
 
58 58
 			// Default options - fields
59 59
 			$field_options = array(
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 			);
106 106
 
107 107
 			// Match Table as well as DataTables
108
-			if( $is_table_layout && 'directory' === $context ) {
109
-				$field_options['width'] = array(
108
+			if ( $is_table_layout && 'directory' === $context ) {
109
+				$field_options[ 'width' ] = array(
110 110
 					'type' => 'number',
111
-					'label' => __('Percent Width', 'gravityview'),
112
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
111
+					'label' => __( 'Percent Width', 'gravityview' ),
112
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
113 113
 					'class' => 'code widefat',
114 114
 					'value' => '',
115 115
 					'priority' => 200,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 		// Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n.
123 123
 		foreach ( $field_options as $key => $field_option ) {
124
-			$field_options[ $key ]['label'] = trim( $field_option['label'], ':' );
124
+			$field_options[ $key ][ 'label' ] = trim( $field_option[ 'label' ], ':' );
125 125
 		}
126 126
 
127 127
 		/**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 		 */
147 147
 		$field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id );
148 148
 
149
-		if ( 'directory' === $context && isset( $field_options['show_as_link'] ) && ! isset( $field_options['new_window'] ) ) {
150
-			$field_options['new_window'] = array(
149
+		if ( 'directory' === $context && isset( $field_options[ 'show_as_link' ] ) && ! isset( $field_options[ 'new_window' ] ) ) {
150
+			$field_options[ 'new_window' ] = array(
151 151
 				'type'     => 'checkbox',
152 152
 				'label'    => __( 'Open link in a new tab or window?', 'gravityview' ),
153 153
 				'value'    => false,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 				switch ( $key ) {
169 169
 					case 'show_as_link':
170 170
 						$_group = 'display';
171
-						$field_option['priority'] = 100;
171
+						$field_option[ 'priority' ] = 100;
172 172
 						break;
173 173
 					default:
174 174
 						$_group = \GV\Utils::get( $field_option, 'group', 'display' );
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			}
184 184
 
185 185
 			$field_options = array();
186
-			foreach ( self::get_field_groups() as $group_key => $group_name  ) {
186
+			foreach ( self::get_field_groups() as $group_key => $group_name ) {
187 187
 				$field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() );
188 188
 			}
189 189
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			return 0;
215 215
 		}
216 216
 
217
-		return ( $a_priority < $b_priority ) ? - 1 : 1;
217
+		return ( $a_priority < $b_priority ) ? -1 : 1;
218 218
 	}
219 219
 
220 220
 	/**
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 			'manage_options' => __( 'Administrator', 'gravityview' ),
240 240
 		);
241 241
 
242
-		if( is_multisite() ) {
243
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
242
+		if ( is_multisite() ) {
243
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
244 244
 		}
245 245
 
246 246
 		/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
254 254
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
255 255
 		 */
256
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
256
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
257 257
 
258 258
 		return $select_cap_choices;
259 259
 	}
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
282 282
 
283
-		if( empty( $uniqid ) ) {
283
+		if ( empty( $uniqid ) ) {
284 284
 			//generate a unique field id
285
-			$uniqid = uniqid('', false);
285
+			$uniqid = uniqid( '', false );
286 286
 		}
287 287
 
288 288
 		$grouped = ( 'field' === $field_type );
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 		// get field/widget options
291 291
 		$option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped );
292 292
 
293
-		if( ! $grouped ) {
293
+		if ( ! $grouped ) {
294 294
 			$option_groups = array( $option_groups );
295 295
 		}
296 296
 
297 297
 		$option_groups = array_filter( $option_groups );
298 298
 
299 299
 		// two different post arrays, depending of the field type
300
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
300
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
301 301
 
302 302
 		// build output
303
-		$hidden_fields  = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
304
-		$hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
303
+		$hidden_fields  = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
304
+		$hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
305 305
 
306 306
 		$form_title = '';
307 307
 		if ( $form_id ) {
308
-			$hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
308
+			$hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
309 309
 			$form = GVCommon::get_form( $form_id );
310
-			$form_title = $form['title'];
310
+			$form_title = $form[ 'title' ];
311 311
 		}
312 312
 
313 313
 		// If there are no options, return what we got.
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 			return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label()
316 316
 		}
317 317
 
318
-		$settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) );
318
+		$settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) );
319 319
 
320 320
 		$field_details = '';
321 321
 
322 322
 		// Get the pretty name for the input type
323 323
 		$gv_field = GravityView_Fields::get( $input_type );
324 324
 
325
-		if( $gv_field ) {
325
+		if ( $gv_field ) {
326 326
 			$input_type_label = $gv_field->label;
327 327
 		} else {
328 328
 			$input_type_label = $input_type;
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 			}
337 337
 
338 338
 			if ( $grouped ) {
339
-				$group_name     = rgar( self::get_field_groups(), $group_key, '' );
339
+				$group_name = rgar( self::get_field_groups(), $group_key, '' );
340 340
 				$field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">';
341 341
 				$field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>';
342 342
 			}
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 				}
354 354
 
355 355
 				$show_if = '';
356
-				if ( ! empty( $option['requires'] ) ) {
357
-					$show_if .= sprintf( ' data-requires="%s"', $option['requires'] );
356
+				if ( ! empty( $option[ 'requires' ] ) ) {
357
+					$show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] );
358 358
 				}
359 359
 
360
-				if ( ! empty( $option['requires_not'] ) ) {
361
-					$show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] );
360
+				if ( ! empty( $option[ 'requires_not' ] ) ) {
361
+					$show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] );
362 362
 				}
363 363
 
364
-				switch ( $option['type'] ) {
364
+				switch ( $option[ 'type' ] ) {
365 365
 					// Hide hidden fields
366 366
 					case 'hidden':
367 367
 						$field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
@@ -379,30 +379,30 @@  discard block
 block discarded – undo
379 379
 		$item_details = '';
380 380
 		$subtitle = '';
381 381
 
382
-		if( 'field' === $field_type ) {
383
-			$subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : '';
382
+		if ( 'field' === $field_type ) {
383
+			$subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : '';
384 384
 
385 385
 			$item_details .= '
386 386
 			<div class="gv-field-details--container">
387
-				<label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label>
387
+				<label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label>
388 388
 				<section class="gv-field-details gv-field-details--closed">';
389 389
 
390 390
 				if ( $field_id && is_numeric( $field_id ) ) {
391 391
 				$item_details .= '
392 392
 					<div class="gv-field-detail gv-field-detail--field">
393
-						<span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span>
393
+						<span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span>
394 394
 					</div>';
395 395
 			    }
396 396
 
397 397
 				$item_details .= '
398 398
 					<div class="gv-field-detail gv-field-detail--type">
399
-						<span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span>
399
+						<span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span>
400 400
 					</div>';
401 401
 
402
-				if( $form_id ) {
402
+				if ( $form_id ) {
403 403
 					$item_details .= '
404 404
 					<div class="gv-field-detail gv-field-detail--form">
405
-						<span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span>
405
+						<span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span>
406 406
 					</div>';
407 407
 				}
408 408
 				$item_details .= '
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 			</div>';
411 411
 		} else {
412 412
 			$widget_details_content = rgar( $item, 'description', '' );
413
-			if ( ! empty( $item['subtitle'] ) ) {
414
-				$widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item['subtitle'] : $item['subtitle'];
413
+			if ( ! empty( $item[ 'subtitle' ] ) ) {
414
+				$widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item[ 'subtitle' ] : $item[ 'subtitle' ];
415 415
 			}
416 416
 
417 417
 			// Intentionally not escaping to allow HTML.
@@ -467,17 +467,17 @@  discard block
 block discarded – undo
467 467
 		 * @deprecated setting index 'default' was replaced by 'value'
468 468
 		 * @see GravityView_FieldType::get_field_defaults
469 469
 		 */
470
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
471
-			$option['value'] = $option['default'];
472
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
470
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
471
+			$option[ 'value' ] = $option[ 'default' ];
472
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
473 473
 		}
474 474
 
475 475
 		// prepare to render option field type
476
-		if( isset( $option['type'] ) ) {
476
+		if ( isset( $option[ 'type' ] ) ) {
477 477
 
478 478
 			$type_class = self::load_type_class( $option );
479 479
 
480
-			if( class_exists( $type_class ) ) {
480
+			if ( class_exists( $type_class ) ) {
481 481
 
482 482
 				/** @type GravityView_FieldType $render_type */
483 483
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 				 * @param string $output field class name
495 495
 				 * @param array $option  option field data
496 496
 				 */
497
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
497
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
498 498
 			}
499 499
 
500 500
 		} // isset option[type]
@@ -529,27 +529,27 @@  discard block
 block discarded – undo
529 529
 		 * @deprecated setting index 'name' was replaced by 'label'
530 530
 		 * @see GravityView_FieldType::get_field_defaults
531 531
 		 */
532
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
533
-			$setting['label'] = $setting['name'];
534
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
532
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
533
+			$setting[ 'label' ] = $setting[ 'name' ];
534
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
535 535
 		}
536 536
 
537 537
 		$name = esc_attr( sprintf( $name, $key ) );
538
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
539
-		$setting['tooltip'] = 'gv_' . $key;
538
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
539
+		$setting[ 'tooltip' ] = 'gv_' . $key;
540 540
 
541 541
 		// Use default if current setting isn't set.
542
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
542
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
543 543
 
544 544
 		// default setting type = text
545
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
545
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
546 546
 
547 547
 		// merge tags
548
-		if( !isset( $setting['merge_tags'] ) ) {
549
-			if( $setting['type'] === 'text' ) {
550
-				$setting['merge_tags'] = true;
548
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
549
+			if ( $setting[ 'type' ] === 'text' ) {
550
+				$setting[ 'merge_tags' ] = true;
551 551
 			} else {
552
-				$setting['merge_tags'] = false;
552
+				$setting[ 'merge_tags' ] = false;
553 553
 			}
554 554
 		}
555 555
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 		// render the setting
559 559
 		$type_class = self::load_type_class( $setting );
560
-		if( class_exists( $type_class ) ) {
560
+		if ( class_exists( $type_class ) ) {
561 561
 			/** @type GravityView_FieldType $render_type */
562 562
 			$render_type = new $type_class( $name, $setting, $curr_value );
563 563
 			ob_start();
@@ -566,25 +566,25 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 		// Check if setting is specific for a template
569
-		if( !empty( $setting['show_in_template'] ) ) {
570
-			if( !is_array( $setting['show_in_template'] ) ) {
571
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
569
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
570
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
571
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
572 572
 			}
573
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
573
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
574 574
 		} else {
575 575
 			$show_if = '';
576 576
 		}
577 577
 
578
-		if( ! empty( $setting['requires'] ) ) {
579
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
578
+		if ( ! empty( $setting[ 'requires' ] ) ) {
579
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
580 580
 		}
581 581
 
582
-		if( ! empty( $setting['requires_not'] ) ) {
583
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
582
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
583
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
584 584
 		}
585 585
 
586 586
 		// output
587
-		echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>';
587
+		echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>';
588 588
 
589 589
 	}
590 590
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	public static function load_type_class( $field = NULL ) {
598 598
 
599
-		if( empty( $field['type'] ) ) {
599
+		if ( empty( $field[ 'type' ] ) ) {
600 600
 			return NULL;
601 601
 		}
602 602
 
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
606 606
 		 * @param array $field   field data
607 607
 		 */
608
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
608
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
609 609
 
610
-		if( class_exists( $type_class ) ) {
610
+		if ( class_exists( $type_class ) ) {
611 611
 			return $type_class;
612 612
 		}
613 613
 
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 		 * @param string  $field_type_include_path field class file path
617 617
 		 * @param array $field  field data
618 618
 		 */
619
-		$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
619
+		$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
620 620
 
621
-		if( $class_file && file_exists( $class_file ) ) {
621
+		if ( $class_file && file_exists( $class_file ) ) {
622 622
 			require_once( $class_file );
623 623
 		}
624 624
 
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 
641 641
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
642 642
 
643
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
644
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
643
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
644
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
645 645
 
646 646
 		return $output;
647 647
 	}
@@ -661,22 +661,22 @@  discard block
 block discarded – undo
661 661
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
662 662
 
663 663
 		// Show the merge tags if the field is a list view
664
-		$is_list = ( preg_match( '/_list-/ism', $name ));
664
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
665 665
 
666 666
 		// Or is a single entry view
667
-		$is_single = ( preg_match( '/single_/ism', $name ));
667
+		$is_single = ( preg_match( '/single_/ism', $name ) );
668 668
 		$show = ( $is_single || $is_list );
669 669
 
670 670
 		$class = '';
671 671
 		// and $add_merge_tags is not false
672
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
672
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
673 673
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
674 674
 		}
675 675
 
676
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
677
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
676
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
677
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
678 678
 
679
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
679
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
680 680
 	}
681 681
 
682 682
 	/**
@@ -693,21 +693,21 @@  discard block
 block discarded – undo
693 693
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
694 694
 
695 695
 		// Show the merge tags if the field is a list view
696
-		$is_list = ( preg_match( '/_list-/ism', $name ));
696
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
697 697
 
698 698
 		// Or is a single entry view
699
-		$is_single = ( preg_match( '/single_/ism', $name ));
699
+		$is_single = ( preg_match( '/single_/ism', $name ) );
700 700
 		$show = ( $is_single || $is_list );
701 701
 
702 702
 		$class = '';
703 703
 		// and $add_merge_tags is not false
704
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
704
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
705 705
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
706 706
 		}
707 707
 
708
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
708
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
709 709
 
710
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
710
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
711 711
 	}
712 712
 
713 713
 	/**
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 
724 724
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
725 725
 
726
-		$output = '<select name="'. $name .'" id="'. $id .'">';
727
-		foreach( $choices as $value => $label ) {
728
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
726
+		$output = '<select name="' . $name . '" id="' . $id . '">';
727
+		foreach ( $choices as $value => $label ) {
728
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
729 729
 		}
730 730
 		$output .= '</select>';
731 731
 
Please login to merge, or discard this patch.