| Conditions | 24 | 
| Paths | > 20000 | 
| Total Lines | 441 | 
| Code Lines | 288 | 
| Lines | 108 | 
| Ratio | 24.49 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 485 | 	public function add_my_sites_submenu( $wp_admin_bar ) { | 
            ||
| 486 | $current_user = wp_get_current_user();  | 
            ||
| 487 | |||
| 488 | $blog_name = get_bloginfo( 'name' );  | 
            ||
| 489 | 		if ( empty( $blog_name ) ) { | 
            ||
| 490 | $blog_name = $this->primary_site_slug;  | 
            ||
| 491 | }  | 
            ||
| 492 | |||
| 493 | 		if ( mb_strlen( $blog_name ) > 20 ) { | 
            ||
| 494 | $blog_name = mb_substr( html_entity_decode( $blog_name, ENT_QUOTES ), 0, 20 ) . '…';  | 
            ||
| 495 | }  | 
            ||
| 496 | |||
| 497 | $wp_admin_bar->add_menu( array(  | 
            ||
| 498 | 'parent' => 'root-default',  | 
            ||
| 499 | 'id' => 'blog',  | 
            ||
| 500 | 'title' => _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack' ),  | 
            ||
| 501 | 'href' => '#',  | 
            ||
| 502 | 'meta' => array(  | 
            ||
| 503 | 'class' => 'my-sites',  | 
            ||
| 504 | ),  | 
            ||
| 505 | ) );  | 
            ||
| 506 | |||
| 507 | 		if ( $this->user_site_count > 1 ) { | 
            ||
| 508 | $wp_admin_bar->add_menu( array(  | 
            ||
| 509 | 'parent' => 'blog',  | 
            ||
| 510 | 'id' => 'switch-site',  | 
            ||
| 511 | 'title' => __( 'Switch Site', 'jetpack' ),  | 
            ||
| 512 | 'href' => 'https://wordpress.com/sites',  | 
            ||
| 513 | ) );  | 
            ||
| 514 | 		} else { | 
            ||
| 515 | $wp_admin_bar->add_menu( array(  | 
            ||
| 516 | 'parent' => 'blog',  | 
            ||
| 517 | 'id' => 'new-site',  | 
            ||
| 518 | 'title' => __( '+ Add New WordPress', 'jetpack' ),  | 
            ||
| 519 | 'href' => 'https://wordpress.com/start?ref=admin-bar-logged-in',  | 
            ||
| 520 | ) );  | 
            ||
| 521 | }  | 
            ||
| 522 | |||
| 523 | 		if ( is_user_member_of_blog( $current_user->ID ) ) { | 
            ||
| 524 | $blavatar = '';  | 
            ||
| 525 | $class = 'current-site';  | 
            ||
| 526 | |||
| 527 | 			if ( has_site_icon() ) { | 
            ||
| 528 | $src = get_site_icon_url();  | 
            ||
| 529 | $blavatar = '<img class="avatar" src="'. esc_attr( $src ) . '" alt="Current site avatar">';  | 
            ||
| 530 | $class = 'has-blavatar';  | 
            ||
| 531 | }  | 
            ||
| 532 | |||
| 533 | $site_link = str_replace( '::', '/', $this->primary_site_slug );  | 
            ||
| 534 | $blog_info = '<div class="ab-site-icon">' . $blavatar . '</div>';  | 
            ||
| 535 | $blog_info .= '<span class="ab-site-title">' . esc_html( $blog_name ) . '</span>';  | 
            ||
| 536 | $blog_info .= '<span class="ab-site-description">' . esc_html( $site_link ) . '</span>';  | 
            ||
| 537 | |||
| 538 | $wp_admin_bar->add_menu( array(  | 
            ||
| 539 | 'parent' => 'blog',  | 
            ||
| 540 | 'id' => 'blog-info',  | 
            ||
| 541 | 'title' => $blog_info,  | 
            ||
| 542 | 'href' => esc_url( trailingslashit( $this->primary_site_slug ) ),  | 
            ||
| 543 | 'meta' => array(  | 
            ||
| 544 | 'class' => $class,  | 
            ||
| 545 | ),  | 
            ||
| 546 | ) );  | 
            ||
| 547 | |||
| 548 | }  | 
            ||
| 549 | |||
| 550 | // Stats  | 
            ||
| 551 | View Code Duplication | 		if ( Jetpack::is_module_active( 'stats' ) ) { | 
            |
| 552 | $wp_admin_bar->add_menu( array(  | 
            ||
| 553 | 'parent' => 'blog',  | 
            ||
| 554 | 'id' => 'blog-stats',  | 
            ||
| 555 | 'title' => __( 'Stats', 'jetpack' ),  | 
            ||
| 556 | 'href' => 'https://wordpress.com/stats/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 557 | 'meta' => array(  | 
            ||
| 558 | 'class' => 'mb-icon',  | 
            ||
| 559 | ),  | 
            ||
| 560 | ) );  | 
            ||
| 561 | }  | 
            ||
