admin-menu-nav-unification-rtl.css
2 years ago
admin-menu-nav-unification-rtl.min.css
2 years ago
admin-menu-nav-unification.css
2 years ago
admin-menu-nav-unification.min.css
2 years ago
admin-menu-rtl.css
2 years ago
admin-menu-rtl.min.css
2 years ago
admin-menu.css
2 years ago
admin-menu.js
2 years ago
admin-menu.min.css
2 years ago
class-admin-menu.php
2 years ago
class-atomic-admin-menu.php
2 years ago
class-dashboard-switcher-tracking.php
2 years ago
class-domain-only-admin-menu.php
2 years ago
class-jetpack-admin-menu.php
2 years ago
class-p2-admin-menu.php
2 years ago
class-wpcom-admin-menu.php
2 years ago
class-wpcom-email-subscription-checker.php
2 years ago
dashicon-set.php
2 years ago
globe-icon.svg
3 years ago
load.php
2 years ago
menu-mappings.php
2 years ago
class-dashboard-switcher-tracking.php
117 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quick switcher tracking file. |
| 4 | * |
| 5 | * @deprecated 13.7 Use Automattic\Jetpack\Masterbar\Dashboard_Switcher_Tracking instead. |
| 6 | * |
| 7 | * @package automattic/jetpack |
| 8 | */ |
| 9 | |
| 10 | namespace Automattic\Jetpack\Dashboard_Customizations; |
| 11 | |
| 12 | use Automattic\Jetpack\Masterbar\Dashboard_Switcher_Tracking as Masterbar_Dashboard_Switcher_Tracking; |
| 13 | use Automattic\Jetpack\Tracking; |
| 14 | |
| 15 | /** |
| 16 | * Class Dashboard_Switcher_Tracking |
| 17 | */ |
| 18 | class Dashboard_Switcher_Tracking { |
| 19 | |
| 20 | /** |
| 21 | * Jetpack Tracking library will prefix the event name with "jetpack_*" automatically. |
| 22 | */ |
| 23 | const JETPACK_EVENT_NAME = 'dashboard_quick_switch_link_clicked'; |
| 24 | |
| 25 | const WPCOM_EVENT_NAME = 'wpcom_dashboard_quick_switch_link_clicked'; |
| 26 | |
| 27 | /** |
| 28 | * Instance of \Automattic\Jetpack\Masterbar\Dashboard_Switcher_Tracking |
| 29 | * Used for deprecation purposes. |
| 30 | * |
| 31 | * @var \Automattic\Jetpack\Masterbar\Dashboard_Switcher_Tracking |
| 32 | */ |
| 33 | private $dashboard_switcher_wrapper; |
| 34 | |
| 35 | /** |
| 36 | * Dashboard_Switcher_Tracking constructor. |
| 37 | * |
| 38 | * @deprecated 13.7 |
| 39 | * |
| 40 | * @param Tracking $tracking Jetpack tracking object. |
| 41 | * @param callable $wpcom_tracking A wrapper over wpcom event record. |
| 42 | * @param string $plan The current site plan. |
| 43 | */ |
| 44 | public function __construct( Tracking $tracking, callable $wpcom_tracking, $plan ) { |
| 45 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::__construct' ); |
| 46 | $this->dashboard_switcher_wrapper = new Masterbar_Dashboard_Switcher_Tracking( $tracking, $wpcom_tracking, $plan ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Create an event for the Quick switcher when the user changes it's preferred view. |
| 51 | * |
| 52 | * @deprecated 13.7 |
| 53 | * |
| 54 | * @param string $screen The screen page. |
| 55 | * @param string $view The new preferred view. |
| 56 | */ |
| 57 | public function record_switch_event( $screen, $view ) { |
| 58 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::record_switch_event' ); |
| 59 | $this->dashboard_switcher_wrapper->record_switch_event( $screen, $view ); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Get the current site plan or 'N/A' when we cannot determine site's plan. |
| 64 | * |
| 65 | * @deprecated 13.7 |
| 66 | * |
| 67 | * @todo: This method can be reused as a wrapper over WPCOM and Atomic as way to get site's current plan (display name). |
| 68 | * |
| 69 | * @return string |
| 70 | */ |
| 71 | public static function get_plan() { |
| 72 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::get_plan' ); |
| 73 | return Masterbar_Dashboard_Switcher_Tracking::get_plan(); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Trigger the WPCOM tracks_record_event. |
| 78 | * |
| 79 | * @deprecated 13.7 |
| 80 | * |
| 81 | * @param array $event_props Event props. |
| 82 | */ |
| 83 | public static function wpcom_tracks_record_event( $event_props ) { |
| 84 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::wpcom_tracks_record_event' ); |
| 85 | return Masterbar_Dashboard_Switcher_Tracking::wpcom_tracks_record_event( $event_props ); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Get the tracking product name for the Tracking library. |
| 90 | * |
| 91 | * The tracking product name is used by the Tracking as a prefix for the event name. |
| 92 | * |
| 93 | * @deprecated 13.7 |
| 94 | * |
| 95 | * @return string |
| 96 | */ |
| 97 | public static function get_jetpack_tracking_product() { |
| 98 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::get_jetpack_tracking_product' ); |
| 99 | return Masterbar_Dashboard_Switcher_Tracking::get_jetpack_tracking_product(); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Mark the Jetpack ToS as read for Atomic Sites. |
| 104 | * |
| 105 | * @deprecated 13.7 |
| 106 | * |
| 107 | * @param mixed $option_value The value of the Jetpack option. |
| 108 | * @param string $option_name The name of the Jetpack option. |
| 109 | * |
| 110 | * @return bool |
| 111 | */ |
| 112 | public static function mark_jetpack_tos_as_read( $option_value, $option_name ) { |
| 113 | _deprecated_function( __METHOD__, 'jetpack-13.7', 'Automattic\\Jetpack\\Masterbar\\Dashboard_Switcher_Tracking::mark_jetpack_tos_as_read' ); |
| 114 | return Masterbar_Dashboard_Switcher_Tracking::mark_jetpack_tos_as_read( $option_value, $option_name ); |
| 115 | } |
| 116 | } |
| 117 |