WC_Admin_Help

WC_Admin_Help Class.

Defined (1)

The class is defined in the following location(s).

/includes/admin/class-wc-admin-help.php  
  1. class WC_Admin_Help { 
  2.  
  3. /** 
  4. * Hook in tabs. 
  5. */ 
  6. public function __construct() { 
  7. add_action( 'current_screen', array( $this, 'add_tabs' ), 50 ); 
  8.  
  9. /** 
  10. * Add Contextual help tabs. 
  11. */ 
  12. public function add_tabs() { 
  13. $screen = get_current_screen(); 
  14.  
  15. if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids() ) ) { 
  16. return; 
  17.  
  18. $video_map = array( 
  19. 'wc-settings' => array( 
  20. 'title' => __( 'General Settings', 'woocommerce' ),  
  21. 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6.jsonp?',  
  22. ),  
  23. 'wc-settings-general' => array( 
  24. 'title' => __( 'General Settings', 'woocommerce' ),  
  25. 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6.jsonp?',  
  26. ),  
  27. 'wc-settings-products' => array( 
  28. 'title' => __( 'Product Settings', 'woocommerce' ),  
  29. 'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?',  
  30. ),  
  31. 'wc-settings-tax' => array( 
  32. 'title' => __( 'Tax Settings', 'woocommerce' ),  
  33. 'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh.jsonp?',  
  34. ),  
  35. 'wc-settings-tax-standard' => array( 
  36. 'title' => __( 'Tax Rate Example', 'woocommerce' ),  
  37. 'url' => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',  
  38. ),  
  39. 'wc-settings-tax-reduced-rate' => array( 
  40. 'title' => __( 'Tax Rate Example', 'woocommerce' ),  
  41. 'url' => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',  
  42. ),  
  43. 'wc-settings-tax-zero-rate' => array( 
  44. 'title' => __( 'Tax Rate Example', 'woocommerce' ),  
  45. 'url' => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',  
  46. ),  
  47. 'wc-settings-shipping' => array( 
  48. 'title' => __( 'Shipping Zones', 'woocommerce' ),  
  49. 'url' => '//fast.wistia.net/embed/iframe/95yiocro6p.jsonp?',  
  50. ),  
  51. 'wc-settings-shipping-options' => array( 
  52. 'title' => __( 'Shipping Options', 'woocommerce' ),  
  53. 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr.jsonp?',  
  54. ),  
  55. 'wc-settings-shipping-classes' => array( 
  56. 'title' => __( 'Shipping Classes', 'woocommerce' ),  
  57. 'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99.jsonp?',  
  58. ),  
  59. 'wc-settings-checkout' => array( 
  60. 'title' => __( 'Checkout Settings', 'woocommerce' ),  
  61. 'url' => '//fast.wistia.net/embed/iframe/65yjv96z51.jsonp?',  
  62. ),  
  63. 'wc-settings-checkout-bacs' => array( 
  64. 'title' => __( 'Bank Transfer (BACS) Payment Method', 'woocommerce' ),  
  65. 'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek.jsonp?',  
  66. ),  
  67. 'wc-settings-checkout-cheque' => array( 
  68. 'title' => __( 'Check Payment Method', 'woocommerce' ),  
  69. 'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea.jsonp?',  
  70. ),  
  71. 'wc-settings-checkout-cod' => array( 
  72. 'title' => __( 'Cash on Delivery (COD) Payment Method', 'woocommerce' ),  
  73. 'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f.jsonp?',  
  74. ),  
  75. 'wc-settings-checkout-paypal' => array( 
  76. 'title' => __( 'PayPal Standard Method', 'woocommerce' ),  
  77. 'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2.jsonp?',  
  78. ),  
  79. 'wc-settings-checkout-paypalbraintree_cards' => array( 
  80. 'title' => __( 'PayPal by Braintree Payment Method', 'woocommerce' ),  
  81. 'url' => '//fast.wistia.net/embed/iframe/oyksirgn40.jsonp?',  
  82. ),  
  83. 'wc-settings-checkout-stripe' => array( 
  84. 'title' => __( 'Stripe Payment Method', 'woocommerce' ),  
  85. 'url' => '//fast.wistia.net/embed/iframe/mf975hx5de.jsonp?',  
  86. ),  
  87. 'wc-settings-account' => array( 
  88. 'title' => __( 'Account Settings', 'woocommerce' ),  
  89. 'url' => '//fast.wistia.net/embed/iframe/35mazq7il2.jsonp?',  
  90. ),  
  91. 'wc-settings-email' => array( 
  92. 'title' => __( 'Email Settings', 'woocommerce' ),  
  93. 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv.jsonp?',  
  94. ),  
  95. 'wc-settings-api' => array( 
  96. 'title' => __( 'API Settings', 'woocommerce' ),  
  97. 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?',  
  98. ),  
  99. 'wc-settings-api' => array( 
  100. 'title' => __( 'API Settings', 'woocommerce' ),  
  101. 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?',  
  102. ),  
  103. 'product' => array( 
  104. 'title' => __( 'Creating Products', 'woocommerce' ),  
  105. 'url' => '//fast.wistia.net/embed/iframe/fw0477t6wr.jsonp?',  
  106. ),  
  107. 'edit-product_cat' => array( 
  108. 'title' => __( 'Product Categories', 'woocommerce' ),  
  109. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',  
  110. ),  
  111. 'edit-product_tag' => array( 
  112. 'title' => __( 'Product Tags', 'woocommerce' ),  
  113. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',  
  114. ),  
  115. 'product_attributes' => array( 
  116. 'title' => __( 'Product Attributes', 'woocommerce' ),  
  117. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',  
  118. ),  
  119. 'wc-status' => array( 
  120. 'title' => __( 'System Status', 'woocommerce' ),  
  121. 'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi.jsonp?',  
  122. ),  
  123. 'wc-reports' => array( 
  124. 'title' => __( 'Reports', 'woocommerce' ),  
  125. 'url' => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?',  
  126. ),  
  127. 'edit-shop_coupon' => array( 
  128. 'title' => __( 'Coupons', 'woocommerce' ),  
  129. 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit.jsonp?',  
  130. ),  
  131. 'shop_coupon' => array( 
  132. 'title' => __( 'Coupons', 'woocommerce' ),  
  133. 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit.jsonp?',  
  134. ),  
  135. 'edit-shop_order' => array( 
  136. 'title' => __( 'Managing Orders', 'woocommerce' ),  
  137. 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee.jsonp?',  
  138. ),  
  139. 'shop_order' => array( 
  140. 'title' => __( 'Managing Orders', 'woocommerce' ),  
  141. 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee.jsonp?',  
  142. ),  
  143. ); 
  144.  
  145. $page = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] ); 
  146. $tab = empty( $_GET['tab'] ) ? '' : sanitize_title( $_GET['tab'] ); 
  147. $section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] ); 
  148. $video_key = $page ? implode( '-', array_filter( array( $page, $tab, $section ) ) ) : $screen->id; 
  149.  
  150. // Fallback for sections 
  151. if ( ! isset( $video_map[ $video_key ] ) ) { 
  152. $video_key = $page ? implode( '-', array_filter( array( $page, $tab ) ) ) : $screen->id; 
  153.  
  154. // Fallback for tabs 
  155. if ( ! isset( $video_map[ $video_key ] ) ) { 
  156. $video_key = $page ? $page : $screen->id; 
  157.  
  158. if ( isset( $video_map[ $video_key ] ) ) { 
  159. $screen->add_help_tab( array( 
  160. 'id' => 'woocommerce_guided_tour_tab',  
  161. 'title' => __( 'Guided Tour', 'woocommerce' ),  
  162. 'content' => 
  163. '<h2><a href="https://docs.woocommerce.com/document/woocommerce-guided-tour-videos/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __( 'Guided Tour', 'woocommerce' ) . '</a> – ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' . 
  164. '<div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;"> 
  165. <div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;"> 
  166. <iframe src="' . esc_url( $video_map[ $video_key ]['url'] ) . 'seo=false&videoFoam=true" title="Wistia video player" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="100%" height="100%"></iframe> 
  167. </div></div> 
  168. <script src="//fast.wistia.net/assets/external/E-v1.js" async></script>',  
  169. ) ); 
  170.  
  171. $screen->add_help_tab( array( 
  172. 'id' => 'woocommerce_support_tab',  
  173. 'title' => __( 'Help & Support', 'woocommerce' ),  
  174. 'content' => 
  175. '<h2>' . __( 'Help & Support', 'woocommerce' ) . '</h2>' . 
  176. '<p>' . sprintf( 
  177. __( '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' ),  
  178. 'https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin' 
  179. ) . '</p>' . 
  180. '<p>' . sprintf( 
  181. __( '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' ),  
  182. 'https://wordpress.org/support/plugin/woocommerce',  
  183. 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' 
  184. ) . '</p>' . 
  185. '<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' . 
  186. '<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>',  
  187. ) ); 
  188.  
  189. $screen->add_help_tab( array( 
  190. 'id' => 'woocommerce_bugs_tab',  
  191. 'title' => __( 'Found a bug?', 'woocommerce' ),  
  192. 'content' => 
  193. '<h2>' . __( 'Found a bug?', 'woocommerce' ) . '</h2>' . 
  194. '<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>' . 
  195. '<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>',  
  196.  
  197. ) ); 
  198.  
  199. $screen->add_help_tab( array( 
  200. 'id' => 'woocommerce_education_tab',  
  201. 'title' => __( 'Education', 'woocommerce' ),  
  202. 'content' => 
  203. '<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' . 
  204. '<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '</p>' . 
  205. '<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __( 'View education partners', 'woocommerce' ) . '</a></p>',  
  206. ) ); 
  207.  
  208. $screen->add_help_tab( array( 
  209. 'id' => 'woocommerce_onboard_tab',  
  210. 'title' => __( 'Setup wizard', 'woocommerce' ),  
  211. 'content' => 
  212. '<h2>' . __( 'Setup wizard', 'woocommerce' ) . '</h2>' . 
  213. '<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' . 
  214. '<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'woocommerce' ) . '</a></p>',  
  215.  
  216. ) ); 
  217.  
  218. $screen->set_help_sidebar( 
  219. '<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' . 
  220. '<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>' . 
  221. '<p><a href="' . 'https://wordpress.org/plugins/woocommerce/' . '" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' . 
  222. '<p><a href="' . 'https://github.com/woocommerce/woocommerce' . '" target="_blank">' . __( 'Github project', 'woocommerce' ) . '</a></p>' . 
  223. '<p><a href="' . 'https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official themes', 'woocommerce' ) . '</a></p>' . 
  224. '<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>' 
  225. );