| 562 | |||
| 563 | // Add Calypso plans link and plan type indicator  | 
            ||
| 564 | 		if ( is_user_member_of_blog( $current_user->ID ) ) { | 
            ||
| 565 | $plans_url = 'https://wordpress.com/plans/' . esc_attr( $this->primary_site_slug );  | 
            ||
| 566 | $label = __( 'Plan', 'jetpack' );  | 
            ||
| 567 | $plan = Jetpack::get_active_plan();  | 
            ||
| 568 | |||
| 569 | $plan_title = $this->create_menu_item_pair(  | 
            ||
| 570 | array(  | 
            ||
| 571 | 'url' => $plans_url,  | 
            ||
| 572 | 'id' => 'wp-admin-bar-plan',  | 
            ||
| 573 | 'label' => $label,  | 
            ||
| 574 | ),  | 
            ||
| 575 | array(  | 
            ||
| 576 | 'url' => $plans_url,  | 
            ||
| 577 | 'id' => 'wp-admin-bar-plan-badge',  | 
            ||
| 578 | 'label' => $plan['product_name_short']  | 
            ||
| 579 | )  | 
            ||
| 580 | );  | 
            ||
| 581 | |||
| 582 | $wp_admin_bar->add_menu( array(  | 
            ||
| 583 | 'parent' => 'blog',  | 
            ||
| 584 | 'id' => 'plan',  | 
            ||
| 585 | 'title' => $plan_title,  | 
            ||
| 586 | 'meta' => array(  | 
            ||
| 587 | 'class' => 'inline-action',  | 
            ||
| 588 | ),  | 
            ||
| 589 | ) );  | 
            ||
| 590 | }  | 
            ||
| 591 | |||
| 592 | // Publish group  | 
            ||
| 593 | $wp_admin_bar->add_group( array(  | 
            ||
| 594 | 'parent' => 'blog',  | 
            ||
| 595 | 'id' => 'publish',  | 
            ||
| 596 | ) );  | 
            ||
| 597 | |||
| 598 | // Publish header  | 
            ||
| 599 | $wp_admin_bar->add_menu( array(  | 
            ||
| 600 | 'parent' => 'publish',  | 
            ||
| 601 | 'id' => 'publish-header',  | 
            ||
| 602 | 'title' => _x( 'Publish', 'admin bar menu group label', 'jetpack' ),  | 
            ||
| 603 | 'meta' => array(  | 
            ||
| 604 | 'class' => 'ab-submenu-header',  | 
            ||
| 605 | ),  | 
            ||
| 606 | ) );  | 
            ||
| 607 | |||
| 608 | // Blog Posts  | 
            ||
| 609 | $posts_title = $this->create_menu_item_pair(  | 
            ||
| 610 | array(  | 
            ||
| 611 | 'url' => 'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 612 | 'id' => 'wp-admin-bar-edit-post',  | 
            ||
| 613 | 'label' => __( 'Blog Posts', 'jetpack' ),  | 
            ||
| 614 | ),  | 
            ||
| 615 | array(  | 
            ||
| 616 | 'url' => 'https://wordpress.com/post/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 617 | 'id' => 'wp-admin-bar-new-post',  | 
            ||
| 618 | 'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ),  | 
            ||
| 619 | )  | 
            ||
| 620 | );  | 
            ||
| 621 | |||
| 622 | 		if ( ! current_user_can( 'edit_posts' ) ) { | 
            ||
| 623 | $posts_title = $this->create_menu_item_anchor(  | 
            ||
| 624 | 'ab-item ab-primary mb-icon',  | 
            ||
| 625 | 'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 626 | __( 'Blog Posts', 'jetpack' ),  | 
            ||
| 627 | 'wp-admin-bar-edit-post'  | 
            ||
| 628 | );  | 
            ||
| 629 | }  | 
            ||
