Completed
Pull Request — master (#2277)
by
unknown
53s
created
classes/controllers/FrmFormTemplatesController.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
 		// Perform add or remove operation.
324 324
 		if ( 'add' === $operation ) {
325
-			self::$favorite_templates[ $key ][] = $template_id;
325
+			self::$favorite_templates[$key][] = $template_id;
326 326
 		} elseif ( 'remove' === $operation ) {
327
-			$position = array_search( $template_id, self::$favorite_templates[ $key ], true );
327
+			$position = array_search( $template_id, self::$favorite_templates[$key], true );
328 328
 			if ( $position !== false ) {
329
-				unset( self::$favorite_templates[ $key ][ $position ] );
329
+				unset( self::$favorite_templates[$key][$position] );
330 330
 			}
331 331
 		}
332 332
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		foreach ( self::$templates as $key => &$template ) {
456 456
 			// Skip the template if the categories are not set.
457 457
 			if ( ! isset( $template['categories'] ) ) {
458
-				unset( self::$templates[ $key ] );
458
+				unset( self::$templates[$key] );
459 459
 				continue;
460 460
 			}
461 461
 
@@ -469,14 +469,12 @@  discard block
 block discarded – undo
469 469
 				// Add the slug to the new array.
470 470
 				$template['category_slugs'][] = $category_slug;
471 471
 
472
-				if ( ! isset( self::$categories[ $category_slug ] ) ) {
473
-					self::$categories[ $category_slug ] = array(
472
+				if ( ! isset( self::$categories[$category_slug] ) ) {
473
+					self::$categories[$category_slug] = array(
474 474
 						'name'  => $category,
475 475
 						'count' => 0,
476 476
 					);
477
-				}
478
-
479
-				++self::$categories[ $category_slug ]['count'];
477
+				} ++self::$categories[$category_slug]['count'];
480 478
 			}
481 479
 
482 480
 			if ( ! isset( $template['id'] ) ) {
@@ -498,7 +496,7 @@  discard block
 block discarded – undo
498 496
 		$redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::get_license_types() );
499 497
 		foreach ( $redundant_cats as $redundant_cat ) {
500 498
 			$category_slug = sanitize_title( $redundant_cat );
501
-			unset( self::$categories[ $category_slug ] );
499
+			unset( self::$categories[$category_slug] );
502 500
 		}
503 501
 
504 502
 		// Sort the categories by keys alphabetically.
@@ -523,7 +521,7 @@  discard block
 block discarded – undo
523 521
 				'count' => 0,
524 522
 			);
525 523
 		}
526
-		$special_categories['all-items']      = array(
524
+		$special_categories['all-items'] = array(
527 525
 			'name'  => __( 'All Templates', 'formidable' ),
528 526
 			'count' => self::get_template_count(),
529 527
 		);
@@ -546,9 +544,9 @@  discard block
 block discarded – undo
546 544
 	 */
547 545
 	private static function assign_featured_templates() {
548 546
 		foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
549
-			if ( isset( self::$templates[ $key ] ) ) {
550
-				self::$templates[ $key ]['is_featured'] = true;
551
-				self::$featured_templates[]             = self::$templates[ $key ];
547
+			if ( isset( self::$templates[$key] ) ) {
548
+				self::$templates[$key]['is_featured'] = true;
549
+				self::$featured_templates[]             = self::$templates[$key];
552 550
 			}
553 551
 		}
554 552
 	}
Please login to merge, or discard this patch.