/home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/src/Admin/API
NameSizeModeActions
AI/-0755rm
Reports/-0755rm
Templates/-0755rm
AnalyticsImports.php93040644editdlrm
Coupons.php22020644editdlrm
CustomAttributeTraits.php34840644editdlrm
Customers.php21630644editdlrm
Data.php9390644editdlrm
DataCountries.php11490644editdlrm
DataDownloadIPs.php42480644editdlrm
Experiments.php18640644editdlrm
Features.php17400644editdlrm
Init.php108230644editdlrm
LaunchYourStore.php52730644editdlrm
Leaderboards.php186600644editdlrm
Marketing.php49600644editdlrm
MarketingCampaigns.php98680644editdlrm
MarketingCampaignTypes.php61600644editdlrm
MarketingChannels.php58780644editdlrm
MarketingOverview.php34430644editdlrm
MarketingRecommendations.php60850644editdlrm
MobileAppMagicLink.php21470644editdlrm
NoteActions.php24490644editdlrm
Notes.php259250644editdlrm
Notice.php24370644editdlrm
OnboardingFreeExtensions.php26390644editdlrm
OnboardingPlugins.php109200644editdlrm
OnboardingProducts.php19830644editdlrm
OnboardingProductTypes.php18400644editdlrm
OnboardingProfile.php188170644editdlrm
OnboardingTasks.php327900644editdlrm
OnboardingThemes.php56200644editdlrm
Options.php102360644editdlrm
Orders.php103760644editdlrm
PaymentGatewaySuggestions.php59980644editdlrm
Plugins.php217290644editdlrm
ProductAttributes.php45680644editdlrm
ProductAttributeTerms.php44670644editdlrm
ProductCategories.php4580644editdlrm
ProductForm.php31370644editdlrm
ProductReviews.php13300644editdlrm
Products.php99630644editdlrm
ProductsLowInStock.php180460644editdlrm
ProductVariations.php61780644editdlrm
SettingOptions.php8780644editdlrm
Settings.php42990644editdlrm
ShippingPartnerSuggestions.php58760644editdlrm
Taxes.php50200644editdlrm
Themes.php62630644editdlrm
Edit: /home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/src/Admin/API/OnboardingThemes.php (5620B)
namespace, '/' . $this->rest_base . '/install', array( array( 'methods' => \WP_REST_Server::EDITABLE, 'callback' => array( $this, 'install_theme' ), 'permission_callback' => array( $this, 'update_item_permissions_check' ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/activate', array( array( 'methods' => \WP_REST_Server::EDITABLE, 'callback' => array( $this, 'activate_theme' ), 'permission_callback' => array( $this, 'update_item_permissions_check' ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); } /** * Check if a given request has access to manage themes. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|boolean */ public function update_item_permissions_check( $request ) { if ( ! current_user_can( 'switch_themes' ) ) { return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage themes.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Installs the requested theme. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|array Theme installation status. */ public function install_theme( $request ) { $theme = sanitize_text_field( $request['theme'] ); $installed_themes = wp_get_themes(); if ( in_array( $theme, array_keys( $installed_themes ), true ) ) { return( array( 'slug' => $theme, 'name' => $installed_themes[ $theme ]->get( 'Name' ), 'status' => 'success', ) ); } include_once ABSPATH . '/wp-admin/includes/admin.php'; include_once ABSPATH . '/wp-admin/includes/theme-install.php'; include_once ABSPATH . '/wp-admin/includes/theme.php'; include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . '/wp-admin/includes/class-theme-upgrader.php'; $api = themes_api( 'theme_information', array( 'slug' => $theme, 'fields' => array( 'sections' => false, ), ) ); if ( is_wp_error( $api ) ) { return new \WP_Error( 'woocommerce_rest_theme_install', sprintf( /* translators: %s: theme slug (example: woocommerce-services) */ __( 'The requested theme `%s` could not be installed. Theme API call failed.', 'woocommerce' ), $theme ), 500 ); } $upgrader = new \Theme_Upgrader( new \Automatic_Upgrader_Skin() ); $result = $upgrader->install( $api->download_link ); if ( is_wp_error( $result ) || is_null( $result ) ) { return new \WP_Error( 'woocommerce_rest_theme_install', sprintf( /* translators: %s: theme slug (example: woocommerce-services) */ __( 'The requested theme `%s` could not be installed.', 'woocommerce' ), $theme ), 500 ); } return array( 'slug' => $theme, 'name' => $api->name, 'status' => 'success', ); } /** * Activate the requested theme. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|array Theme activation status. */ public function activate_theme( $request ) { $theme = sanitize_text_field( $request['theme'] ); require_once ABSPATH . 'wp-admin/includes/theme.php'; $installed_themes = wp_get_themes(); if ( ! in_array( $theme, array_keys( $installed_themes ), true ) ) { /* translators: %s: theme slug (example: woocommerce-services) */ return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'Invalid theme %s.', 'woocommerce' ), $theme ), 404 ); } $result = switch_theme( $theme ); if ( ! is_null( $result ) ) { return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'The requested theme could not be activated.', 'woocommerce' ), $theme ), 500 ); } return( array( 'slug' => $theme, 'name' => $installed_themes[ $theme ]->get( 'Name' ), 'status' => 'success', ) ); } /** * Get the schema, conforming to JSON Schema. * * @return array */ public function get_item_schema() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'onboarding_theme', 'type' => 'object', 'properties' => array( 'slug' => array( 'description' => __( 'Theme slug.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( 'description' => __( 'Theme name.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( 'description' => __( 'Theme status.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ); return $this->add_additional_fields_schema( $schema ); } }