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