| Conditions | 31 |
| Paths | > 20000 |
| Total Lines | 554 |
| Lines | 94 |
| Ratio | 16.97 % |
| 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 |
||
| 816 | public function add_my_sites_submenu( $wp_admin_bar ) { |
||
| 817 | $current_user = wp_get_current_user(); |
||
| 818 | |||
| 819 | $blog_name = get_bloginfo( 'name' ); |
||
| 820 | if ( empty( $blog_name ) ) { |
||
| 821 | $blog_name = $this->primary_site_slug; |
||
| 822 | } |
||
| 823 | |||
| 824 | if ( mb_strlen( $blog_name ) > 20 ) { |
||
| 825 | $blog_name = mb_substr( html_entity_decode( $blog_name, ENT_QUOTES ), 0, 20 ) . '…'; |
||
| 826 | } |
||
| 827 | |||
| 828 | $wp_admin_bar->add_menu( |
||
| 829 | array( |
||
| 830 | 'parent' => 'root-default', |
||
| 831 | 'id' => 'blog', |
||
| 832 | 'title' => _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack' ), |
||
| 833 | 'href' => 'https://wordpress.com/sites/' . $this->primary_site_url, |
||
| 834 | 'meta' => array( |
||
| 835 | 'class' => 'my-sites mb-trackable', |
||
| 836 | ), |
||
| 837 | ) |
||
| 838 | ); |
||
| 839 | |||
| 840 | /** This filter is documented in modules/masterbar.php */ |
||
| 841 | if ( apply_filters( 'jetpack_load_admin_menu_class', false ) ) { |
||
| 842 | return; |
||
| 843 | } |
||
| 844 | |||
| 845 | if ( $this->user_site_count > 1 ) { |
||
| 846 | $wp_admin_bar->add_menu( |
||
| 847 | array( |
||
| 848 | 'parent' => 'blog', |
||
| 849 | 'id' => 'switch-site', |
||
| 850 | 'title' => esc_html__( 'Switch Site', 'jetpack' ), |
||
| 851 | 'href' => Redirect::get_url( 'calypso-sites' ), |
||
| 852 | ) |
||
| 853 | ); |
||
| 854 | } else { |
||
| 855 | $wp_admin_bar->add_menu( |
||
| 856 | array( |
||
| 857 | 'parent' => 'blog', |
||
| 858 | 'id' => 'new-site', |
||
| 859 | 'title' => esc_html__( '+ Add New WordPress', 'jetpack' ), |
||
| 860 | 'href' => Redirect::get_url( 'calypso-start', array( 'query' => 'ref=admin-bar-logged-in' ) ), |
||
| 861 | ) |
||
| 862 | ); |
||
| 863 | } |
||
| 864 | |||
| 865 | if ( is_user_member_of_blog( $current_user->ID ) ) { |
||
| 866 | $blavatar = ''; |
||
| 867 | $class = 'current-site'; |
||
| 868 | |||
| 869 | if ( has_site_icon() ) { |
||
| 870 | $src = get_site_icon_url(); |
||
| 871 | $blavatar = '<img class="avatar" src="' . esc_attr( $src ) . '" alt="Current site avatar">'; |
||
| 872 | $class = 'has-blavatar'; |
||
| 873 | } |
||
| 874 | |||
| 875 | $blog_info = '<div class="ab-site-icon">' . $blavatar . '</div>'; |
||
| 876 | $blog_info .= '<span class="ab-site-title">' . esc_html( $blog_name ) . '</span>'; |
||
| 877 | $blog_info .= '<span class="ab-site-description">' . esc_html( $this->primary_site_url ) . '</span>'; |
||
| 878 | |||
| 879 | $wp_admin_bar->add_menu( |
||
| 880 | array( |
||
| 881 | 'parent' => 'blog', |
||
| 882 | 'id' => 'blog-info', |
||
| 883 | 'title' => $blog_info, |
||
| 884 | 'href' => esc_url( trailingslashit( $this->primary_site_url ) ), |
||
| 885 | 'meta' => array( |
||
| 886 | 'class' => $class, |
||
| 887 | ), |
||
| 888 | ) |
||
| 889 | ); |
||
| 890 | } |
||
| 891 | |||
| 892 | // Site Preview. |
||
| 893 | if ( is_admin() ) { |
||
| 894 | $wp_admin_bar->add_menu( |
||
| 895 | array( |
||
| 896 | 'parent' => 'blog', |
||
| 897 | 'id' => 'site-view', |
||
| 898 | 'title' => __( 'View Site', 'jetpack' ), |
||
| 899 | 'href' => home_url(), |
||
| 900 | 'meta' => array( |
||
| 901 | 'class' => 'mb-icon', |
||
| 902 | 'target' => '_blank', |
||
| 903 | ), |
||
| 904 | ) |
||
| 905 | ); |
||
| 906 | } |
||
| 907 | |||
| 908 | $this->add_my_home_submenu_item( $wp_admin_bar ); |
||
| 909 | |||
| 910 | // Stats. |
||
| 911 | View Code Duplication | if ( Jetpack::is_module_active( 'stats' ) && current_user_can( 'view_stats' ) ) { |
|
| 912 | $wp_admin_bar->add_menu( |
||
| 913 | array( |
||
| 914 | 'parent' => 'blog', |
||
| 915 | 'id' => 'blog-stats', |
||
| 916 | 'title' => esc_html__( 'Stats', 'jetpack' ), |
||
| 917 | 'href' => Redirect::get_url( 'calypso-stats' ), |
||
| 918 | 'meta' => array( |
||
| 919 | 'class' => 'mb-icon', |
||
| 920 | ), |
||
| 921 | ) |
||
| 922 | ); |
||
| 923 | } |
||
| 924 | |||
| 925 | if ( current_user_can( 'manage_options' ) ) { |
||
| 926 | $wp_admin_bar->add_menu( |
||
| 927 | array( |
||
| 928 | 'parent' => 'blog', |
||
| 929 | 'id' => 'activity', |
||
| 930 | 'title' => esc_html__( 'Activity', 'jetpack' ), |
||
| 931 | 'href' => Redirect::get_url( 'calypso-activity-log' ), |
||
| 932 | 'meta' => array( |
||
| 933 | 'class' => 'mb-icon', |
||
| 934 | ), |
||
| 935 | ) |
||
| 936 | ); |
||
| 937 | } |
||
| 938 | |||
| 939 | // Add Calypso plans link and plan type indicator. |
||
| 940 | if ( is_user_member_of_blog( $current_user->ID ) && current_user_can( 'manage_options' ) ) { |
||
| 941 | $plans_url = Redirect::get_url( 'calypso-plans' ); |
||
| 942 | $label = esc_html__( 'Plan', 'jetpack' ); |
||
| 943 | $plan = Jetpack_Plan::get(); |
||
| 944 | |||
| 945 | $plan_title = $this->create_menu_item_pair( |
||
| 946 | array( |
||
| 947 | 'url' => $plans_url, |
||
| 948 | 'id' => 'wp-admin-bar-plan', |
||
| 949 | 'label' => $label, |
||
| 950 | ), |
||
| 951 | array( |
||
| 952 | 'url' => $plans_url, |
||
| 953 | 'id' => 'wp-admin-bar-plan-badge', |
||
| 954 | 'label' => ! empty( $plan['product_name_short'] ) ? $plan['product_name_short'] : esc_html__( 'Free', 'jetpack' ), |
||
| 955 | ) |
||
| 956 | ); |
||
| 957 | |||
| 958 | $wp_admin_bar->add_menu( |
||
| 959 | array( |
||
| 960 | 'parent' => 'blog', |
||
| 961 | 'id' => 'plan', |
||
| 962 | 'title' => $plan_title, |
||
| 963 | 'meta' => array( |
||
| 964 | 'class' => 'inline-action', |
||
| 965 | ), |
||
| 966 | ) |
||
| 967 | ); |
||
| 968 | } |
||
| 969 | |||
| 970 | // Publish group. |
||
| 971 | $wp_admin_bar->add_group( |
||
| 972 | array( |
||
| 973 | 'parent' => 'blog', |
||
| 974 | 'id' => 'publish', |
||
| 975 | ) |
||
| 976 | ); |
||
| 977 | |||
| 978 | // Publish header. |
||
| 979 | $wp_admin_bar->add_menu( |
||
| 980 | array( |
||
| 981 | 'parent' => 'publish', |
||
| 982 | 'id' => 'publish-header', |
||
| 983 | 'title' => esc_html_x( 'Manage', 'admin bar menu group label', 'jetpack' ), |
||
| 984 | 'meta' => array( |
||
| 985 | 'class' => 'ab-submenu-header', |
||
| 986 | ), |
||
| 987 | ) |
||
| 988 | ); |
||
| 989 | |||
| 990 | // Pages. |
||
| 991 | $pages_title = $this->create_menu_item_pair( |
||
| 992 | array( |
||
| 993 | 'url' => Redirect::get_url( 'calypso-edit-pages' ), |
||
| 994 | 'id' => 'wp-admin-bar-edit-page', |
||
| 995 | 'label' => esc_html__( 'Site Pages', 'jetpack' ), |
||
| 996 | ), |
||
| 997 | array( |
||
| 998 | 'url' => Redirect::get_url( 'calypso-edit-page' ), |
||
| 999 | 'id' => 'wp-admin-bar-new-page-badge', |
||
| 1000 | 'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
||
| 1001 | ) |
||
| 1002 | ); |
||
| 1003 | |||
| 1004 | if ( ! current_user_can( 'edit_pages' ) ) { |
||
| 1005 | $pages_title = $this->create_menu_item_anchor( |
||
| 1006 | 'ab-item ab-primary mb-icon', |
||
| 1007 | Redirect::get_url( 'calypso-edit-pages' ), |
||
| 1008 | esc_html__( 'Site Pages', 'jetpack' ), |
||
| 1009 | 'wp-admin-bar-edit-page' |
||
| 1010 | ); |
||
| 1011 | } |
||
| 1012 | |||
| 1013 | $wp_admin_bar->add_menu( |
||
| 1014 | array( |
||
| 1015 | 'parent' => 'publish', |
||
| 1016 | 'id' => 'new-page', |
||
| 1017 | 'title' => $pages_title, |
||
| 1018 | 'meta' => array( |
||
| 1019 | 'class' => 'inline-action', |
||
| 1020 | ), |
||
| 1021 | ) |
||
| 1022 | ); |
||
| 1023 | |||
| 1024 | // Blog Posts. |
||
| 1025 | $posts_title = $this->create_menu_item_pair( |
||
| 1026 | array( |
||
| 1027 | 'url' => Redirect::get_url( 'calypso-edit-posts' ), |
||
| 1028 | 'id' => 'wp-admin-bar-edit-post', |
||
| 1029 | 'label' => esc_html__( 'Blog Posts', 'jetpack' ), |
||
| 1030 | ), |
||
| 1031 | array( |
||
| 1032 | 'url' => Redirect::get_url( 'calypso-edit-post' ), |
||
| 1033 | 'id' => 'wp-admin-bar-new-post-badge', |
||
| 1034 | 'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ), |
||
| 1035 | ) |
||
| 1036 | ); |
||
| 1037 | |||
| 1038 | if ( ! current_user_can( 'edit_posts' ) ) { |
||
| 1039 | $posts_title = $this->create_menu_item_anchor( |
||
| 1040 | 'ab-item ab-primary mb-icon', |
||
| 1041 | Redirect::get_url( 'calypso-edit-posts' ), |
||
| 1042 | esc_html__( 'Blog Posts', 'jetpack' ), |
||
| 1043 | 'wp-admin-bar-edit-post' |
||
| 1044 | ); |
||
| 1045 | } |
||
| 1046 | |||
| 1047 | $wp_admin_bar->add_menu( |
||
| 1048 | array( |
||
| 1049 | 'parent' => 'publish', |
||
| 1050 | 'id' => 'new-post', |
||
| 1051 | 'title' => $posts_title, |
||
| 1052 | 'meta' => array( |
||
| 1053 | 'class' => 'inline-action mb-trackable', |
||
| 1054 | ), |
||
| 1055 | ) |
||
| 1056 | ); |
||
| 1057 | |||
| 1058 | // Comments. |
||
| 1059 | if ( current_user_can( 'moderate_comments' ) ) { |
||
| 1060 | $wp_admin_bar->add_menu( |
||
| 1061 | array( |
||
| 1062 | 'parent' => 'publish', |
||
| 1063 | 'id' => 'comments', |
||
| 1064 | 'title' => __( 'Comments', 'jetpack' ), |
||
| 1065 | 'href' => Redirect::get_url( 'calypso-comments' ), |
||
| 1066 | 'meta' => array( |
||
| 1067 | 'class' => 'mb-icon', |
||
| 1068 | ), |
||
| 1069 | ) |
||
| 1070 | ); |
||
| 1071 | } |
||
| 1072 | |||
| 1073 | // Testimonials. |
||
| 1074 | View Code Duplication | if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) { |
|
| 1075 | $testimonials_title = $this->create_menu_item_pair( |
||
| 1076 | array( |
||
| 1077 | 'url' => Redirect::get_url( 'calypso-list-jetpack-testimonial' ), |
||
| 1078 | 'id' => 'wp-admin-bar-edit-testimonial', |
||
| 1079 | 'label' => esc_html__( 'Testimonials', 'jetpack' ), |
||
| 1080 | ), |
||
| 1081 | array( |
||
| 1082 | 'url' => Redirect::get_url( 'calypso-edit-jetpack-testimonial' ), |
||
| 1083 | 'id' => 'wp-admin-bar-new-testimonial', |
||
| 1084 | 'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ), |
||
| 1085 | ) |
||
| 1086 | ); |
||
| 1087 | |||
| 1088 | if ( ! current_user_can( 'edit_pages' ) ) { |
||
| 1089 | $testimonials_title = $this->create_menu_item_anchor( |
||
| 1090 | 'ab-item ab-primary mb-icon', |
||
| 1091 | Redirect::get_url( 'calypso-list-jetpack-testimonial' ), |
||
| 1092 | esc_html__( 'Testimonials', 'jetpack' ), |
||
| 1093 | 'wp-admin-bar-edit-testimonial' |
||
| 1094 | ); |
||
| 1095 | } |
||
| 1096 | |||
| 1097 | $wp_admin_bar->add_menu( |
||
| 1098 | array( |
||
| 1099 | 'parent' => 'publish', |
||
| 1100 | 'id' => 'new-jetpack-testimonial', |
||
| 1101 | 'title' => $testimonials_title, |
||
| 1102 | 'meta' => array( |
||
| 1103 | 'class' => 'inline-action', |
||
| 1104 | ), |
||
| 1105 | ) |
||
| 1106 | ); |
||
| 1107 | } |
||
| 1108 | |||
| 1109 | // Portfolio. |
||
| 1110 | View Code Duplication | if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) { |
|
| 1111 | $portfolios_title = $this->create_menu_item_pair( |
||
| 1112 | array( |
||
| 1113 | 'url' => Redirect::get_url( 'calypso-list-jetpack-portfolio' ), |
||
| 1114 | 'id' => 'wp-admin-bar-edit-portfolio', |
||
| 1115 | 'label' => esc_html__( 'Portfolio', 'jetpack' ), |
||
| 1116 | ), |
||
| 1117 | array( |
||
| 1118 | 'url' => Redirect::get_url( 'calypso-edit-jetpack-portfolio' ), |
||
| 1119 | 'id' => 'wp-admin-bar-new-portfolio', |
||
| 1120 | 'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ), |
||
| 1121 | ) |
||
| 1122 | ); |
||
| 1123 | |||
| 1124 | if ( ! current_user_can( 'edit_pages' ) ) { |
||
| 1125 | $portfolios_title = $this->create_menu_item_anchor( |
||
| 1126 | 'ab-item ab-primary mb-icon', |
||
| 1127 | Redirect::get_url( 'calypso-list-jetpack-portfolio' ), |
||
| 1128 | esc_html__( 'Portfolio', 'jetpack' ), |
||
| 1129 | 'wp-admin-bar-edit-portfolio' |
||
| 1130 | ); |
||
| 1131 | } |
||
| 1132 | |||
| 1133 | $wp_admin_bar->add_menu( |
||
| 1134 | array( |
||
| 1135 | 'parent' => 'publish', |
||
| 1136 | 'id' => 'new-jetpack-portfolio', |
||
| 1137 | 'title' => $portfolios_title, |
||
| 1138 | 'meta' => array( |
||
| 1139 | 'class' => 'inline-action', |
||
| 1140 | ), |
||
| 1141 | ) |
||
| 1142 | ); |
||
| 1143 | } |
||
| 1144 | |||
| 1145 | if ( current_user_can( 'edit_theme_options' ) ) { |
||
| 1146 | // Look and Feel group. |
||
| 1147 | $wp_admin_bar->add_group( |
||
| 1148 | array( |
||
| 1149 | 'parent' => 'blog', |
||
| 1150 | 'id' => 'look-and-feel', |
||
| 1151 | ) |
||
| 1152 | ); |
||
| 1153 | |||
| 1154 | // Look and Feel header. |
||
| 1155 | $wp_admin_bar->add_menu( |
||
| 1156 | array( |
||
| 1157 | 'parent' => 'look-and-feel', |
||
| 1158 | 'id' => 'look-and-feel-header', |
||
| 1159 | 'title' => esc_html_x( 'Personalize', 'admin bar menu group label', 'jetpack' ), |
||
| 1160 | 'meta' => array( |
||
| 1161 | 'class' => 'ab-submenu-header', |
||
| 1162 | ), |
||
| 1163 | ) |
||
| 1164 | ); |
||
| 1165 | |||
| 1166 | if ( is_admin() ) { |
||
| 1167 | // In wp-admin the `return` query arg will return to that page after closing the Customizer. |
||
| 1168 | $customizer_url = add_query_arg( |
||
| 1169 | array( |
||
| 1170 | 'return' => rawurlencode( site_url( $_SERVER['REQUEST_URI'] ) ), |
||
| 1171 | ), |
||
| 1172 | wp_customize_url() |
||
| 1173 | ); |
||
| 1174 | } else { |
||
| 1175 | /* |
||
| 1176 | * On the frontend the `url` query arg will load that page in the Customizer |
||
| 1177 | * and also return to it after closing |
||
| 1178 | * non-home URLs won't work unless we undo domain mapping |
||
| 1179 | * since the Customizer preview is unmapped to always have HTTPS. |
||
| 1180 | */ |
||
| 1181 | $current_page = '//' . $this->primary_site_slug . $_SERVER['REQUEST_URI']; |
||
| 1182 | $customizer_url = add_query_arg( array( 'url' => rawurlencode( $current_page ) ), wp_customize_url() ); |
||
| 1183 | } |
||
| 1184 | |||
| 1185 | $theme_title = $this->create_menu_item_pair( |
||
| 1186 | array( |
||
| 1187 | 'url' => $customizer_url, |
||
| 1188 | 'id' => 'wp-admin-bar-cmz', |
||
| 1189 | 'label' => esc_html_x( 'Customize', 'admin bar customize item label', 'jetpack' ), |
||
| 1190 | ), |
||
| 1191 | array( |
||
| 1192 | 'url' => Redirect::get_url( 'calypso-themes' ), |
||
| 1193 | 'id' => 'wp-admin-bar-themes', |
||
| 1194 | 'label' => esc_html__( 'Themes', 'jetpack' ), |
||
| 1195 | ) |
||
| 1196 | ); |
||
| 1197 | $meta = array( |
||
| 1198 | 'class' => 'mb-icon', |
||
| 1199 | 'class' => 'inline-action', |
||
| 1200 | ); |
||
| 1201 | $href = false; |
||
| 1202 | |||
| 1203 | $wp_admin_bar->add_menu( |
||
| 1204 | array( |
||
| 1205 | 'parent' => 'look-and-feel', |
||
| 1206 | 'id' => 'themes', |
||
| 1207 | 'title' => $theme_title, |
||
| 1208 | 'href' => $href, |
||
| 1209 | 'meta' => $meta, |
||
| 1210 | ) |
||
| 1211 | ); |
||
| 1212 | } |
||
| 1213 | |||
| 1214 | if ( current_user_can( 'manage_options' ) ) { |
||
| 1215 | // Configuration group. |
||
| 1216 | $wp_admin_bar->add_group( |
||
| 1217 | array( |
||
| 1218 | 'parent' => 'blog', |
||
| 1219 | 'id' => 'configuration', |
||
| 1220 | ) |
||
| 1221 | ); |
||
| 1222 | |||
| 1223 | // Configuration header. |
||
| 1224 | $wp_admin_bar->add_menu( |
||
| 1225 | array( |
||
| 1226 | 'parent' => 'configuration', |
||
| 1227 | 'id' => 'configuration-header', |
||
| 1228 | 'title' => esc_html_x( 'Configure', 'admin bar menu group label', 'jetpack' ), |
||
| 1229 | 'meta' => array( |
||
| 1230 | 'class' => 'ab-submenu-header', |
||
| 1231 | ), |
||
| 1232 | ) |
||
| 1233 | ); |
||
| 1234 | |||
| 1235 | View Code Duplication | if ( Jetpack::is_module_active( 'publicize' ) || Jetpack::is_module_active( 'sharedaddy' ) ) { |
|
| 1236 | $wp_admin_bar->add_menu( |
||
| 1237 | array( |
||
| 1238 | 'parent' => 'configuration', |
||
| 1239 | 'id' => 'sharing', |
||
| 1240 | 'title' => esc_html__( 'Sharing', 'jetpack' ), |
||
| 1241 | 'href' => Redirect::get_url( 'calypso-sharing' ), |
||
| 1242 | 'meta' => array( |
||
| 1243 | 'class' => 'mb-icon', |
||
| 1244 | ), |
||
| 1245 | ) |
||
| 1246 | ); |
||
| 1247 | } |
||
| 1248 | |||
| 1249 | $people_title = $this->create_menu_item_pair( |
||
| 1250 | array( |
||
| 1251 | 'url' => Redirect::get_url( 'calypso-people-team' ), |
||
| 1252 | 'id' => 'wp-admin-bar-people', |
||
| 1253 | 'label' => esc_html__( 'People', 'jetpack' ), |
||
| 1254 | ), |
||
| 1255 | array( |
||
| 1256 | 'url' => admin_url( 'user-new.php' ), |
||
| 1257 | 'id' => 'wp-admin-bar-people-add', |
||
| 1258 | 'label' => esc_html_x( 'Add', 'admin bar people item label', 'jetpack' ), |
||
| 1259 | ) |
||
| 1260 | ); |
||
| 1261 | |||
| 1262 | $wp_admin_bar->add_menu( |
||
| 1263 | array( |
||
| 1264 | 'parent' => 'configuration', |
||
| 1265 | 'id' => 'users-toolbar', |
||
| 1266 | 'title' => $people_title, |
||
| 1267 | 'href' => false, |
||
| 1268 | 'meta' => array( |
||
| 1269 | 'class' => 'inline-action', |
||
| 1270 | ), |
||
| 1271 | ) |
||
| 1272 | ); |
||
| 1273 | |||
| 1274 | $plugins_title = $this->create_menu_item_pair( |
||
| 1275 | array( |
||
| 1276 | 'url' => Redirect::get_url( 'calypso-plugins' ), |
||
| 1277 | 'id' => 'wp-admin-bar-plugins', |
||
| 1278 | 'label' => esc_html__( 'Plugins', 'jetpack' ), |
||
| 1279 | ), |
||
| 1280 | array( |
||
| 1281 | 'url' => Redirect::get_url( 'calypso-plugins-manage' ), |
||
| 1282 | 'id' => 'wp-admin-bar-plugins-add', |
||
| 1283 | 'label' => esc_html_x( 'Manage', 'Label for the button on the Masterbar to manage plugins', 'jetpack' ), |
||
| 1284 | ) |
||
| 1285 | ); |
||
| 1286 | |||
| 1287 | $wp_admin_bar->add_menu( |
||
| 1288 | array( |
||
| 1289 | 'parent' => 'configuration', |
||
| 1290 | 'id' => 'plugins', |
||
| 1291 | 'title' => $plugins_title, |
||
| 1292 | 'href' => false, |
||
| 1293 | 'meta' => array( |
||
| 1294 | 'class' => 'inline-action', |
||
| 1295 | ), |
||
| 1296 | ) |
||
| 1297 | ); |
||
| 1298 | |||
| 1299 | if ( jetpack_is_atomic_site() ) { |
||
| 1300 | $domain_title = $this->create_menu_item_pair( |
||
| 1301 | array( |
||
| 1302 | 'url' => Redirect::get_url( 'calypso-domains' ), |
||
| 1303 | 'id' => 'wp-admin-bar-domains', |
||
| 1304 | 'label' => esc_html__( 'Domains', 'jetpack' ), |
||
| 1305 | ), |
||
| 1306 | array( |
||
| 1307 | 'url' => Redirect::get_url( 'calypso-domains-add' ), |
||
| 1308 | 'id' => 'wp-admin-bar-domains-add', |
||
| 1309 | 'label' => esc_html_x( 'Add', 'Label for the button on the Masterbar to add a new domain', 'jetpack' ), |
||
| 1310 | ) |
||
| 1311 | ); |
||
| 1312 | $wp_admin_bar->add_menu( |
||
| 1313 | array( |
||
| 1314 | 'parent' => 'configuration', |
||
| 1315 | 'id' => 'domains', |
||
| 1316 | 'title' => $domain_title, |
||
| 1317 | 'href' => false, |
||
| 1318 | 'meta' => array( |
||
| 1319 | 'class' => 'inline-action', |
||
| 1320 | ), |
||
| 1321 | ) |
||
| 1322 | ); |
||
| 1323 | } |
||
| 1324 | |||
| 1325 | $wp_admin_bar->add_menu( |
||
| 1326 | array( |
||
| 1327 | 'parent' => 'configuration', |
||
| 1328 | 'id' => 'blog-settings', |
||
| 1329 | 'title' => esc_html__( 'Settings', 'jetpack' ), |
||
| 1330 | 'href' => Redirect::get_url( 'calypso-settings-general' ), |
||
| 1331 | 'meta' => array( |
||
| 1332 | 'class' => 'mb-icon', |
||
| 1333 | ), |
||
| 1334 | ) |
||
| 1335 | ); |
||
| 1336 | |||
| 1337 | if ( ! is_admin() ) { |
||
| 1338 | $wp_admin_bar->add_menu( |
||
| 1339 | array( |
||
| 1340 | 'parent' => 'configuration', |
||
| 1341 | 'id' => 'legacy-dashboard', |
||
| 1342 | 'title' => esc_html__( 'Dashboard', 'jetpack' ), |
||
| 1343 | 'href' => admin_url(), |
||
| 1344 | 'meta' => array( |
||
| 1345 | 'class' => 'mb-icon', |
||
| 1346 | ), |
||
| 1347 | ) |
||
| 1348 | ); |
||
| 1349 | } |
||
| 1350 | |||
| 1351 | // Restore dashboard menu toggle that is needed on mobile views. |
||
| 1352 | if ( is_admin() ) { |
||
| 1353 | $wp_admin_bar->add_menu( |
||
| 1354 | array( |
||
| 1355 | 'id' => 'menu-toggle', |
||
| 1356 | 'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . esc_html__( 'Menu', 'jetpack' ) . '</span>', |
||
| 1357 | 'href' => '#', |
||
| 1358 | ) |
||
| 1359 | ); |
||
| 1360 | } |
||
| 1361 | |||
| 1362 | /** |
||
| 1363 | * Fires when menu items are added to the masterbar "My Sites" menu. |
||
| 1364 | * |
||
| 1365 | * @since 5.4.0 |
||
| 1366 | */ |
||
| 1367 | do_action( 'jetpack_masterbar' ); |
||
| 1368 | } |
||
| 1369 | } |
||
| 1370 | |||
| 1395 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..