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