Completed
Pull Request — master (#1356)
by Stephanie
59s
created
classes/models/FrmInbox.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			return;
106 106
 		}
107 107
 
108
-		if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) {
108
+		if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) {
109 109
 			// Don't replace messages unless required.
110 110
 			return;
111 111
 		}
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 			return;
115 115
 		}
116 116
 
117
-		if ( isset( self::$messages[ $message['key'] ] ) ) {
117
+		if ( isset( self::$messages[$message['key']] ) ) {
118 118
 			// Move up and mark as new.
119
-			unset( self::$messages[ $message['key'] ] );
119
+			unset( self::$messages[$message['key']] );
120 120
 		}
121 121
 
122 122
 		$this->fill_message( $message );
123
-		self::$messages[ $message['key'] ] = $message;
123
+		self::$messages[$message['key']] = $message;
124 124
 
125 125
 		$this->update_list();
126 126
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	private function clean_messages() {
157 157
 		$removed = false;
158 158
 		foreach ( self::$messages as $t => $message ) {
159
-			$read      = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' );
160
-			$dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' );
159
+			$read      = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' );
160
+			$dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' );
161 161
 			$expired   = $this->is_expired( $message );
162 162
 			if ( $read || $expired || $dismissed ) {
163
-				unset( self::$messages[ $t ] );
163
+				unset( self::$messages[$t] );
164 164
 				$removed = true;
165 165
 			}
166 166
 		}
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	public function filter_messages( &$messages, $type = 'unread' ) {
177 177
 		$user_id = get_current_user_id();
178 178
 		foreach ( $messages as $k => $message ) {
179
-			$dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] );
179
+			$dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] );
180 180
 			if ( empty( $k ) || $this->is_expired( $message ) || ( $dismissed && 'dismissed' !== $type ) || ( 'dismissed' === $type && ! $dismissed ) ) {
181
-				unset( $messages[ $k ] );
181
+				unset( $messages[$k] );
182 182
 			} elseif ( ! $this->is_for_user( $message ) ) {
183
-				unset( $messages[ $k ] );
183
+				unset( $messages[$k] );
184 184
 			}
185 185
 		}
186 186
 		$messages = apply_filters( 'frm_filter_inbox', $messages );
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 	 * @return void
227 227
 	 */
228 228
 	public function mark_read( $key ) {
229
-		if ( ! $key || ! isset( self::$messages[ $key ] ) ) {
229
+		if ( ! $key || ! isset( self::$messages[$key] ) ) {
230 230
 			return;
231 231
 		}
232 232
 
233
-		if ( ! isset( self::$messages[ $key ]['read'] ) ) {
234
-			self::$messages[ $key ]['read'] = array();
233
+		if ( ! isset( self::$messages[$key]['read'] ) ) {
234
+			self::$messages[$key]['read'] = array();
235 235
 		}
236
-		self::$messages[ $key ]['read'][ get_current_user_id() ] = time();
236
+		self::$messages[$key]['read'][get_current_user_id()] = time();
237 237
 
238 238
 		$this->update_list();
239 239
 	}
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 	 * @return void
247 247
 	 */
248 248
 	public function mark_unread( $key ) {
249
-		$is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
249
+		$is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] );
250 250
 		if ( $is_read ) {
251
-			unset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
251
+			unset( self::$messages[$key]['read'][get_current_user_id()] );
252 252
 			$this->update_list();
253 253
 		}
254 254
 	}
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
 			return;
265 265
 		}
266 266
 
267
-		if ( ! isset( self::$messages[ $key ] ) ) {
267
+		if ( ! isset( self::$messages[$key] ) ) {
268 268
 			return;
269 269
 		}
270 270
 
271
-		if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) {
272
-			self::$messages[ $key ]['dismissed'] = array();
271
+		if ( ! isset( self::$messages[$key]['dismissed'] ) ) {
272
+			self::$messages[$key]['dismissed'] = array();
273 273
 		}
274
-		self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time();
274
+		self::$messages[$key]['dismissed'][get_current_user_id()] = time();
275 275
 
276 276
 		$this->update_list();
277 277
 	}
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 		$user_id = get_current_user_id();
286 286
 		foreach ( self::$messages as $key => $message ) {
287 287
 			if ( ! isset( $message['dismissed'] ) ) {
288
-				self::$messages[ $key ]['dismissed'] = array();
288
+				self::$messages[$key]['dismissed'] = array();
289 289
 			}
290 290
 
291
-			if ( ! isset( $message['dismissed'][ $user_id ] ) ) {
292
-				self::$messages[ $key ]['dismissed'][ $user_id ] = time();
291
+			if ( ! isset( $message['dismissed'][$user_id] ) ) {
292
+				self::$messages[$key]['dismissed'][$user_id] = time();
293 293
 			}
294 294
 		}
295 295
 		$this->update_list();
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 		$messages = $this->get_messages( 'filter' );
300 300
 		$user_id  = get_current_user_id();
301 301
 		foreach ( $messages as $t => $message ) {
302
-			if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) {
303
-				unset( $messages[ $t ] );
302
+			if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) {
303
+				unset( $messages[$t] );
304 304
 			}
305 305
 		}