| 630 | |||
| 631 | $wp_admin_bar->add_menu( array(  | 
            ||
| 632 | 'parent' => 'publish',  | 
            ||
| 633 | 'id' => 'new-post',  | 
            ||
| 634 | 'title' => $posts_title,  | 
            ||
| 635 | 'meta' => array(  | 
            ||
| 636 | 'class' => 'inline-action',  | 
            ||
| 637 | ),  | 
            ||
| 638 | ) );  | 
            ||
| 639 | |||
| 640 | // Pages  | 
            ||
| 641 | $pages_title = $this->create_menu_item_pair(  | 
            ||
| 642 | array(  | 
            ||
| 643 | 'url' => 'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 644 | 'id' => 'wp-admin-bar-edit-page',  | 
            ||
| 645 | 'label' => __( 'Pages', 'jetpack' ),  | 
            ||
| 646 | ),  | 
            ||
| 647 | array(  | 
            ||
| 648 | 'url' => 'https://wordpress.com/page/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 649 | 'id' => 'wp-admin-bar-new-page',  | 
            ||
| 650 | 'label' => _x( 'Add', 'admin bar menu new item label', 'jetpack' ),  | 
            ||
| 651 | )  | 
            ||
| 652 | );  | 
            ||
| 653 | |||
| 654 | 		if ( ! current_user_can( 'edit_pages' ) ) { | 
            ||
| 655 | $pages_title = $this->create_menu_item_anchor(  | 
            ||
| 656 | 'ab-item ab-primary mb-icon',  | 
            ||
| 657 | 'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 658 | __( 'Pages', 'jetpack' ),  | 
            ||
| 659 | 'wp-admin-bar-edit-page'  | 
            ||
| 660 | );  | 
            ||
| 661 | }  | 
            ||
| 662 | |||
| 663 | $wp_admin_bar->add_menu( array(  | 
            ||
| 664 | 'parent' => 'publish',  | 
            ||
| 665 | 'id' => 'new-page',  | 
            ||
| 666 | 'title' => $pages_title,  | 
            ||
| 667 | 'meta' => array(  | 
            ||
| 668 | 'class' => 'inline-action',  | 
            ||
| 669 | ),  | 
            ||
| 670 | ) );  | 
            ||
| 671 | |||
| 672 | // Testimonials  | 
            ||
| 673 | View Code Duplication | 		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) { | 
            |
| 674 | $testimonials_title = $this->create_menu_item_pair(  | 
            ||
| 675 | array(  | 
            ||
| 676 | 'url' => 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 677 | 'id' => 'wp-admin-bar-edit-testimonial',  | 
            ||
| 678 | 'label' => __( 'Testimonials', 'jetpack' ),  | 
            ||
| 679 | ),  | 
            ||
| 680 | array(  | 
            ||
| 681 | 'url' => 'https://wordpress.com/edit/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 682 | 'id' => 'wp-admin-bar-new-testimonial',  | 
            ||
| 683 | 'label' => _x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),  | 
            ||
| 684 | )  | 
            ||
| 685 | );  | 
            ||
| 686 | |||
| 687 | 			if ( ! current_user_can( 'edit_pages' ) ) { | 
            ||
| 688 | $testimonials_title = $this->create_menu_item_anchor(  | 
            ||
| 689 | 'ab-item ab-primary mb-icon',  | 
            ||
| 690 | 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 691 | __( 'Testimonials', 'jetpack' ),  | 
            ||
| 692 | 'wp-admin-bar-edit-testimonial'  | 
            ||
| 693 | );  | 
            ||
| 694 | }  | 
            ||
| 695 | |||
| 696 | $wp_admin_bar->add_menu( array(  | 
            ||
| 697 | 'parent' => 'publish',  | 
            ||
| 698 | 'id' => 'new-jetpack-testimonial',  | 
            ||
| 699 | 'title' => $testimonials_title,  | 
            ||
| 700 | 'meta' => array(  | 
            ||
| 701 | 'class' => 'inline-action',  | 
            ||
| 702 | ),  | 
            ||
| 703 | ) );  | 
            ||
| 704 | }  | 
            ||
| 705 | |||
| 706 | // Portfolio  | 
            ||
