| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/plugins/woocommerce/includes/admin/ |
Upload File : |
<?php
/**
* Adds and controls pointers for contextual help/tutorials
*
* @package WooCommerce\Admin\Pointers
* @version 2.4.0
*/
use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
use Automattic\WooCommerce\Admin\Features\Features;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Admin_Pointers Class.
*/
class WC_Admin_Pointers {
/**
* Constructor.
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'setup_pointers_for_screen' ) );
}
/**
* Setup pointers for screen.
*/
public function setup_pointers_for_screen() {
$screen = get_current_screen();
if ( ! $screen ) {
return;
}
switch ( $screen->id ) {
case 'product':
$this->create_product_tutorial();
$this->create_variable_product_tutorial();
break;
case 'woocommerce_page_wc-addons':
$this->create_wc_addons_tutorial();
break;
}
}
/**
* Pointers for creating a product.
*/
public function create_product_tutorial() {
if ( ! isset( $_GET['tutorial'] ) || ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
global $wp_post_types;
if ( ! isset( $wp_post_types ) ) {
return;
}
$labels = $wp_post_types['product']->labels;
$labels->add_new = __( 'Enable guided mode', 'woocommerce' );
WCAdminAssets::register_script( 'wp-admin-scripts', 'product-tour', true );
}
/**
* Pointers for creating a variable product.
*/
public function create_variable_product_tutorial() {
if ( ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
WCAdminAssets::register_script( 'wp-admin-scripts', 'variable-product-tour', true );
}
/**
* Pointers for accessing In-App Marketplace.
*/
public function create_wc_addons_tutorial() {
if ( ! isset( $_GET['tutorial'] ) || ! current_user_can( 'manage_options' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
if ( wp_is_mobile() ) {
return; // Permit In-App Marketplace Tour on desktops only.
}
WCAdminAssets::register_script( 'wp-admin-scripts', 'wc-addons-tour', true );
}
}
new WC_Admin_Pointers();