2013-07-24 12:34:12 +00:00
< ? php
/**
2015-11-03 13:53:50 +00:00
* Add some content to the help tab
2013-07-24 12:34:12 +00:00
*
2014-11-30 06:52:32 +00:00
* @ author WooThemes
* @ category Admin
* @ package WooCommerce / Admin
2013-07-24 12:34:12 +00:00
* @ version 2.1 . 0
*/
2014-09-20 19:52:30 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
2017-09-25 14:07:02 +00:00
exit ;
2014-09-20 19:52:30 +00:00
}
2013-07-24 12:34:12 +00:00
2017-09-25 14:07:02 +00:00
if ( class_exists ( 'WC_Admin_Help' , false ) ) {
return new WC_Admin_Help ();
}
2013-07-24 12:34:12 +00:00
/**
2015-11-03 12:28:01 +00:00
* WC_Admin_Help Class .
2013-07-24 12:34:12 +00:00
*/
class WC_Admin_Help {
/**
* Hook in tabs .
*/
public function __construct () {
2016-09-01 20:50:14 +00:00
add_action ( 'current_screen' , array ( $this , 'add_tabs' ), 50 );
2013-07-24 12:34:12 +00:00
}
/**
2015-11-03 12:28:01 +00:00
* Add Contextual help tabs .
2013-07-24 12:34:12 +00:00
*/
public function add_tabs () {
$screen = get_current_screen ();
2016-02-05 12:16:41 +00:00
if ( ! $screen || ! in_array ( $screen -> id , wc_get_screen_ids () ) ) {
2013-07-24 12:34:12 +00:00
return ;
2014-11-30 06:52:32 +00:00
}
2013-07-24 12:34:12 +00:00
2015-07-01 14:22:43 +00:00
$video_map = array (
'wc-settings' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'General Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'ZD5Cc2xqvCM' ,
2015-07-01 14:22:43 +00:00
),
'wc-settings-general' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'General Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'ZD5Cc2xqvCM' ,
2015-07-01 14:22:43 +00:00
),
'wc-settings-products' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Product Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'FEmwJsE8xDY' ,
2017-02-25 18:45:00 +00:00
),
2015-07-01 14:22:43 +00:00
'wc-settings-tax' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Tax Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '0aPtye5ba4A' ,
2017-02-25 18:45:00 +00:00
),
'wc-settings-tax-standard' => array (
'title' => __ ( 'Tax Rate Example' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'HC2IUnJSJro' ,
2017-02-25 18:45:00 +00:00
),
'wc-settings-tax-reduced-rate' => array (
'title' => __ ( 'Tax Rate Example' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'HC2IUnJSJro' ,
2017-02-25 18:45:00 +00:00
),
'wc-settings-tax-zero-rate' => array (
'title' => __ ( 'Tax Rate Example' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'HC2IUnJSJro' ,
2015-07-01 14:22:43 +00:00
),
2016-06-14 12:51:37 +00:00
'wc-settings-shipping' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Shipping Zones' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '1HhBEbIMqAQ' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-shipping-options' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Shipping Options' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '468Z4s01e3M' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-shipping-classes' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Shipping Classes' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'Vyt5xIewlOs' ,
2016-06-14 12:51:37 +00:00
),
2015-07-01 14:22:43 +00:00
'wc-settings-checkout' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Checkout Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'zoejwJfXops' ,
2015-07-01 14:22:43 +00:00
),
2016-06-14 12:51:37 +00:00
'wc-settings-checkout-bacs' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Bank Transfer (BACS) Payment Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'K4Lpaq9aS2Q' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-checkout-cheque' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Check Payment Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'LwxRxCkfofg' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-checkout-cod' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Cash on Delivery (COD) Payment Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'aioOdPELH4M' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-checkout-paypal' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'PayPal Standard Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'FwHT5UDdkdY' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-checkout-paypalbraintree_cards' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'PayPal by Braintree Payment Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'hubcUWq2NAc' ,
2016-06-14 12:51:37 +00:00
),
'wc-settings-checkout-stripe' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Stripe Payment Method' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '5rMDGdkmSGU' ,
2016-06-14 12:51:37 +00:00
),
2015-07-01 14:22:43 +00:00
'wc-settings-account' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Account Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'AGZSeX5I-wo' ,
2015-07-01 14:22:43 +00:00
),
'wc-settings-email' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Email Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '2vtzGc92tFU' ,
2015-07-01 14:22:43 +00:00
),
2015-07-15 22:19:47 +00:00
'wc-settings-api' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'API Settings' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'SjJUmgfLS4A' ,
2017-02-25 18:45:00 +00:00
),
2016-06-14 12:51:37 +00:00
'product' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Creating Products' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'sFtXa00Jf_o' ,
2015-07-01 14:22:43 +00:00
),
'edit-product_cat' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Product Categories' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'PeFsOTrN1u8' ,
2015-07-01 14:22:43 +00:00
),
'edit-product_tag' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Product Tags' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'PeFsOTrN1u8' ,
2015-07-01 14:22:43 +00:00
),
2015-07-15 22:19:47 +00:00
'product_attributes' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Product Attributes' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'PeFsOTrN1u8' ,
2015-07-01 14:22:43 +00:00
),
'wc-status' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'System Status' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'C8F6_sAr4CE' ,
2017-02-25 18:45:00 +00:00
),
2015-07-01 14:22:43 +00:00
'wc-reports' => array (
'title' => __ ( 'Reports' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => '69adRkRqOk0' ,
2017-02-25 18:45:00 +00:00
),
2015-07-01 14:22:43 +00:00
'edit-shop_coupon' => array (
'title' => __ ( 'Coupons' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'k-GKjRs59UM' ,
2015-07-01 14:22:43 +00:00
),
'shop_coupon' => array (
'title' => __ ( 'Coupons' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'k-GKjRs59UM' ,
2015-07-01 14:22:43 +00:00
),
'edit-shop_order' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Managing Orders' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'rjS3mbiLN_c' ,
2015-07-01 14:22:43 +00:00
),
'shop_order' => array (
2017-02-25 18:45:00 +00:00
'title' => __ ( 'Managing Orders' , 'woocommerce' ),
2017-09-25 14:07:02 +00:00
'id' => 'rjS3mbiLN_c' ,
2016-08-27 01:46:45 +00:00
),
2015-07-01 14:22:43 +00:00
);
$page = empty ( $_GET [ 'page' ] ) ? '' : sanitize_title ( $_GET [ 'page' ] );
$tab = empty ( $_GET [ 'tab' ] ) ? '' : sanitize_title ( $_GET [ 'tab' ] );
$section = empty ( $_REQUEST [ 'section' ] ) ? '' : sanitize_title ( $_REQUEST [ 'section' ] );
$video_key = $page ? implode ( '-' , array_filter ( array ( $page , $tab , $section ) ) ) : $screen -> id ;
2017-09-25 14:07:02 +00:00
// Fallback for sections.
2015-07-01 14:22:43 +00:00
if ( ! isset ( $video_map [ $video_key ] ) ) {
$video_key = $page ? implode ( '-' , array_filter ( array ( $page , $tab ) ) ) : $screen -> id ;
}
2017-09-25 14:07:02 +00:00
// Fallback for tabs.
2015-07-01 14:22:43 +00:00
if ( ! isset ( $video_map [ $video_key ] ) ) {
$video_key = $page ? $page : $screen -> id ;
}
if ( isset ( $video_map [ $video_key ] ) ) {
2017-09-25 14:07:02 +00:00
$embed_code = wp_oembed_get ( 'http://www.youtube.com/watch?v=' . $video_map [ $video_key ][ 'id' ] . '&color=white&hl=' . get_locale () . '&modestbranding=1' );
2015-07-01 14:22:43 +00:00
$screen -> add_help_tab ( array (
2017-09-25 14:07:02 +00:00
'id' => 'woocommerce_guided_tour_tab' ,
'title' => __ ( 'Guided Tour' , 'woocommerce' ),
'content' => '<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>' . $embed_code ,
2015-07-01 14:22:43 +00:00
) );
}
2013-07-24 12:34:12 +00:00
$screen -> add_help_tab ( array (
2014-11-30 06:52:32 +00:00
'id' => 'woocommerce_support_tab' ,
2016-04-25 12:07:38 +00:00
'title' => __ ( 'Help & Support' , 'woocommerce' ),
2014-11-30 06:52:32 +00:00
'content' =>
2016-04-25 12:07:38 +00:00
'<h2>' . __ ( 'Help & Support' , 'woocommerce' ) . '</h2>' .
'<p>' . sprintf (
2017-02-28 11:24:30 +00:00
__ ( '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' ),
2016-10-27 17:36:24 +00:00
'https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
2016-04-25 12:07:38 +00:00
) . '</p>' .
'<p>' . sprintf (
2016-10-27 17:36:24 +00:00
__ ( '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' ),
'https://wordpress.org/support/plugin/woocommerce' ,
'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
2016-04-25 12:07:38 +00:00
) . '</p>' .
2015-07-01 14:22:43 +00:00
'<p>' . __ ( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.' , 'woocommerce' ) . '</p>' .
2016-10-12 10:16:30 +00:00
'<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>' ,
2013-07-24 12:34:12 +00:00
) );
$screen -> add_help_tab ( array (
2014-11-30 06:52:32 +00:00
'id' => 'woocommerce_bugs_tab' ,
'title' => __ ( 'Found a bug?' , 'woocommerce' ),
'content' =>
2015-07-01 14:22:43 +00:00
'<h2>' . __ ( 'Found a bug?' , 'woocommerce' ) . '</h2>' .
2016-09-28 10:17:40 +00:00
'<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>' .
2016-10-12 10:16:30 +00:00
'<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>' ,
2015-10-05 22:26:59 +00:00
) );
2016-04-25 12:07:38 +00:00
$screen -> add_help_tab ( array (
'id' => 'woocommerce_education_tab' ,
'title' => __ ( 'Education' , 'woocommerce' ),
'content' =>
'<h2>' . __ ( 'Education' , 'woocommerce' ) . '</h2>' .
2016-07-27 09:13:03 +00:00
'<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>' .
2016-10-12 10:16:30 +00:00
'<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>' ,
2016-04-25 12:07:38 +00:00
) );
2016-05-17 19:43:57 +00:00
2015-10-05 22:26:59 +00:00
$screen -> add_help_tab ( array (
'id' => 'woocommerce_onboard_tab' ,
2016-10-12 10:16:30 +00:00
'title' => __ ( 'Setup wizard' , 'woocommerce' ),
2015-10-05 22:26:59 +00:00
'content' =>
2016-10-12 10:16:30 +00:00
'<h2>' . __ ( 'Setup wizard' , 'woocommerce' ) . '</h2>' .
2015-12-18 19:05:16 +00:00
'<p>' . __ ( 'If you need to access the setup wizard again, please click on the button below.' , 'woocommerce' ) . '</p>' .
2016-10-12 10:16:30 +00:00
'<p><a href="' . admin_url ( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __ ( 'Setup wizard' , 'woocommerce' ) . '</a></p>' ,
2013-07-24 12:34:12 +00:00
) );
$screen -> set_help_sidebar (
'<p><strong>' . __ ( 'For more information:' , 'woocommerce' ) . '</strong></p>' .
2016-07-05 22:52:16 +00:00
'<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>' .
2016-10-12 10:18:27 +00:00
'<p><a href="' . 'https://wordpress.org/plugins/woocommerce/' . '" target="_blank">' . __ ( 'WordPress.org project' , 'woocommerce' ) . '</a></p>' .
2016-10-12 10:16:30 +00:00
'<p><a href="' . 'https://github.com/woocommerce/woocommerce' . '" target="_blank">' . __ ( 'Github project' , 'woocommerce' ) . '</a></p>' .
'<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>' .
'<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>'
2013-07-24 12:34:12 +00:00
);
}
}
2014-08-27 20:43:12 +00:00
return new WC_Admin_Help ();