class-wc-admin-help.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * Add some content to the help tab
  4. *
  5. * @package WooCommerce/Admin
  6. * @version 2.1.0
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. if ( class_exists( 'WC_Admin_Help', false ) ) {
  12. return new WC_Admin_Help();
  13. }
  14. /**
  15. * WC_Admin_Help Class.
  16. */
  17. class WC_Admin_Help {
  18. /**
  19. * Hook in tabs.
  20. */
  21. public function __construct() {
  22. add_action( 'current_screen', array( $this, 'add_tabs' ), 50 );
  23. }
  24. /**
  25. * Add help tabs.
  26. */
  27. public function add_tabs() {
  28. $screen = get_current_screen();
  29. if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids() ) ) {
  30. return;
  31. }
  32. $screen->add_help_tab(
  33. array(
  34. 'id' => 'woocommerce_support_tab',
  35. 'title' => __( 'Help &amp; Support', 'woocommerce' ),
  36. 'content' =>
  37. '<h2>' . __( 'Help &amp; Support', 'woocommerce' ) . '</h2>' .
  38. '<p>' . sprintf(
  39. /* translators: %s: Documentation URL */
  40. __( 'Should you need help understanding, using, or extending WooCommerce, <a href="%s">please read our documentation</a>. You will find all kinds of resources including snippets, tutorials and much more.', 'woocommerce' ),
  41. 'https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
  42. ) . '</p>' .
  43. '<p>' . sprintf(
  44. /* translators: %s: Forum URL */
  45. __( 'For further assistance with WooCommerce core you can use the <a href="%1$s">community forum</a>. If you need help with premium extensions sold by WooCommerce, please <a href="%2$s">use our helpdesk</a>.', 'woocommerce' ),
  46. 'https://wordpress.org/support/plugin/woocommerce',
  47. 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
  48. ) . '</p>' .
  49. '<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
  50. '<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System status', 'woocommerce' ) . '</a> <a href="https://wordpress.org/support/plugin/woocommerce" class="button">' . __( 'Community forum', 'woocommerce' ) . '</a> <a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin" class="button">' . __( 'WooCommerce helpdesk', 'woocommerce' ) . '</a></p>',
  51. )
  52. );
  53. $screen->add_help_tab(
  54. array(
  55. 'id' => 'woocommerce_bugs_tab',
  56. 'title' => __( 'Found a bug?', 'woocommerce' ),
  57. 'content' =>
  58. '<h2>' . __( 'Found a bug?', 'woocommerce' ) . '</h2>' .
  59. /* translators: 1: GitHub issues URL 2: GitHub contribution guide URL 3: System status report URL */
  60. '<p>' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via <a href="%1$s">Github issues</a>. Ensure you read the <a href="%2$s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%3$s">system status report</a>.', 'woocommerce' ), 'https://github.com/woocommerce/woocommerce/issues?state=open', 'https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '</p>' .
  61. '<p><a href="https://github.com/woocommerce/woocommerce/issues?state=open" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System status', 'woocommerce' ) . '</a></p>',
  62. )
  63. );
  64. $screen->add_help_tab(
  65. array(
  66. 'id' => 'woocommerce_education_tab',
  67. 'title' => __( 'Education', 'woocommerce' ),
  68. 'content' =>
  69. '<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' .
  70. '<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider a WooCommerce course to further your education.', 'woocommerce' ) . '</p>' .
  71. '<p><a href="https://docs.woocommerce.com/document/further-education/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin" class="button button-primary">' . __( 'Further education', 'woocommerce' ) . '</a></p>',
  72. )
  73. );
  74. $screen->add_help_tab(
  75. array(
  76. 'id' => 'woocommerce_onboard_tab',
  77. 'title' => __( 'Setup wizard', 'woocommerce' ),
  78. 'content' =>
  79. '<h2>' . __( 'Setup wizard', 'woocommerce' ) . '</h2>' .
  80. '<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
  81. '<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'woocommerce' ) . '</a></p>',
  82. )
  83. );
  84. $screen->set_help_sidebar(
  85. '<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
  86. '<p><a href="https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' .
  87. '<p><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
  88. '<p><a href="https://github.com/woocommerce/woocommerce/" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' .
  89. '<p><a href="https://woocommerce.com/storefront/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official theme', 'woocommerce' ) . '</a></p>' .
  90. '<p><a href="https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin" target="_blank">' . __( 'Official extensions', 'woocommerce' ) . '</a></p>'
  91. );
  92. }
  93. }
  94. return new WC_Admin_Help();