@@ -322,11 +322,11 @@ discard block |
||
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 |
||
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'] ) || ! isset( $template['id'] ) ) { |
458 | - unset( self::$templates[ $key ] ); |
|
458 | + unset( self::$templates[$key] ); |
|
459 | 459 | continue; |
460 | 460 | } |
461 | 461 | |
@@ -469,14 +469,12 @@ discard block |
||
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 | // Mark the template as favorite if it's in the favorite templates list. |
@@ -491,7 +489,7 @@ discard block |
||
491 | 489 | $redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::get_license_types() ); |
492 | 490 | foreach ( $redundant_cats as $redundant_cat ) { |
493 | 491 | $category_slug = sanitize_title( $redundant_cat ); |
494 | - unset( self::$categories[ $category_slug ] ); |
|
492 | + unset( self::$categories[$category_slug] ); |
|
495 | 493 | } |
496 | 494 | |
497 | 495 | // Sort the categories by keys alphabetically. |
@@ -516,7 +514,7 @@ discard block |
||
516 | 514 | 'count' => 0, |
517 | 515 | ); |
518 | 516 | } |
519 | - $special_categories['all-items'] = array( |
|
517 | + $special_categories['all-items'] = array( |
|
520 | 518 | 'name' => __( 'All Templates', 'formidable' ), |
521 | 519 | 'count' => self::get_template_count(), |
522 | 520 | ); |
@@ -539,9 +537,9 @@ discard block |
||
539 | 537 | */ |
540 | 538 | private static function assign_featured_templates() { |
541 | 539 | foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) { |
542 | - if ( isset( self::$templates[ $key ] ) ) { |
|
543 | - self::$templates[ $key ]['is_featured'] = true; |
|
544 | - self::$featured_templates[] = self::$templates[ $key ]; |
|
540 | + if ( isset( self::$templates[$key] ) ) { |
|
541 | + self::$templates[$key]['is_featured'] = true; |
|
542 | + self::$featured_templates[] = self::$templates[$key]; |
|
545 | 543 | } |
546 | 544 | } |
547 | 545 | } |