Skip to content

Commit

Permalink
Load Odyssey Stats for simple sites (#36628)
Browse files Browse the repository at this point in the history
* Load Odyssey Stats for simple sites

* Changelog

* Fix file name to wpcom-simple-odyssey-stats.php

* Make Phan happy

* Run tools/fixup-project-versions.sh to make linter happy

* Add wpcom_is_nav_redesign_enabled check

---------

Co-authored-by: DustyReagan <dusty@dustyreagan.com>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8506186690
  • Loading branch information
candy02058912 authored and matticbot committed Apr 1, 2024
1 parent 699ae65 commit b8ec2c0
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 19 deletions.
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is an alpha version! The changes listed here are not final.

### Added
- Add Odyssey Stats to wpcom Simple Site
- Change Phan baselines.

### Changed
Expand Down
10 changes: 10 additions & 0 deletions vendor/automattic/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static function init() {
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
add_action( 'plugins_loaded', array( __CLASS__, 'load_verbum_comments' ) );
add_action( 'wp_loaded', array( __CLASS__, 'load_verbum_comments_admin' ) );
add_action( 'plugins_loaded', array( __CLASS__, 'load_wpcom_simple_odyssey_stats' ) );
}

// Unified navigation fix for changes in WordPress 6.2.
Expand Down Expand Up @@ -278,4 +279,13 @@ public static function load_verbum_comments_admin() {
public static function load_wpcom_command_palette() {
require_once __DIR__ . '/features/wpcom-command-palette/wpcom-command-palette.php';
}

/**
* Load Odyssey Stats in Simple sites.
*/
public static function load_wpcom_simple_odyssey_stats() {
if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) {
require_once __DIR__ . '/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php';
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Load the Odyssey stats feature on WordPress.com Simple Site.
* See https://github.com/Automattic/jetpack/tree/trunk/projects/packages/stats-admin
*
* @package automattic/jetpack-mu-wpcom
*/

use Automattic\Jetpack\Stats_Admin\Dashboard as OdysseyStats;
OdysseyStats::init();

/**
* Load the Odyssey stats widget in the Dashboard.
*/
if ( defined( 'JETPACK_PLUGIN_LOADER_PATH' ) ) {
require_once JETPACK_PLUGIN_LOADER_PATH . '/class-jetpack-stats-dashboard-widget.php';
add_action( 'wp_dashboard_setup', array( new Jetpack_Stats_Dashboard_Widget(), 'init' ) );
}
12 changes: 6 additions & 6 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-assets",
"reference": "f30fd8d336c59c6f63ee657e042070fd61687891"
"reference": "2c806a88478d4cb9b237ec50ab95d114a9e13293"
},
"require": {
"automattic/jetpack-constants": "^2.0.1",
Expand Down Expand Up @@ -76,7 +76,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "d9c974b6bc710a3aebd0eb5acda8d539f301be3b"
"reference": "d552628993f2173309253bff3ee5f3bf588674a8"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -125,12 +125,12 @@
},
{
"name": "automattic/jetpack-mu-wpcom",
"version": "5.22.0-alpha.1711728682",
"version_normalized": "5.22.0.0-alpha1711728682",
"version": "5.22.0-alpha.1711962375",
"version_normalized": "5.22.0.0-alpha1711962375",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-mu-wpcom",
"reference": "8bc8fec935547e50b7a964ba0c1b1d4ff55fa6f9"
"reference": "0fea8a20cde34ca0159c411935aab909b628c432"
},
"require": {
"automattic/jetpack-assets": "^2.1.6",
Expand Down Expand Up @@ -202,7 +202,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/scheduled-updates",
"reference": "c19a7cf28c958ec863a31fb07a659f3d3cf9e25d"
"reference": "ee751b49cad9a03b83c5e9c7efc432ef0c341bec"
},
"require": {
"php": ">=7.0"
Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'automattic/jetpack-assets' => array(
'pretty_version' => '2.1.6',
'version' => '2.1.6.0',
'reference' => 'f30fd8d336c59c6f63ee657e042070fd61687891',
'reference' => '2c806a88478d4cb9b237ec50ab95d114a9e13293',
'type' => 'jetpack-library',
'install_path' => __DIR__ . '/../automattic/jetpack-assets',
'aliases' => array(),
Expand All @@ -22,16 +22,16 @@
'automattic/jetpack-constants' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'reference' => 'd9c974b6bc710a3aebd0eb5acda8d539f301be3b',
'reference' => 'd552628993f2173309253bff3ee5f3bf588674a8',
'type' => 'jetpack-library',
'install_path' => __DIR__ . '/../automattic/jetpack-constants',
'aliases' => array(),
'dev_requirement' => false,
),
'automattic/jetpack-mu-wpcom' => array(
'pretty_version' => '5.22.0-alpha.1711728682',
'version' => '5.22.0.0-alpha1711728682',
'reference' => '8bc8fec935547e50b7a964ba0c1b1d4ff55fa6f9',
'pretty_version' => '5.22.0-alpha.1711962375',
'version' => '5.22.0.0-alpha1711962375',
'reference' => '0fea8a20cde34ca0159c411935aab909b628c432',
'type' => 'jetpack-library',
'install_path' => __DIR__ . '/../automattic/jetpack-mu-wpcom',
'aliases' => array(),
Expand All @@ -49,7 +49,7 @@
'automattic/scheduled-updates' => array(
'pretty_version' => '0.5.3-alpha.1711633255',
'version' => '0.5.3.0-alpha1711633255',
'reference' => 'c19a7cf28c958ec863a31fb07a659f3d3cf9e25d',
'reference' => 'ee751b49cad9a03b83c5e9c7efc432ef0c341bec',
'type' => 'jetpack-library',
'install_path' => __DIR__ . '/../automattic/scheduled-updates',
'aliases' => array(),
Expand Down

0 comments on commit b8ec2c0

Please sign in to comment.