class Cherry_Picker_Admin { private $plugin_name; private $version; public function __construct($plugin_name, $version) { $this->plugin_name = $plugin_name; $this->version = $version; } public function enqueue_styles() { wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/cherry-picker-admin.css', array(), $this->version, 'all'); } private static function get_adapters_base_url() { return plugin_dir_url(__FILE__) . 'js/adapters/'; } public static function get_adapters_list() { $adapters = [ 'amazon.*' => 'amazon.js', 'aliexpress.*' => 'aliexpress.js', 'iherb.com' => 'iherb.js', 'xiaomi-mi.*' => 'xiaomi.js', 'gearbest.com' => 'gearbest.js', 'next.*' => 'next.js', 'poshmark.com' => 'poshmark.js', 'laredoute.*' => 'redoute.js' // Ajout de La Redoute ]; error_log("[Cherry Picker] Adapters list: " . json_encode($adapters)); // Log des adaptateurs return apply_filters('cherry_picker_adapters', $adapters); } public function enqueue_scripts() { wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/cherry-picker-admin.js', array('jquery'), $this->version, false); } public function render_admin_page() { $this->options = get_option('cherry_picker_options'); require_once plugin_dir_path(dirname(__FILE__)) . 'admin/partials/cherry-picker-admin-display.php'; } public function admin_plugin_page() { add_menu_page(__('Cherry Picker Settings', 'cherry-picker'), __('Cherry Picker', 'cherry-picker'), 'manage_options', 'custompage', [$this, 'render_admin_page'], 'dashicons-plus-alt', '55'); } public static function generate_boormarklet() { $supported = json_encode(self::get_adapters_list()); $tpl = '(function() { console.log("[Cherry Picker] Bookmarklet executed"); // Log lors de l'exécution const supported = %3$s; console.log("[Cherry Picker] Supported adapters:", supported); const adapterBase = "%4$s"; const supportedIndex = Object.keys(supported).find(function(site) { console.log("[Cherry Picker] Checking site:", site, window.location.href); return new RegExp(site).test(window.location.href); }); console.log("[Cherry Picker] Supported index:", supportedIndex); if (supportedIndex === undefined) { console.error("[Cherry Picker] Site not supported"); alert("Site not supported"); return; } var script = document.createElement("script"); script.src = "%1$s"; console.log("[Cherry Picker] Loading bundle from:", script.src); window.cherryPickerSubmitUrl = "%2$s"; window.adapterUrl = supported[supportedIndex].startsWith("http") ? supported[supportedIndex] : adapterBase + supported[supportedIndex]; console.log("[Cherry Picker] Adapter URL:", window.adapterUrl); document.body.appendChild(script); })()'; $bundle_url = defined('CP_BUNDLE_URL') ? CP_BUNDLE_URL : plugin_dir_url(__DIR__) . 'public/js/bundle.js'; $form_action = admin_url('admin-post.php'); $bookmark = sprintf( $tpl, $bundle_url, $form_action, $supported, self::get_adapters_base_url() ); printf('%s', __('CherryPick', 'cherry-pick')); } public function register_settings_group() { register_setting( 'my_option_group', 'cherry_picker_options', [$this, 'sanitize'] ); add_settings_section( 'setting_section_id', __('General settings'), array($this, 'print_section_info'), 'custompage' ); add_settings_field( 'default_status', 'Default product status', array($this, 'status_select_callback'), 'custompage', 'setting_section_id' ); } public function sanitize($input) { $new_input = array(); if (isset($input['default_status'])) { $new_input['default_status'] = sanitize_text_field($input['default_status']); } if (isset($input['title'])) { $new_input['title'] = sanitize_text_field($input['title']); } return $new_input; } public function status_select_callback() { $options = ''; $selected = $this->options['default_status']; $statuses = [ null => __('Select'), 'publish' => __('Public', 'cherry-pick'), 'draft' => __('Draft', 'cherry-pick') ]; foreach ($statuses as $key => $status) { $options .= sprintf('', $key, $status, selected($selected, $key, false)); } printf( '
', $options ); _e('

Select default status for products created via Cherry Picker

', 'cherry-picker'); } public function print_section_info() { // } }
Fatal error: Uncaught Error: Class "Cherry_Picker_Admin" not found in /home/newkoll/www/wp-content/plugins/cherry-picker/includes/class-cherry-picker.php:157 Stack trace: #0 /home/newkoll/www/wp-content/plugins/cherry-picker/includes/class-cherry-picker.php(82): Cherry_Picker->define_admin_hooks() #1 /home/newkoll/www/wp-content/plugins/cherry-picker/cherry-picker.php(81): Cherry_Picker->__construct() #2 /home/newkoll/www/wp-content/plugins/cherry-picker/cherry-picker.php(86): run_cherry_picker() #3 /home/newkoll/www/wp-settings.php(522): include_once('/home/newkoll/w...') #4 /home/newkoll/www/wp-config.php(118): require_once('/home/newkoll/w...') #5 /home/newkoll/www/wp-load.php(50): require_once('/home/newkoll/w...') #6 /home/newkoll/www/wp-blog-header.php(13): require_once('/home/newkoll/w...') #7 /home/newkoll/www/index.php(17): require('/home/newkoll/w...') #8 {main} thrown in /home/newkoll/www/wp-content/plugins/cherry-picker/includes/class-cherry-picker.php on line 157