PluginProbe ʕ •ᴥ•ʔ
Checkout Field Editor (Checkout Manager) for WooCommerce / 1.7.0
Checkout Field Editor (Checkout Manager) for WooCommerce v1.7.0
1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 trunk 1.0.9 1.2.0 1.2.5 1.2.8 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8
woo-checkout-field-editor-pro / includes / class-thwcfd.php
woo-checkout-field-editor-pro / includes Last commit date
utils 3 years ago class-thwcfd-autoloader.php 3 years ago class-thwcfd.php 3 years ago
class-thwcfd.php
136 lines
1 <?php
2 /**
3 * The file that defines the core plugin class.
4 *
5 * @link https://themehigh.com
6 * @since 1.5.0
7 *
8 * @package woo-checkout-field-editor-pro
9 * @subpackage woo-checkout-field-editor-pro/includes
10 */
11 if(!defined('WPINC')){ die; }
12
13 if(!class_exists('THWCFD')):
14
15 class THWCFD {
16 protected $plugin_name;
17 protected $version;
18 const TEXT_DOMAIN = 'woo-checkout-field-editor-pro';
19
20 public function __construct() {
21 if(defined( 'THWCFD_VERSION')){
22 $this->version = THWCFD_VERSION;
23 } else {
24 $this->version = '1.0.0';
25 }
26 $this->plugin_name = 'woo-checkout-field-editor-pro';
27
28 $this->load_dependencies();
29 $this->set_locale();
30 $this->define_admin_hooks();
31 $this->define_public_hooks();
32
33 add_action('init', array($this, 'init'));
34 }
35
36 private function load_dependencies() {
37 if(!function_exists('is_plugin_active')){
38 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
39 }
40
41 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-thwcfd-autoloader.php';
42 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-thwcfd-admin.php';
43 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-thwcfd-public-checkout.php';
44
45 // require_once THWCFD_PATH . 'classes/class-thwcfd-utils.php';
46 // require_once THWCFD_PATH . 'classes/class-thwcfd-settings.php';
47 // require_once THWCFD_PATH . 'classes/class-thwcfd-settings-general.php';
48 // require_once THWCFD_PATH . 'classes/class-thwcfd-settings-advanced.php';
49 // require_once THWCFD_PATH . 'classes/class-thwcfd-checkout.php';
50 }
51
52 private function set_locale() {
53 add_action('plugins_loaded', array($this, 'load_plugin_textdomain'));
54 }
55
56 public function load_plugin_textdomain(){
57 $locale = apply_filters('plugin_locale', get_locale(), self::TEXT_DOMAIN);
58
59 load_textdomain(self::TEXT_DOMAIN, WP_LANG_DIR.'/woo-checkout-field-editor-pro/'.self::TEXT_DOMAIN.'-'.$locale.'.mo');
60 load_plugin_textdomain(self::TEXT_DOMAIN, false, dirname(THWCFD_BASE_NAME) . '/languages/');
61 }
62
63 private function define_admin_hooks() {
64 $plugin_admin = new THWCFD_Admin( $this->get_plugin_name(), $this->get_version() );
65
66 add_action('admin_enqueue_scripts', array($plugin_admin, 'enqueue_styles_and_scripts'));
67 add_action('admin_menu', array($plugin_admin, 'admin_menu'));
68 add_action('admin_head', array($plugin_admin,'review_banner_custom_css'));
69 add_action('admin_footer', array($plugin_admin,'review_banner_custom_js'));
70 add_filter('woocommerce_screen_ids', array($plugin_admin, 'add_screen_id'));
71 add_filter('plugin_action_links_'.THWCFD_BASE_NAME, array($plugin_admin, 'plugin_action_links'));
72 add_action( 'admin_init', array( $plugin_admin, 'wcfd_notice_actions' ), 20 );
73 add_action( 'admin_notices', array($plugin_admin, 'output_review_request_link'));
74 //add_filter('plugin_row_meta', array($plugin_admin, 'plugin_row_meta'), 10, 2);
75
76 $themehigh_plugins = new THWCFD_Admin_Settings_Themehigh_Plugins();
77 add_action('wp_ajax_th_activate_plugin', array($themehigh_plugins, 'activate_themehigh_plugins'));
78
79 $general_settings = new THWCFD_Admin_Settings_General();
80 add_action('after_setup_theme', array($general_settings, 'define_admin_hooks'));
81 add_action('wp_ajax_hide_thwcfd_admin_notice', array($this, 'hide_thwcfd_admin_notice'));
82 }
83
84 private function define_public_hooks() {
85 //if(!is_admin() || (defined( 'DOING_AJAX' ) && DOING_AJAX)){
86 $plugin_checkout = new THWCFD_Public_Checkout( $this->get_plugin_name(), $this->get_version() );
87 add_action('wp_enqueue_scripts', array($plugin_checkout, 'enqueue_styles_and_scripts'));
88 add_action('after_setup_theme', array($plugin_checkout, 'define_public_hooks'));
89 //}
90 }
91
92 public function init(){
93 $this->define_constants();
94 }
95
96 private function define_constants(){
97 !defined('THWCFD_ASSETS_URL_ADMIN') && define('THWCFD_ASSETS_URL_ADMIN', THWCFD_URL . 'admin/assets/');
98 !defined('THWCFD_ASSETS_URL_PUBLIC') && define('THWCFD_ASSETS_URL_PUBLIC', THWCFD_URL . 'public/assets/');
99 }
100
101 /**
102 * The name of the plugin used to uniquely identify it within the context of
103 * WordPress and to define internationalization functionality.
104 *
105 * @return string The name of the plugin.
106 */
107 public function get_plugin_name() {
108 return $this->plugin_name;
109 }
110
111 /**
112 * Retrieve the version number of the plugin.
113 *
114 * @return string The version number of the plugin.
115 */
116 public function get_version() {
117 return $this->version;
118 }
119
120 public function hide_thwcfd_admin_notice(){
121 check_ajax_referer('thwcfd_notice_security', 'thwcfd_review_nonce');
122
123 $capability = THWCFD_Utils::wcfd_capability();
124
125 if(!current_user_can($capability)){
126 wp_die(-1);
127 }
128
129 $now = time();
130 update_user_meta( get_current_user_id(), 'thwcfd_review_skipped', true );
131 update_user_meta( get_current_user_id(), 'thwcfd_review_skipped_time', $now );
132 }
133
134 }
135
136 endif;