| 707 | View Code Duplication | 		if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) { | 
            |
| 708 | $portfolios_title = $this->create_menu_item_pair(  | 
            ||
| 709 | array(  | 
            ||
| 710 | 'url' => 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 711 | 'id' => 'wp-admin-bar-edit-portfolio',  | 
            ||
| 712 | 'label' => __( 'Portfolio', 'jetpack' ),  | 
            ||
| 713 | ),  | 
            ||
| 714 | array(  | 
            ||
| 715 | 'url' => 'https://wordpress.com/edit/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 716 | 'id' => 'wp-admin-bar-new-portfolio',  | 
            ||
| 717 | 'label' => _x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),  | 
            ||
| 718 | )  | 
            ||
| 719 | );  | 
            ||
| 720 | |||
| 721 | 			if ( ! current_user_can( 'edit_pages' ) ) { | 
            ||
| 722 | $portfolios_title = $this->create_menu_item_anchor(  | 
            ||
| 723 | 'ab-item ab-primary mb-icon',  | 
            ||
| 724 | 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 725 | __( 'Portfolio', 'jetpack' ),  | 
            ||
| 726 | 'wp-admin-bar-edit-portfolio'  | 
            ||
| 727 | );  | 
            ||
| 728 | }  | 
            ||
| 729 | |||
| 730 | $wp_admin_bar->add_menu( array(  | 
            ||
| 731 | 'parent' => 'publish',  | 
            ||
| 732 | 'id' => 'new-jetpack-portfolio',  | 
            ||
| 733 | 'title' => $portfolios_title,  | 
            ||
| 734 | 'meta' => array(  | 
            ||
| 735 | 'class' => 'inline-action',  | 
            ||
| 736 | ),  | 
            ||
| 737 | ) );  | 
            ||
| 738 | }  | 
            ||
| 739 | |||
| 740 | 		if ( current_user_can( 'edit_theme_options' ) ) { | 
            ||
| 741 | // Look and Feel group  | 
            ||
| 742 | $wp_admin_bar->add_group( array(  | 
            ||
| 743 | 'parent' => 'blog',  | 
            ||
| 744 | 'id' => 'look-and-feel',  | 
            ||
| 745 | ) );  | 
            ||
| 746 | |||
| 747 | // Look and Feel header  | 
            ||
| 748 | $wp_admin_bar->add_menu( array(  | 
            ||
| 749 | 'parent' => 'look-and-feel',  | 
            ||
| 750 | 'id' => 'look-and-feel-header',  | 
            ||
| 751 | 'title' => _x( 'Personalize', 'admin bar menu group label', 'jetpack' ),  | 
            ||
| 752 | 'meta' => array(  | 
            ||
| 753 | 'class' => 'ab-submenu-header',  | 
            ||
| 754 | ),  | 
            ||
| 755 | ) );  | 
            ||
| 756 | |||
| 757 | 			if ( is_admin() ) { | 
            ||
| 758 | // In wp-admin the `return` query arg will return to that page after closing the Customizer  | 
            ||
| 759 | $customizer_url = add_query_arg( array( 'return' => urlencode( site_url( $_SERVER['REQUEST_URI'] ) ) ), wp_customize_url() );  | 
            ||
| 760 | 			} else { | 
            ||
| 761 | // On the frontend the `url` query arg will load that page in the Customizer and also return to it after closing  | 
            ||
| 762 | // non-home URLs won't work unless we undo domain mapping since the Customizer preview is unmapped to always have HTTPS  | 
            ||
| 763 | $current_page = '//' . $this->primary_site_slug . $_SERVER['REQUEST_URI'];  | 
            ||
| 764 | $customizer_url = add_query_arg( array( 'url' => urlencode( $current_page ) ), wp_customize_url() );  | 
            ||
| 765 | }  | 
            ||
| 766 | |||
| 767 | $theme_title = $this->create_menu_item_pair(  | 
            ||
| 768 | array(  | 
            ||
| 769 | 'url' => 'https://wordpress.com/design/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 770 | 'id' => 'wp-admin-bar-themes',  | 
            ||
| 771 | 'label' => __( 'Themes', 'jetpack' ),  | 
            ||
| 772 | ),  | 
            ||
| 773 | array(  | 
            ||
| 774 | 'url' => $customizer_url,  | 
            ||
| 775 | 'id' => 'wp-admin-bar-cmz',  | 
            ||
| 776 | 'label' => _x( 'Customize', 'admin bar customize item label', 'jetpack' ),  | 
            ||
| 777 | )  | 
            ||
| 778 | );  | 
            ||
| 779 | $meta = array( 'class' => 'mb-icon', 'class' => 'inline-action' );  | 
            ||
| 780 | $href = false;  | 
            ||
| 781 | |||
| 782 | $wp_admin_bar->add_menu( array(  | 
            ||
| 783 | 'parent' => 'look-and-feel',  | 
            ||
| 784 | 'id' => 'themes',  | 
            ||
| 785 | 'title' => $theme_title,  | 
            ||
| 786 | 'href' => $href,  | 
            ||
| 787 | 'meta' => $meta  | 
            ||
| 788 | ) );  | 
            ||
| 789 | |||
| 790 | View Code Duplication | 			if ( current_theme_supports( 'menus' ) ) { | 
            |
| 791 | $wp_admin_bar->add_menu( array(  | 
            ||
| 792 | 'parent' => 'look-and-feel',  | 
            ||
| 793 | 'id' => 'menus',  | 
            ||
| 794 | 'title' => __( 'Menus', 'jetpack' ),  | 
            ||
| 795 | 'href' => 'https://wordpress.com/menus/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 796 | 'meta' => array(  | 
            ||
| 797 | 'class' => 'mb-icon',  | 
            ||
| 798 | ),  | 
            ||
| 799 | ) );  | 
            ||
| 800 | }  | 
            ||
