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3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / class-wc-admin.php
woocommerce / includes / admin Last commit date
helper 2 years ago importers 2 years ago list-tables 2 years ago marketplace-suggestions 2 years ago meta-boxes 2 years ago notes 2 years ago plugin-updates 2 years ago reports 2 years ago settings 2 years ago views 2 years ago class-wc-admin-addons.php 2 years ago class-wc-admin-api-keys-table-list.php 2 years ago class-wc-admin-api-keys.php 2 years ago class-wc-admin-assets.php 2 years ago class-wc-admin-attributes.php 3 years ago class-wc-admin-customize.php 5 years ago class-wc-admin-dashboard-setup.php 2 years ago class-wc-admin-dashboard.php 3 years ago class-wc-admin-duplicate-product.php 5 years ago class-wc-admin-exporters.php 3 years ago class-wc-admin-help.php 2 years ago class-wc-admin-importers.php 2 years ago class-wc-admin-log-table-list.php 2 years ago class-wc-admin-marketplace-promotions.php 2 years ago class-wc-admin-menus.php 2 years ago class-wc-admin-meta-boxes.php 2 years ago class-wc-admin-notices.php 2 years ago class-wc-admin-permalink-settings.php 5 years ago class-wc-admin-pointers.php 3 years ago class-wc-admin-post-types.php 2 years ago class-wc-admin-profile.php 2 years ago class-wc-admin-reports.php 5 years ago class-wc-admin-settings.php 2 years ago class-wc-admin-setup-wizard.php 2 years ago class-wc-admin-status.php 2 years ago class-wc-admin-taxonomies.php 3 years ago class-wc-admin-upload-downloadable-product.php 2 years ago class-wc-admin-webhooks-table-list.php 2 years ago class-wc-admin-webhooks.php 2 years ago class-wc-admin.php 2 years ago wc-admin-functions.php 2 years ago wc-meta-box-functions.php 2 years ago
class-wc-admin.php
329 lines
1 <?php
2 /**
3 * WooCommerce Admin
4 *
5 * @class WC_Admin
6 * @package WooCommerce\Admin
7 * @version 2.6.0
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 /**
15 * WC_Admin class.
16 */
17 class WC_Admin {
18
19 /**
20 * Constructor.
21 */
22 public function __construct() {
23 add_action( 'init', array( $this, 'includes' ) );
24 add_action( 'current_screen', array( $this, 'conditional_includes' ) );
25 add_action( 'admin_init', array( $this, 'buffer' ), 1 );
26 add_action( 'admin_init', array( $this, 'preview_emails' ) );
27 add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
28 add_action( 'admin_init', array( $this, 'admin_redirects' ) );
29 add_action( 'admin_footer', 'wc_print_js', 25 );
30 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
31
32 // Disable WXR export of schedule action posts.
33 add_filter( 'action_scheduler_post_type_args', array( $this, 'disable_webhook_post_export' ) );
34
35 // Add body class for WP 5.3+ compatibility.
36 add_filter( 'admin_body_class', array( $this, 'include_admin_body_class' ), 9999 );
37
38 // Add body class for Marketplace and My Subscriptions pages.
39 if ( isset( $_GET['page'] ) && 'wc-addons' === $_GET['page'] ) {
40 add_filter( 'admin_body_class', array( 'WC_Admin_Addons', 'filter_admin_body_classes' ) );
41 }
42
43 // Fetch list of promotions from Woo.com for WooCommerce admin UI. We need to fire earlier than admin_init so we can filter menu items.
44 add_action( 'woocommerce_init', array( 'WC_Admin_Marketplace_Promotions', 'init_marketplace_promotions' ) );
45 }
46
47 /**
48 * Output buffering allows admin screens to make redirects later on.
49 */
50 public function buffer() {
51 ob_start();
52 }
53
54 /**
55 * Include any classes we need within admin.
56 */
57 public function includes() {
58 include_once __DIR__ . '/wc-admin-functions.php';
59 include_once __DIR__ . '/wc-meta-box-functions.php';
60 include_once __DIR__ . '/class-wc-admin-post-types.php';
61 include_once __DIR__ . '/class-wc-admin-taxonomies.php';
62 include_once __DIR__ . '/class-wc-admin-menus.php';
63 include_once __DIR__ . '/class-wc-admin-customize.php';
64 include_once __DIR__ . '/class-wc-admin-notices.php';
65 include_once __DIR__ . '/class-wc-admin-assets.php';
66 include_once __DIR__ . '/class-wc-admin-api-keys.php';
67 include_once __DIR__ . '/class-wc-admin-webhooks.php';
68 include_once __DIR__ . '/class-wc-admin-pointers.php';
69 include_once __DIR__ . '/class-wc-admin-importers.php';
70 include_once __DIR__ . '/class-wc-admin-exporters.php';
71
72 // Help Tabs.
73 if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
74 include_once __DIR__ . '/class-wc-admin-help.php';
75 }
76
77 // Helper.
78 include_once __DIR__ . '/helper/class-wc-helper.php';
79
80 // Marketplace suggestions & related REST API.
81 include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-suggestions.php';
82 include_once __DIR__ . '/marketplace-suggestions/class-wc-marketplace-updater.php';
83
84 // Marketplace promotions.
85 include_once __DIR__ . '/class-wc-admin-marketplace-promotions.php';
86 }
87
88 /**
89 * Include admin files conditionally.
90 */
91 public function conditional_includes() {
92 $screen = get_current_screen();
93
94 if ( ! $screen ) {
95 return;
96 }
97
98 switch ( $screen->id ) {
99 case 'dashboard':
100 case 'dashboard-network':
101 include __DIR__ . '/class-wc-admin-dashboard-setup.php';
102 include __DIR__ . '/class-wc-admin-dashboard.php';
103 break;
104 case 'options-permalink':
105 include __DIR__ . '/class-wc-admin-permalink-settings.php';
106 break;
107 case 'plugins':
108 include __DIR__ . '/plugin-updates/class-wc-plugins-screen-updates.php';
109 break;
110 case 'update-core':
111 include __DIR__ . '/plugin-updates/class-wc-updates-screen-updates.php';
112 break;
113 case 'users':
114 case 'user':
115 case 'profile':
116 case 'user-edit':
117 include __DIR__ . '/class-wc-admin-profile.php';
118 break;
119 }
120 }
121
122 /**
123 * Handle redirects to setup/welcome page after install and updates.
124 *
125 * The user must have access rights, and we must ignore the network/bulk plugin updaters.
126 */
127 public function admin_redirects() {
128 // Don't run this fn from Action Scheduler requests, as it would clear _wc_activation_redirect transient.
129 // That means OBW would never be shown.
130 if ( wc_is_running_from_async_action_scheduler() ) {
131 return;
132 }
133
134 // phpcs:disable WordPress.Security.NonceVerification.Recommended
135 // Nonced plugin install redirects.
136 if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {
137 $plugin_slug = wc_clean( wp_unslash( $_GET['wc-install-plugin-redirect'] ) );
138
139 if ( current_user_can( 'install_plugins' ) && in_array( $plugin_slug, array( 'woocommerce-gateway-stripe' ), true ) ) {
140 $nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug );
141 $url = self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug . '&_wpnonce=' . $nonce );
142 } else {
143 $url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug );
144 }
145
146 wp_safe_redirect( $url );
147 exit;
148 }
149
150 // phpcs:enable WordPress.Security.NonceVerification.Recommended
151 }
152
153 /**
154 * Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from accessing admin.
155 */
156 public function prevent_admin_access() {
157 $prevent_access = false;
158
159 // Do not interfere with admin-post or admin-ajax requests.
160 $exempted_paths = array( 'admin-post.php', 'admin-ajax.php' );
161
162 if (
163 /**
164 * This filter is documented in ../wc-user-functions.php
165 *
166 * @since 3.6.0
167 */
168 apply_filters( 'woocommerce_disable_admin_bar', true )
169 && isset( $_SERVER['SCRIPT_FILENAME'] )
170 && ! in_array( basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ), $exempted_paths, true )
171 ) {
172 $has_cap = false;
173 $access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
174
175 foreach ( $access_caps as $access_cap ) {
176 if ( current_user_can( $access_cap ) ) {
177 $has_cap = true;
178 break;
179 }
180 }
181
182 if ( ! $has_cap ) {
183 $prevent_access = true;
184 }
185 }
186
187 if ( apply_filters( 'woocommerce_prevent_admin_access', $prevent_access ) ) {
188 wp_safe_redirect( wc_get_page_permalink( 'myaccount' ) );
189 exit;
190 }
191 }
192
193 /**
194 * Preview email template.
195 */
196 public function preview_emails() {
197
198 if ( isset( $_GET['preview_woocommerce_mail'] ) ) {
199 if ( ! ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'preview-mail' ) ) ) {
200 die( 'Security check' );
201 }
202
203 // load the mailer class.
204 $mailer = WC()->mailer();
205
206 // get the preview email subject.
207 $email_heading = __( 'HTML email template', 'woocommerce' );
208
209 // get the preview email content.
210 ob_start();
211 include __DIR__ . '/views/html-email-template-preview.php';
212 $message = ob_get_clean();
213
214 // create a new email.
215 $email = new WC_Email();
216
217 // wrap the content with the email template and then add styles.
218 $message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
219
220 // print the preview email.
221 // phpcs:ignore WordPress.Security.EscapeOutput
222 echo $message;
223 // phpcs:enable
224 exit;
225 }
226 }
227
228 /**
229 * Change the admin footer text on WooCommerce admin pages.
230 *
231 * @since 2.3
232 * @param string $footer_text text to be rendered in the footer.
233 * @return string
234 */
235 public function admin_footer_text( $footer_text ) {
236 if ( ! current_user_can( 'manage_woocommerce' ) || ! function_exists( 'wc_get_screen_ids' ) ) {
237 return $footer_text;
238 }
239 $current_screen = get_current_screen();
240 $wc_pages = wc_get_screen_ids();
241
242 // Set only WC pages.
243 $wc_pages = array_diff( $wc_pages, array( 'profile', 'user-edit' ) );
244
245 // Check to make sure we're on a WooCommerce admin page.
246 if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages, true ) ) ) {
247 // Change the footer text.
248 if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
249 $footer_text = sprintf(
250 /* translators: 1: WooCommerce 2:: five stars */
251 __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'woocommerce' ),
252 sprintf( '<strong>%s</strong>', esc_html__( 'WooCommerce', 'woocommerce' ) ),
253 '<a href="https://wordpress.org/support/plugin/woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" aria-label="' . esc_attr__( 'five star', 'woocommerce' ) . '" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
254 );
255 wc_enqueue_js(
256 "jQuery( 'a.wc-rating-link' ).on( 'click', function() {
257 jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );
258 jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
259 });"
260 );
261 } else {
262 $footer_text = __( 'Thank you for selling with WooCommerce.', 'woocommerce' );
263 }
264 }
265
266 return $footer_text;
267 }
268
269 /**
270 * Check on a Jetpack install queued by the Setup Wizard.
271 *
272 * See: WC_Admin_Setup_Wizard::install_jetpack()
273 */
274 public function setup_wizard_check_jetpack() {
275 $jetpack_active = class_exists( 'Jetpack' );
276
277 wp_send_json_success(
278 array(
279 'is_active' => $jetpack_active ? 'yes' : 'no',
280 )
281 );
282 }
283
284 /**
285 * Disable WXR export of scheduled action posts.
286 *
287 * @since 3.6.2
288 *
289 * @param array $args Scheduled action post type registration args.
290 *
291 * @return array
292 */
293 public function disable_webhook_post_export( $args ) {
294 $args['can_export'] = false;
295 return $args;
296 }
297
298 /**
299 * Include admin classes.
300 *
301 * @since 4.2.0
302 * @param string $classes Body classes string.
303 * @return string
304 */
305 public function include_admin_body_class( $classes ) {
306 if ( in_array( array( 'wc-wp-version-gte-53', 'wc-wp-version-gte-55' ), explode( ' ', $classes ), true ) ) {
307 return $classes;
308 }
309
310 $raw_version = get_bloginfo( 'version' );
311 $version_parts = explode( '-', $raw_version );
312 $version = count( $version_parts ) > 1 ? $version_parts[0] : $raw_version;
313
314 // Add WP 5.3+ compatibility class.
315 if ( $raw_version && version_compare( $version, '5.3', '>=' ) ) {
316 $classes .= ' wc-wp-version-gte-53';
317 }
318
319 // Add WP 5.5+ compatibility class.
320 if ( $raw_version && version_compare( $version, '5.5', '>=' ) ) {
321 $classes .= ' wc-wp-version-gte-55';
322 }
323
324 return $classes;
325 }
326 }
327
328 return new WC_Admin();
329