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