| 801 | }  | 
            ||
| 802 | |||
| 803 | 		if ( current_user_can( 'manage_options' ) ) { | 
            ||
| 804 | // Configuration group  | 
            ||
| 805 | $wp_admin_bar->add_group( array(  | 
            ||
| 806 | 'parent' => 'blog',  | 
            ||
| 807 | 'id' => 'configuration',  | 
            ||
| 808 | ) );  | 
            ||
| 809 | |||
| 810 | // Configuration header  | 
            ||
| 811 | $wp_admin_bar->add_menu( array(  | 
            ||
| 812 | 'parent' => 'configuration',  | 
            ||
| 813 | 'id' => 'configuration-header',  | 
            ||
| 814 | 'title' => __( 'Configure', 'admin bar menu group label', 'jetpack' ),  | 
            ||
| 815 | 'meta' => array(  | 
            ||
| 816 | 'class' => 'ab-submenu-header',  | 
            ||
| 817 | ),  | 
            ||
| 818 | ) );  | 
            ||
| 819 | |||
| 820 | View Code Duplication | 			if ( Jetpack::is_module_active( 'publicize' ) || Jetpack::is_module_active( 'sharedaddy' ) ) { | 
            |
| 821 | $wp_admin_bar->add_menu( array(  | 
            ||
| 822 | 'parent' => 'configuration',  | 
            ||
| 823 | 'id' => 'sharing',  | 
            ||
| 824 | 'title' => __( 'Sharing', 'jetpack' ),  | 
            ||
| 825 | 'href' => 'https://wordpress.com/sharing/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 826 | 'meta' => array(  | 
            ||
| 827 | 'class' => 'mb-icon',  | 
            ||
| 828 | ),  | 
            ||
| 829 | ) );  | 
            ||
| 830 | }  | 
            ||
| 831 | |||
| 832 | $people_title = $this->create_menu_item_pair(  | 
            ||
| 833 | array(  | 
            ||
| 834 | 'url' => 'https://wordpress.com/people/team/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 835 | 'id' => 'wp-admin-bar-people',  | 
            ||
| 836 | 'label' => __( 'People', 'jetpack' ),  | 
            ||
| 837 | ),  | 
            ||
| 838 | array(  | 
            ||
| 839 | 'url' => '//' . esc_attr( $this->primary_site_slug ) . '/wp-admin/user-new.php',  | 
            ||
| 840 | 'id' => 'wp-admin-bar-people-add',  | 
            ||
| 841 | 'label' => _x( 'Add', 'admin bar people item label', 'jetpack' ),  | 
            ||
| 842 | )  | 
            ||
| 843 | );  | 
            ||
| 844 | |||
| 845 | $wp_admin_bar->add_menu( array(  | 
            ||
| 846 | 'parent' => 'configuration',  | 
            ||
| 847 | 'id' => 'users-toolbar',  | 
            ||
| 848 | 'title' => $people_title,  | 
            ||
| 849 | 'href' => false,  | 
            ||
| 850 | 'meta' => array(  | 
            ||
| 851 | 'class' => 'inline-action',  | 
            ||
| 852 | ),  | 
            ||
| 853 | ) );  | 
            ||
