芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/www/wp-content/plugins/woo-checkout-field-editor-pro/includes/class-thwcfd.php
version = THWCFD_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'woo-checkout-field-editor-pro'; $this->load_dependencies(); add_action('init', array($this, 'init')); $this->define_blocks(); } public function init(){ $this->define_constants(); $this->set_locale(); $this->define_admin_hooks(); $this->define_public_hooks(); } private function load_dependencies() { if(!function_exists('is_plugin_active')){ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-thwcfd-autoloader.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-thwcfd-admin.php'; require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-thwcfd-public-checkout.php'; // require_once THWCFD_PATH . 'classes/class-thwcfd-utils.php'; // require_once THWCFD_PATH . 'classes/class-thwcfd-settings.php'; // require_once THWCFD_PATH . 'classes/class-thwcfd-settings-general.php'; // require_once THWCFD_PATH . 'classes/class-thwcfd-settings-advanced.php'; // require_once THWCFD_PATH . 'classes/class-thwcfd-checkout.php'; } private function set_locale() { add_action('plugins_loaded', array($this, 'load_plugin_textdomain')); } public function load_plugin_textdomain(){ $locale = apply_filters('plugin_locale', get_locale(), self::TEXT_DOMAIN); load_textdomain(self::TEXT_DOMAIN, WP_LANG_DIR.'/woo-checkout-field-editor-pro/'.self::TEXT_DOMAIN.'-'.$locale.'.mo'); load_plugin_textdomain(self::TEXT_DOMAIN, false, dirname(THWCFD_BASE_NAME) . '/languages/'); } private function define_admin_hooks() { $plugin_admin = new THWCFD_Admin( $this->get_plugin_name(), $this->get_version() ); add_action('admin_enqueue_scripts', array($plugin_admin, 'enqueue_styles_and_scripts')); add_action('admin_menu', array($plugin_admin, 'admin_menu')); add_action('admin_head', array($plugin_admin,'review_banner_custom_css')); add_action('admin_footer', array($plugin_admin,'quick_links'),10); add_action('admin_footer', array($plugin_admin,'thwcfd_display_discount_announcement'),10); add_filter('woocommerce_screen_ids', array($plugin_admin, 'add_screen_id')); add_filter('plugin_action_links_'.THWCFD_BASE_NAME, array($plugin_admin, 'plugin_action_links')); add_action( 'admin_init', array( $plugin_admin, 'wcfd_notice_actions' ), 20 ); add_action( 'admin_notices', array($plugin_admin, 'output_review_request_link')); add_action('admin_footer-plugins.php', array($this, 'thwcfd_deactivation_form')); add_action('wp_ajax_thwcfd_deactivation_reason', array($this, 'thwcfd_deactivation_reason')); add_filter('plugin_row_meta', array($plugin_admin, 'plugin_row_meta'), 10, 2); //Landing page added add_action( 'admin_init', array($plugin_admin, 'landing_page' ), 10 ); add_action( 'admin_init', array($plugin_admin, 'redirect_to_landing_page'), 10 ); $themehigh_plugins = new THWCFD_Admin_Settings_Themehigh_Plugins(); add_action('wp_ajax_th_activate_plugin', array($themehigh_plugins, 'activate_themehigh_plugins')); $general_settings = new THWCFD_Admin_Settings_General(); add_action('init', array($general_settings, 'define_admin_hooks'),20); } private function define_public_hooks() { //if(!is_admin() || (defined( 'DOING_AJAX' ) && DOING_AJAX)){ $plugin_checkout = new THWCFD_Public_Checkout( $this->get_plugin_name(), $this->get_version() ); add_action('wp_enqueue_scripts', array($plugin_checkout, 'enqueue_styles_and_scripts')); add_action('init', array($plugin_checkout, 'define_public_hooks'),20); //} } private function define_blocks(){ $plugin_block_checkout = new THWCFD_Block(); $plugin_block_checkout->init(); } private function define_constants(){ !defined('THWCFD_ASSETS_URL_ADMIN') && define('THWCFD_ASSETS_URL_ADMIN', THWCFD_URL . 'admin/assets/'); !defined('THWCFD_ASSETS_URL_PUBLIC') && define('THWCFD_ASSETS_URL_PUBLIC', THWCFD_URL . 'public/assets/'); } /** * The name of the plugin used to uniquely identify it within the context of * WordPress and to define internationalization functionality. * * @return string The name of the plugin. */ public function get_plugin_name() { return $this->plugin_name; } /** * Retrieve the version number of the plugin. * * @return string The version number of the plugin. */ public function get_version() { return $this->version; } public function thwcfd_deactivation_form(){ $is_snooze_time = get_user_meta( get_current_user_id(), 'thwcfd_deactivation_snooze', true ); $now = time(); if($is_snooze_time && ($now < $is_snooze_time)){ return; } $deactivation_reasons = $this->get_deactivation_reasons(); ?>
$reason){ $reason_type = isset($reason['reason_type']) ? $reason['reason_type'] : ''; $reason_placeholder = isset($reason['reason_placeholder']) ? $reason['reason_placeholder'] : ''; ?>
array( 'radio_val' => 'upgraded_to_pro', 'radio_label' => __('Upgraded to premium.', 'woo-checkout-field-editor-pro'), 'reason_type' => 'reviewlink', 'reason_placeholder' => '', ), 'feature_missing'=> array( 'radio_val' => 'feature_missing', 'radio_label' => __('A specific feature is missing', 'woo-checkout-field-editor-pro'), 'reason_type' => 'text', 'reason_placeholder' => __('Type in the feature', 'woo-checkout-field-editor-pro'), ), 'error_or_not_working'=> array( 'radio_val' => 'error_or_not_working', 'radio_label' => __('Found an error in the plugin/ Plugin was not working', 'woo-checkout-field-editor-pro'), 'reason_type' => 'text', 'reason_placeholder' => __('Specify the issue', 'woo-checkout-field-editor-pro'), ), 'hard_to_use' => array( 'radio_val' => 'hard_to_use', 'radio_label' => __('It was hard to use', 'woo-checkout-field-editor-pro'), 'reason_type' => 'text', 'reason_placeholder' => __('How can we improve your experience?', 'woo-checkout-field-editor-pro'), ), 'found_better_plugin' => array( 'radio_val' => 'found_better_plugin', 'radio_label' => __('I found a better Plugin', 'woo-checkout-field-editor-pro'), 'reason_type' => 'text', 'reason_placeholder' => __('Could you please mention the plugin?', 'woo-checkout-field-editor-pro'), ), // 'not_working_as_expected'=> array( // 'radio_val' => 'not_working_as_expected', // 'radio_label' => __('The plugin didn’t work as expected', 'woo-checkout-field-editor-pro'), // 'reason_type' => 'text', // 'reason_placeholder' => __('Specify the issue', 'woo-checkout-field-editor-pro'), // ), 'temporary' => array( 'radio_val' => 'temporary', 'radio_label' => __('It’s a temporary deactivation - I’m troubleshooting an issue', 'woo-checkout-field-editor-pro'), 'reason_type' => 'checkbox', 'reason_placeholder' => __('Could you please mention the plugin?', 'woo-checkout-field-editor-pro'), ), 'other' => array( 'radio_val' => 'other', 'radio_label' => __('Not mentioned here', 'woo-checkout-field-editor-pro'), 'reason_type' => 'textarea', 'reason_placeholder' => __('Kindly tell us your reason, so that we can improve', 'woo-checkout-field-editor-pro'), ), ); } public function thwcfd_deactivation_reason(){ global $wpdb; check_ajax_referer('thwcfd_deactivate_nonce', 'security'); if(!isset($_POST['reason'])){ return; } if($_POST['reason'] === 'temporary'){ $snooze_period = isset($_POST['th-snooze-time']) && $_POST['th-snooze-time'] ? absint($_POST['th-snooze-time']) : MINUTE_IN_SECONDS ; $time_now = time(); $snooze_time = $time_now + $snooze_period; update_user_meta(get_current_user_id(), 'thwcfd_deactivation_snooze', $snooze_time); return; } $data = array( 'plugin' => 'wcfe', 'reason' => sanitize_text_field(wp_unslash($_POST['reason'])), 'comments' => isset($_POST['comments']) ? sanitize_textarea_field(wp_unslash($_POST['comments'])) : '', 'date' => gmdate("M d, Y h:i:s A"), 'software' => isset($_SERVER['SERVER_SOFTWARE']) ? sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'])) : '', 'php_version' => phpversion(), 'mysql_version' => $wpdb->db_version(), 'wp_version' => get_bloginfo('version'), 'wc_version' => (!defined('WC_VERSION')) ? '' : WC_VERSION, 'locale' => get_locale(), 'multisite' => is_multisite() ? 'Yes' : 'No', 'plugin_version'=> THWCFD_VERSION ); $response = wp_remote_post('https://feedback.themehigh.in/api/add_feedbacks', array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => false, 'headers' => array( 'Content-Type' => 'application/json' ), 'body' => json_encode($data), 'cookies' => array() ) ); wp_send_json_success(); } } endif;