306 306
 		return $messages;
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @return void
329 329
 	 */
330 330
 	public function remove( $key ) {
331
-		if ( isset( self::$messages[ $key ] ) ) {
332
-			unset( self::$messages[ $key ] );
331
+		if ( isset( self::$messages[$key] ) ) {
332
+			unset( self::$messages[$key] );
333 333
 			$this->update_list();
334 334
 		}
335 335
 	}
Please login to merge, or discard this patch.
classes/views/dashboard/templates/counters.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,20 +15,26 @@
 block discarded – undo
15 15
 				<h4><?php echo esc_html( $counter['heading'] ); ?></h4>
16 16
 				<?php if ( isset( $counter['cta'] ) && isset( $counter['cta']['display'] ) && true === $counter['cta']['display'] ) : ?>
17 17
 					<a href="<?php echo esc_url( $counter['cta']['link'] ); ?>"><?php echo esc_attr( $counter['cta']['title'] ); ?></a>
18
-				<?php else : ?>
18
+				<?php else {
19
+	: ?>
19 20
 					<?php if ( 'currency' === $counter['type'] ) : ?>
20 21
 						<div class="frm-flex-box frm-gap-md">
21 22
 							<?php foreach ( $counter['items'] as $item ) : ?>
22 23
 								<b>
23
-									<?php echo esc_attr( $item['counter_label']['symbol_left'] ); ?>
24
+									<?php echo esc_attr( $item['counter_label']['symbol_left'] );
25
+}
26
+?>
24 27
 									<span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $item['counter']; ?>"><?php echo (int) $item['counter']; ?></span>
25 28
 									<?php echo esc_attr( $item['counter_label']['symbol_right'] ); ?>
26 29
 								</b>
27 30
 							<?php endforeach; ?>
28 31
 						</div>
29
-					<?php else : ?>
32
+					<?php else {
33
+	: ?>
30 34
 						<b>
31
-							<span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span>
35
+							<span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] );
36
+}
37
+?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span>
32 38
 						</b>
33 39
 					<?php endif; ?>
34 40
 				<?php endif; ?>
Please login to merge, or discard this patch.
classes/controllers/FrmFormTemplatesController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 
330 330
 		// Perform add or remove operation.
331 331
 		if ( 'add' === $operation ) {
332
-			self::$favorite_templates[ $key ][] = $template_id;
332
+			self::$favorite_templates[$key][] = $template_id;
333 333
 		} elseif ( 'remove' === $operation ) {
334
-			$position = array_search( $template_id, self::$favorite_templates[ $key ], true );
334
+			$position = array_search( $template_id, self::$favorite_templates[$key], true );
335 335
 			if ( $position !== false ) {
336
-				unset( self::$favorite_templates[ $key ][ $position ] );
336
+				unset( self::$favorite_templates[$key][$position] );
337 337
 			}
338 338
 		}
339 339
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		foreach ( self::$templates as $key => &$template ) {
463 463
 			// Skip the template if the categories are not set.
464 464
 			if ( ! isset( $template['categories'] ) ) {
465
-				unset( self::$templates[ $key ] );
465
+				unset( self::$templates[$key] );
466 466
 				continue;
467 467
 			}
468 468
 
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 				// Add the slug to the new array.
477 477
 				$template['category_slugs'][] = $category_slug;
478 478
 
479
-				if ( ! isset( self::$categories[ $category_slug ] ) ) {
480
-					self::$categories[ $category_slug ] = array(
479
+				if ( ! isset( self::$categories[$category_slug] ) ) {
480
+					self::$categories[$category_slug] = array(
481 481
 						'name'  => $category,
482 482
 						'count' => 0,
483 483
 					);
484 484
 				}
485 485
 
486
-				self::$categories[ $category_slug ]['count']++;
486
+				self::$categories[$category_slug]['count'] ++;
487 487
 			}
488 488
 
489 489
 			// Mark the template as favorite if it's in the favorite templates list.
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		$redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::ignore_template_categories() );
497 497
 		foreach ( $redundant_cats as $redundant_cat ) {
498 498
 			$category_slug = sanitize_title( $redundant_cat );
499
-			unset( self::$categories[ $category_slug ] );
499
+			unset( self::$categories[$category_slug] );
500 500
 		}
501 501
 
502 502
 		// Sort the categories by keys alphabetically.
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 				'count' => 0, // Assigned via JavaScript.
521 521
 			);
522 522
 		}