| 854 | |||
| 855 | $plugins_title = $this->create_menu_item_pair(  | 
            ||
| 856 | array(  | 
            ||
| 857 | 'url' => 'https://wordpress.com/plugins/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 858 | 'id' => 'wp-admin-bar-plugins',  | 
            ||
| 859 | 'label' => __( 'Plugins', 'jetpack' ),  | 
            ||
| 860 | ),  | 
            ||
| 861 | array(  | 
            ||
| 862 | 'url' => 'https://wordpress.com/plugins/browse/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 863 | 'id' => 'wp-admin-bar-plugins-add',  | 
            ||
| 864 | 'label' => _x( 'Add', 'Label for the button on the Masterbar to add a new plugin', 'jetpack' ),  | 
            ||
| 865 | )  | 
            ||
| 866 | );  | 
            ||
| 867 | |||
| 868 | $wp_admin_bar->add_menu( array(  | 
            ||
| 869 | 'parent' => 'configuration',  | 
            ||
| 870 | 'id' => 'plugins',  | 
            ||
| 871 | 'title' => $plugins_title,  | 
            ||
| 872 | 'href' => false,  | 
            ||
| 873 | 'meta' => array(  | 
            ||
| 874 | 'class' => 'inline-action',  | 
            ||
| 875 | ),  | 
            ||
| 876 | ) );  | 
            ||
| 877 | |||
| 878 | 			if ( $this->is_automated_transfer_site() ) { | 
            ||
| 879 | $domain_title = $this->create_menu_item_pair(  | 
            ||
| 880 | array(  | 
            ||
| 881 | 'url' => 'https://wordpress.com/domains/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 882 | 'id' => 'wp-admin-bar-domains',  | 
            ||
| 883 | 'label' => __( 'Domains', 'jetpack' ),  | 
            ||
| 884 | ),  | 
            ||
| 885 | array(  | 
            ||
| 886 | 'url' => 'https://wordpress.com/domains/add/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 887 | 'id' => 'wp-admin-bar-domains-add',  | 
            ||
| 888 | 'label' => _x( 'Add', 'Label for the button on the Masterbar to add a new domain', 'jetpack' ),  | 
            ||
| 889 | )  | 
            ||
| 890 | );  | 
            ||
| 891 | $wp_admin_bar->add_menu( array(  | 
            ||
| 892 | 'parent' => 'configuration',  | 
            ||
| 893 | 'id' => 'domains',  | 
            ||
| 894 | 'title' => $domain_title,  | 
            ||
| 895 | 'href' => false,  | 
            ||
| 896 | 'meta' => array(  | 
            ||
| 897 | 'class' => 'inline-action',  | 
            ||
| 898 | ),  | 
            ||
| 899 | ) );  | 
            ||
| 900 | }  | 
            ||
| 901 | |||
| 902 | |||
| 903 | $wp_admin_bar->add_menu( array(  | 
            ||
| 904 | 'parent' => 'configuration',  | 
            ||
| 905 | 'id' => 'blog-settings',  | 
            ||
| 906 | 'title' => __( 'Settings', 'jetpack' ),  | 
            ||
| 907 | 'href' => 'https://wordpress.com/settings/general/' . esc_attr( $this->primary_site_slug ),  | 
            ||
| 908 | 'meta' => array(  | 
            ||
| 909 | 'class' => 'mb-icon',  | 
            ||
| 910 | ),  | 
            ||
| 911 | ) );  | 
            ||
| 912 | |||
| 913 | View Code Duplication | 			if ( $this->is_automated_transfer_site() ) { | 
            |
| 914 | $wp_admin_bar->add_menu( array(  | 
            ||
| 915 | 'parent' => 'configuration',  | 
            ||
| 916 | 'id' => 'legacy-dashboard',  | 
            ||
| 917 | 'title' => __( 'WP Admin', 'jetpack' ),  | 
            ||
| 918 | 'href' => '//' . esc_attr( $this->primary_site_slug ) . '/wp-admin/',  | 
            ||
| 919 | 'meta' => array(  | 
            ||
| 920 | 'class' => 'mb-icon',  | 
            ||
| 921 | ),  | 
            ||
| 922 | ) );  | 
            ||
| 923 | }  | 
            ||
| 924 | }  | 
            ||
| 925 | }  | 
            ||
| 926 | }  | 
            ||
| 927 |