Current Path: > home > codekrsu > > cuddlebuds.lk > wp-content > plugins > woocommerce > src > Internal > > Admin
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
BlockTemplates | Directory | - | - | |
EmailImprovements | Directory | - | - | |
EmailPreview | Directory | - | - | |
Emails | Directory | - | - | |
ImportExport | Directory | - | - | |
Logging | Directory | - | - | |
Marketing | Directory | - | - | |
Notes | Directory | - | - | |
Onboarding | Directory | - | - | |
Orders | Directory | - | - | |
ProductForm | Directory | - | - | |
ProductReviews | Directory | - | - | |
RemoteFreeExtensions | Directory | - | - | |
Schedulers | Directory | - | - | |
Settings | Directory | - | - | |
Suggestions | Directory | - | - | |
WCPayPromotion | Directory | - | - | |
ActivityPanels.php | File | 1616 bytes | August 24 2022 02:07:06. | |
Analytics.php | File | 8041 bytes | March 03 2025 22:28:12. | |
CategoryLookup.php | File | 8180 bytes | April 20 2022 06:50:54. | |
Coupons.php | File | 2928 bytes | November 14 2024 01:17:00. | |
CouponsMovedTrait.php | File | 2203 bytes | April 20 2022 06:50:54. | |
CustomerEffortScoreTracks.php | File | 17647 bytes | May 12 2025 21:07:28. | |
Events.php | File | 8761 bytes | May 12 2025 21:07:28. | |
FeaturePlugin.php | File | 6690 bytes | May 12 2025 21:07:28. | |
Homescreen.php | File | 8860 bytes | September 23 2024 20:44:04. | |
Loader.php | File | 19643 bytes | May 12 2025 21:07:28. | |
Marketing.php | File | 6440 bytes | November 14 2024 01:17:00. | |
Marketplace.php | File | 5521 bytes | March 03 2025 22:28:12. | |
MobileAppBanner.php | File | 956 bytes | April 20 2022 06:50:54. | |
RemoteInboxNotifications.php | File | 932 bytes | March 21 2023 20:45:06. | |
Settings.php | File | 13762 bytes | June 23 2025 19:46:28. | |
ShippingLabelBanner.php | File | 4779 bytes | September 23 2024 20:44:04. | |
ShippingLabelBannerDisplayRules.php | File | 3718 bytes | September 04 2024 20:34:26. | |
SiteHealth.php | File | 2370 bytes | February 22 2023 07:17:34. | |
Survey.php | File | 768 bytes | April 20 2022 06:50:54. | |
SystemStatusReport.php | File | 5990 bytes | May 12 2025 21:07:28. | |
Translations.php | File | 11942 bytes | November 14 2024 01:17:00. | |
WCAdminAssets.php | File | 17982 bytes | May 12 2025 21:07:28. | |
WCAdminSharedSettings.php | File | 2128 bytes | April 22 2025 15:40:34. | |
WCAdminUser.php | File | 4175 bytes | March 26 2024 16:56:02. | |
WcPayWelcomePage.php | File | 6481 bytes | June 23 2025 19:46:28. |
<?php namespace Automattic\WooCommerce\Internal\Admin; /** * WCAdminUser Class. */ class WCAdminUser { /** * Class instance. * * @var WCAdminUser instance */ protected static $instance = null; /** * Constructor. */ public function __construct() { add_action( 'rest_api_init', array( $this, 'register_user_data' ) ); } /** * Get class instance. * * @return object Instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Registers WooCommerce specific user data to the WordPress user API. */ public function register_user_data() { register_rest_field( 'user', 'is_super_admin', array( 'get_callback' => function( $user ) { if ( ! isset( $user['id'] ) || 0 === $user['id'] ) { return false; } return is_super_admin( $user['id'] ); }, 'schema' => null, ) ); register_rest_field( 'user', 'woocommerce_meta', array( 'get_callback' => array( $this, 'get_user_data_values' ), 'update_callback' => array( $this, 'update_user_data_values' ), 'schema' => null, ) ); } /** * For all the registered user data fields ( Loader::get_user_data_fields ), fetch the data * for returning via the REST API. * * @param WP_User $user Current user. */ public function get_user_data_values( $user ) { $values = array(); foreach ( $this->get_user_data_fields() as $field ) { $values[ $field ] = self::get_user_data_field( $user['id'], $field ); } return $values; } /** * For all the registered user data fields ( Loader::get_user_data_fields ), update the data * for the REST API. * * @param array $values The new values for the meta. * @param WP_User $user The current user. * @param string $field_id The field id for the user meta. */ public function update_user_data_values( $values, $user, $field_id ) { if ( empty( $values ) || ! is_array( $values ) || 'woocommerce_meta' !== $field_id ) { return; } $fields = $this->get_user_data_fields(); $updates = array(); foreach ( $values as $field => $value ) { if ( in_array( $field, $fields, true ) ) { $updates[ $field ] = $value; self::update_user_data_field( $user->ID, $field, $value ); } } return $updates; } /** * We store some WooCommerce specific user meta attached to users endpoint, * so that we can track certain preferences or values such as the inbox activity panel last open time. * Additional fields can be added in the function below, and then used via wc-admin's currentUser data. * * @return array Fields to expose over the WP user endpoint. */ public function get_user_data_fields() { /** * Filter user data fields exposed over the WordPress user endpoint. * * @since 4.0.0 * @param array $fields Array of fields to expose over the WP user endpoint. */ return apply_filters( 'woocommerce_admin_get_user_data_fields', array( 'variable_product_tour_shown' ) ); } /** * Helper to update user data fields. * * @param int $user_id User ID. * @param string $field Field name. * @param mixed $value Field value. */ public static function update_user_data_field( $user_id, $field, $value ) { update_user_meta( $user_id, 'woocommerce_admin_' . $field, $value ); } /** * Helper to retrieve user data fields. * * Migrates old key prefixes as well. * * @param int $user_id User ID. * @param string $field Field name. * @return mixed The user field value. */ public static function get_user_data_field( $user_id, $field ) { $meta_value = get_user_meta( $user_id, 'woocommerce_admin_' . $field, true ); // Migrate old meta values (prefix changed from `wc_admin_` to `woocommerce_admin_`). if ( '' === $meta_value ) { $old_meta_value = get_user_meta( $user_id, 'wc_admin_' . $field, true ); if ( '' !== $old_meta_value ) { self::update_user_data_field( $user_id, $field, $old_meta_value ); delete_user_meta( $user_id, 'wc_admin_' . $field ); $meta_value = $old_meta_value; } } return $meta_value; } }
SILENT KILLER Tool