woocommerce/includes/admin/class-wc-admin-help.php

250 lines
11 KiB
PHP
Raw Normal View History

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
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
2013-07-24 12:34:12 +00:00
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
2013-07-24 12:34:12 +00:00
2017-02-16 11:46:01 +00:00
if ( ! class_exists( 'WC_Admin_Help', false ) ) :
2013-07-24 12:34:12 +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
}
/**
* Add Contextual help tabs.
2013-07-24 12:34:12 +00:00
*/
public function add_tabs() {
$screen = get_current_screen();
if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids() ) ) {
2013-07-24 12:34:12 +00:00
return;
}
2013-07-24 12:34:12 +00:00
$video_map = array(
'wc-settings' => array(
'title' => __( 'General Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'mz2l10u5f6',
),
'wc-settings-general' => array(
'title' => __( 'General Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'mz2l10u5f6',
),
'wc-settings-products' => array(
'title' => __( 'Product Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'lolkan4fxf',
),
'wc-settings-tax' => array(
'title' => __( 'Tax Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'qp1v19dwrh',
),
'wc-settings-tax-standard' => array(
'title' => __( 'Tax Rate Example', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '2p903vptwa',
),
'wc-settings-tax-reduced-rate' => array(
'title' => __( 'Tax Rate Example', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '2p903vptwa',
),
'wc-settings-tax-zero-rate' => array(
'title' => __( 'Tax Rate Example', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '2p903vptwa',
),
'wc-settings-shipping' => array(
'title' => __( 'Shipping Zones', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '95yiocro6p',
),
'wc-settings-shipping-options' => array(
'title' => __( 'Shipping Options', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '9c9008dxnr',
),
'wc-settings-shipping-classes' => array(
'title' => __( 'Shipping Classes', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'tpqg17aq99',
),
'wc-settings-checkout' => array(
'title' => __( 'Checkout Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '65yjv96z51',
),
'wc-settings-checkout-bacs' => array(
'title' => __( 'Bank Transfer (BACS) Payment Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'dh4piy3sek',
),
'wc-settings-checkout-cheque' => array(
'title' => __( 'Check Payment Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'u2m2kcakea',
),
'wc-settings-checkout-cod' => array(
'title' => __( 'Cash on Delivery (COD) Payment Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '8hyli8wu5f',
),
'wc-settings-checkout-paypal' => array(
'title' => __( 'PayPal Standard Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'rbl7e7l4k2',
),
'wc-settings-checkout-paypalbraintree_cards' => array(
'title' => __( 'PayPal by Braintree Payment Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'oyksirgn40',
),
'wc-settings-checkout-stripe' => array(
'title' => __( 'Stripe Payment Method', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'mf975hx5de',
),
'wc-settings-account' => array(
'title' => __( 'Account Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '35mazq7il2',
),
'wc-settings-email' => array(
'title' => __( 'Email Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'svcaftq4xv',
),
'wc-settings-api' => array(
'title' => __( 'API Settings', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '1q0ny74vvq',
),
'product' => array(
'title' => __( 'Creating Products', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'fw0477t6wr',
),
'edit-product_cat' => array(
'title' => __( 'Product Categories', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'f0j5gzqigg',
),
'edit-product_tag' => array(
'title' => __( 'Product Tags', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'f0j5gzqigg',
),
'product_attributes' => array(
'title' => __( 'Product Attributes', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'f0j5gzqigg',
),
'wc-status' => array(
'title' => __( 'System Status', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'xdn733nnhi',
),
'wc-reports' => array(
'title' => __( 'Reports', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => '6aasex0w99',
),
'edit-shop_coupon' => array(
'title' => __( 'Coupons', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'gupd4h8sit',
),
'shop_coupon' => array(
'title' => __( 'Coupons', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'gupd4h8sit',
),
'edit-shop_order' => array(
'title' => __( 'Managing Orders', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'n8n0sa8hee',
),
'shop_order' => array(
'title' => __( 'Managing Orders', 'woocommerce' ),
2017-07-06 11:32:28 +00:00
'id' => 'n8n0sa8hee',
),
);
$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;
// Fallback for sections
if ( ! isset( $video_map[ $video_key ] ) ) {
$video_key = $page ? implode( '-', array_filter( array( $page, $tab ) ) ) : $screen->id;
}
// Fallback for tabs
if ( ! isset( $video_map[ $video_key ] ) ) {
$video_key = $page ? $page : $screen->id;
}
if ( isset( $video_map[ $video_key ] ) ) {
$screen->add_help_tab( array(
'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> &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
'<script src="//fast.wistia.net/assets/external/E-v1.js" async></script>
2017-07-06 11:32:28 +00:00
<div class="wistia_embed wistia_async_' . esc_attr( $video_map[ $video_key ]['id'] ) . ' videoFoam=true seo=false" style="width:640px;height:360px;">&nbsp;</div>
',
) );
}
2013-07-24 12:34:12 +00:00
$screen->add_help_tab( array(
'id' => 'woocommerce_support_tab',
'title' => __( 'Help &amp; Support', 'woocommerce' ),
'content' =>
'<h2>' . __( 'Help &amp; Support', 'woocommerce' ) . '</h2>' .
'<p>' . sprintf(
__( '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'
) . '</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'
) . '</p>' .
'<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' .
'<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(
'id' => 'woocommerce_bugs_tab',
'title' => __( 'Found a bug?', 'woocommerce' ),
'content' =>
'<h2>' . __( 'Found a bug?', 'woocommerce' ) . '</h2>' .
'<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>' .
'<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>',
) );
$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>' .
'<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>',
) );
$screen->add_help_tab( array(
'id' => 'woocommerce_onboard_tab',
'title' => __( 'Setup wizard', 'woocommerce' ),
'content' =>
'<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>' .
'<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>' .
'<p><a href="' . 'https://wordpress.org/plugins/woocommerce/' . '" target="_blank">' . __( 'WordPress.org project', 'woocommerce' ) . '</a></p>' .
'<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
);
}
}
endif;
2014-08-27 20:43:12 +00:00
return new WC_Admin_Help();