523
-		$special_categories['all-templates']  = array(
523
+		$special_categories['all-templates'] = array(
524 524
 			'name'  => __( 'All Templates', 'formidable' ),
525 525
 			'count' => self::get_template_count(),
526 526
 		);
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	private static function assign_featured_templates() {
549 549
 		foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
550
-			if ( isset( self::$templates[ $key ] ) ) {
551
-				self::$templates[ $key ]['is_featured'] = true;
552
-				self::$featured_templates[]             = self::$templates[ $key ];
550
+			if ( isset( self::$templates[$key] ) ) {
551
+				self::$templates[$key]['is_featured'] = true;
552
+				self::$featured_templates[]             = self::$templates[$key];
553 553
 			}
554 554
 		}
555 555
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmDashboardController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 		if ( $form_id ) {
378 378
 			self::get_columns_for_form( $form_id, $columns );
379 379
 		} else {
380
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
381
-			$columns[ $form_id . '_name' ]    = __( 'Name', 'formidable' );
382
-			$columns[ $form_id . '_user_id' ] = __( 'Author', 'formidable' );
380
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
381
+			$columns[$form_id . '_name']    = __( 'Name', 'formidable' );
382
+			$columns[$form_id . '_user_id'] = __( 'Author', 'formidable' );
383 383
 		}
384 384
 
385
-		$columns[ $form_id . '_created_at' ] = __( 'Created on', 'formidable' );
385
+		$columns[$form_id . '_created_at'] = __( 'Created on', 'formidable' );
386 386
 
387 387
 		return $columns;
388 388
 	}
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 	 */
546 546
 	private static function get_dashboard_options( $option_name = null ) {
547 547
 		$options = get_option( self::$option_meta_name, array() );
548
-		if ( null !== $option_name && ! isset( $options[ $option_name ] ) ) {
548
+		if ( null !== $option_name && ! isset( $options[$option_name] ) ) {
549 549
 			return array();
550 550
 		}
551 551
 		if ( null !== $option_name ) {
552
-			return $options[ $option_name ];
552
+			return $options[$option_name];
553 553
 		}
554 554
 		return $options;
555 555
 	}
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	private static function update_dashboard_options( $data, $option_name ) {
566 566
 		$options                 = self::get_dashboard_options();
567
-		$options[ $option_name ] = $data;
567
+		$options[$option_name] = $data;
568 568
 		update_option( self::$option_meta_name, $options, 'no' );
569 569
 	}
570 570
 
Please login to merge, or discard this patch.
classes/helpers/FrmListHelper.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 			return $this->get_pagenum();
236 236
 		}
237 237
 
238
-		if ( isset( $this->_pagination_args[ $key ] ) ) {
239
-			return $this->_pagination_args[ $key ];
238
+		if ( isset( $this->_pagination_args[$key] ) ) {
239
+			return $this->_pagination_args[$key];
240 240
 		}
241 241
 	}
242 242
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	}
285 285
 
286 286
 	private function hidden_search_inputs( $param_name ) {
287
-		if ( ! empty( $_REQUEST[ $param_name ] ) ) {
288
-			$value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) );
287
+		if ( ! empty( $_REQUEST[$param_name] ) ) {
288
+			$value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) );
289 289
 			echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />';
290 290
 		}
291 291
 	}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
 		echo "<ul class='subsubsub'>\n";
331 331
 		foreach ( $views as $class => $view ) {
332
-			$views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
332
+			$views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
333 333
 		}
334 334
 		echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
335 335
 		echo '</ul>';
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 			'next'  => __( 'Next page', 'formidable' ),
710 710
 		);
711 711
 
712
-		return $labels[ $link ];
712
+		return $labels[$link];
713 713
 	}
714 714
 
715 715
 	private function current_url() {
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 
803 803
 		// If the primary column doesn't exist fall back to the
804 804
 		// first non-checkbox column.
805
-		if ( ! isset( $columns[ $default ] ) ) {
805
+		if ( ! isset( $columns[$default] ) ) {
806 806
 			$default = self::get_default_primary_column_name();
807 807
 		}
808 808
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		 */
817 817
 		$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
818 818
 
819
-		if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
819
+		if ( empty( $column ) || ! isset( $columns[$column] ) ) {
820 820
 			$column = $default;
821 821
 		}
822 822
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 			// In 4.3, we added a fourth argument for primary column.
839 839
 			$column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
840 840
 			foreach ( $this->_column_headers as $key => $value ) {
841
-				$column_headers[ $key ] = $value;
841
+				$column_headers[$key] = $value;
842 842
 			}
843 843
 
844 844
 			return $column_headers;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 				$data[1] = false;
872 872
 			}
873 873
 
874
-			$sortable[ $id ] = $data;
874
+			$sortable[$id] = $data;
875 875
 		}
876 876
 
877 877
 		$primary = $this->get_primary_column_name();
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 				$class[] = 'column-primary';
949 949
 			}
950 950
 
951
-			if ( isset( $sortable[ $column_key ] ) ) {
952
-				list( $orderby, $desc_first ) = $sortable[ $column_key ];
951
+			if ( isset( $sortable[$column_key] ) ) {
952
+				list( $orderby, $desc_first ) = $sortable[$column_key];
953 953
 
954 954
 				if ( $current_orderby == $orderby ) {
955 955
 					$order   = 'asc' == $current_order ? 'desc' : 'asc';
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 	 * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false.
1034 1034
 	 */
1035 1035
 	protected function should_display( $args, $settings ) {
1036
-		return ! isset( $args[ $settings ] ) || false !== $args[ $settings ];
1036
+		return ! isset( $args[$settings] ) || false !== $args[$settings];
1037 1037
 	}
1038 1038
 
1039 1039
 	/**
Please login to merge, or discard this patch.