Skip to content

Commit

Permalink
My Jetpack: Only add the My Jetpack menu item and page if we are in t…
Browse files Browse the repository at this point in the history
…he WordPress admin side (#39334)

* Only add the My Jetpack menu item and page if we are in the WordPress admin side

This avoids reading a language option in the frontend

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10801547756

Upstream-Ref: Automattic/jetpack@b52119c
  • Loading branch information
oskosk authored and matticbot committed Sep 10, 2024
1 parent c9bce02 commit 0bb3963
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,8 @@ public static function init() {
// Add custom WP REST API endoints.
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_endpoints' ) );

$page_suffix = Admin_Menu::add_menu(
__( 'My Jetpack', 'jetpack-my-jetpack' ),
__( 'My Jetpack', 'jetpack-my-jetpack' ),
'edit_posts',
'my-jetpack',
array( __CLASS__, 'admin_page' ),
-1
);
add_action( 'admin_menu', array( __CLASS__, 'add_my_jetpack_menu_item' ) );

add_action( 'load-' . $page_suffix, array( __CLASS__, 'admin_init' ) );
add_action( 'admin_init', array( __CLASS__, 'setup_historically_active_jetpack_modules_sync' ) );
// This is later than the admin-ui package, which runs on 1000
add_action( 'admin_init', array( __CLASS__, 'maybe_show_red_bubble' ), 1001 );
Expand Down Expand Up @@ -166,6 +158,23 @@ public static function is_licensing_ui_enabled() {
);
}

/**
* Add My Jetpack menu item to the admin menu.
*
* @return void
*/
public static function add_my_jetpack_menu_item() {
$page_suffix = Admin_Menu::add_menu(
__( 'My Jetpack', 'jetpack-my-jetpack' ),
__( 'My Jetpack', 'jetpack-my-jetpack' ),
'edit_posts',
'my-jetpack',
array( __CLASS__, 'admin_page' ),
-1
);
add_action( 'load-' . $page_suffix, array( __CLASS__, 'admin_init' ) );
}

/**
* Callback for the load my jetpack page hook.
*
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
),
'jetpack-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
'ver' => '4.35.6-alpha1725997601',
'ver' => '4.35.6-alpha1726007201',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down
60 changes: 30 additions & 30 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "c62a8c5854dbbc187a9f0307e2c2e802fe55793e"
"reference": "7afe587aeb0f7884f6d660fb73e92b7b8390f20c"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -60,7 +60,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "90e3ed488db82bd6c698484ccd339453d092ec5b"
"reference": "7f0a439bfac8258a0389f70bb3c7e727db51f6fe"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -125,7 +125,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "48c3bdfb54d50dd28205154d7f5d14263f9304b0"
"reference": "14120b7b56402f215358bef65f58d32c5c648769"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -194,7 +194,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "5e3e8323ed195dee60e68cc5bc550f00c8505ddc"
"reference": "1f0fe7c5b96c076a3eea6231c92d3769a4a48755"
},
"require": {
"composer-plugin-api": "^1.1 || ^2.0",
Expand Down Expand Up @@ -261,7 +261,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "142b692fb2f4ca40b4a3236fabdede7f58db200f"
"reference": "3bda081fa62c0d921496b316e0b3ba08ab7ae76b"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -329,7 +329,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "4ab0d36614c4b0f7f6316c3f65e2d99c50fa3990"
"reference": "a47ec89be1531fb94f568ba5ff2f0148985a12da"
},
"require": {
"automattic/jetpack-boost-core": "^0.2.11",
Expand Down Expand Up @@ -405,7 +405,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "940947bc6a76d7a46f484f78f3392457d20b8f8e"
"reference": "6004996d6681601bcaca47d2d91ae4c80f0154f0"
},
"require": {
"composer-plugin-api": "^2.1.0",
Expand Down Expand Up @@ -465,7 +465,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "f5710fe11c57e4c2c26ff778ffd5661933e7cb11"
"reference": "90e7918ae427b5045c52c4f0fee61b8d98394a4d"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -540,7 +540,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "e2c053c5182256314033be8963255d30471db71b"
"reference": "07c4acdf0d46d08dbf4520f33a21dc5fac7832bf"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -630,7 +630,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "e9d1e163bcc5da7618eaa13ac4ad444d35519198"
"reference": "651fae2e092406330cfd1fe480c75a75ec23a59f"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -684,7 +684,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "052d3a613da1889cd3b0e1c17a9ccbb18057aadc"
"reference": "3861fb9e84c1fa46aa3b94bd7e683db91c857a75"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -737,7 +737,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "67162a23f36fc24b86590e4444edf1a058c030db"
"reference": "5e64b7cfdf9bfd111b93f8ded1c42e875860abef"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -812,7 +812,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "e6435e0807e547656333b551f51a1d2ecdf07aef"
"reference": "50f3f305988ff607fccc1ec4fe7175b2d2228944"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -870,7 +870,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "327ac3532d05fb9f7b41d918c3d013309b85bc1f"
"reference": "57f1c80e1ead02a0d5a68c37875c314c64ae6975"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -945,7 +945,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "4cffa9e62c651ca650c81702045f2ce7560e453c"
"reference": "bcce11d26cc077e1a262a39a30a02d703e90ec6a"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "f9d7693c492850a94be08c70e10da899c5834171"
"reference": "09e16eed29ea9e07b458bc36300250381a1950b0"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1055,12 +1055,12 @@
},
{
"name": "automattic/jetpack-my-jetpack",
"version": "4.35.6-alpha.1725997601",
"version_normalized": "4.35.6.0-alpha1725997601",
"version": "4.35.6-alpha.1726007201",
"version_normalized": "4.35.6.0-alpha1726007201",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "f82cbc4dcc441a310a122d77bdede6e9efb74067"
"reference": "587085a8c19bcfd9c2ac14f3343433cf0fbf3a8f"
},
"require": {
"automattic/jetpack-admin-ui": "^0.4.5",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "93c340c42a9bcf07d288d8d47e4502b7e459845b"
"reference": "a9ed1db1e47942d6c379a309f2355df07fb2f457"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1223,7 +1223,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "7c64578aaa8dbab7d5daa1b1149a2a57b9b67974"
"reference": "ff32c9367e1f99da938f3e0062c629c8d61a744e"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -1291,7 +1291,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "2104ff8d1ebfa41d15a2a8f8c4fa13684d9b5323"
"reference": "aa6018cc21e430f4e5df2b6f89a308ad1da283e2"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -1347,7 +1347,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "18fd755cd4b23ccb1892947173cf8b8c86fe7eb4"
"reference": "54a134ab2af4e620660dbcea1f8d600b93e0d8a3"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1417,7 +1417,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "f5f20084866d75d0acb2c37ec4656d3d1bee9e7b"
"reference": "e858617ac60d53c49a1b932c96f643fc1e6f1d6a"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -1492,7 +1492,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "d9f3e0de66d967ba54c15fe08c00f22ff5960231"
"reference": "b6aeeb8da43f2e2d48611a1123ddd575a65f2942"
},
"require": {
"automattic/jetpack-status": "^4.0.1",
Expand Down Expand Up @@ -1547,7 +1547,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "e5565fcbef2386019e7f4d7e619d6cab1ac8cdbb"
"reference": "4037f649d2543dc52dd48bf5a3c083d6cc80a12e"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1601,7 +1601,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-search",
"reference": "fd69c2744a42ecb21b1e93534ec24735dade53fc"
"reference": "a68a65c7bc4dac803c17673c91f18c886f557b69"
},
"require": {
"automattic/jetpack-assets": "^2.3.8",
Expand Down Expand Up @@ -1689,7 +1689,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "b7c1c2b4efa3b2ce85e788060b2bb6a6a2c9245b"
"reference": "9ffe3e51659e3fad45c06843ed9d999b65173106"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down Expand Up @@ -1756,7 +1756,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "d962fd7d64a24203da61bfb6ea716fef11195d2f"
"reference": "dce7c430e25c2acaac978162b6d431c59f56358f"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -1820,7 +1820,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "9279224e6aa3ec07b9f338f40dc31326027b616a"
"reference": "a9c6c2e93f9ac150df87fe833bccefed25fff921"
},
"require": {
"automattic/jetpack-connection": "^4.0.2",
Expand Down
Loading

0 comments on commit 0bb3963

Please sign in to comment.