Geen omschrijving

class-wc-admin-setup-wizard-tracking.php 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?php
  2. /**
  3. * WooCommerce Admin Setup Wizard Tracking
  4. *
  5. * @package WooCommerce\Tracks
  6. *
  7. * @deprecated 4.6.0
  8. */
  9. defined( 'ABSPATH' ) || exit;
  10. /**
  11. * This class adds actions to track usage of the WooCommerce Onboarding Wizard.
  12. */
  13. class WC_Admin_Setup_Wizard_Tracking {
  14. /**
  15. * Steps for the setup wizard
  16. *
  17. * @var array
  18. */
  19. private $steps = array();
  20. /**
  21. * Init tracking.
  22. *
  23. * @deprecated 4.6.0
  24. */
  25. public function init() {
  26. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  27. }
  28. /**
  29. * Get the name of the current step.
  30. *
  31. * @deprecated 4.6.0
  32. * @return string
  33. */
  34. public function get_current_step() {
  35. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  36. return isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
  37. }
  38. /**
  39. * Add footer scripts to OBW via woocommerce_setup_footer
  40. *
  41. * @deprecated 4.6.0
  42. */
  43. public function add_footer_scripts() {
  44. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  45. }
  46. /**
  47. * Dequeue unwanted scripts from OBW footer.
  48. *
  49. * @deprecated 4.6.0
  50. */
  51. public function dequeue_non_allowed_scripts() {
  52. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  53. global $wp_scripts;
  54. $allowed = array( 'woo-tracks' );
  55. foreach ( $wp_scripts->queue as $script ) {
  56. if ( in_array( $script, $allowed, true ) ) {
  57. continue;
  58. }
  59. wp_dequeue_script( $script );
  60. }
  61. }
  62. /**
  63. * Track when tracking is opted into and OBW has started.
  64. *
  65. * @param string $option Option name.
  66. * @param string $value Option value.
  67. *
  68. * @deprecated 4.6.0
  69. */
  70. public function track_start( $option, $value ) {
  71. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  72. }
  73. /**
  74. * Track the marketing form on submit.
  75. *
  76. * @deprecated 4.6.0
  77. */
  78. public function track_ready_next_steps() {
  79. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  80. }
  81. /**
  82. * Track various events when a step is saved.
  83. *
  84. * @deprecated 4.6.0
  85. */
  86. public function add_step_save_events() {
  87. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  88. }
  89. /**
  90. * Track store setup and store properties on save.
  91. *
  92. * @deprecated 4.6.0
  93. */
  94. public function track_store_setup() {
  95. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  96. }
  97. /**
  98. * Track payment gateways selected.
  99. *
  100. * @deprecated 4.6.0
  101. */
  102. public function track_payments() {
  103. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  104. }
  105. /**
  106. * Track shipping units and whether or not labels are set.
  107. *
  108. * @deprecated 4.6.0
  109. */
  110. public function track_shipping() {
  111. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  112. }
  113. /**
  114. * Track recommended plugins selected for install.
  115. *
  116. * @deprecated 4.6.0
  117. */
  118. public function track_recommended() {
  119. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  120. }
  121. /**
  122. * Tracks when Jetpack is activated through the OBW.
  123. *
  124. * @deprecated 4.6.0
  125. */
  126. public function track_jetpack_activate() {
  127. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  128. }
  129. /**
  130. * Tracks when last next_steps screen is viewed in the OBW.
  131. *
  132. * @deprecated 4.6.0
  133. */
  134. public function track_next_steps() {
  135. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  136. }
  137. /**
  138. * Track skipped steps.
  139. *
  140. * @deprecated 4.6.0
  141. */
  142. public function track_skip_step() {
  143. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  144. }
  145. /**
  146. * Set the OBW steps inside this class instance.
  147. *
  148. * @param array $steps Array of OBW steps.
  149. *
  150. * @deprecated 4.6.0
  151. */
  152. public function set_obw_steps( $steps ) {
  153. _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
  154. $this->steps = $steps;
  155. return $steps;
  156. }
  157. }