PluginProbe
HookMeUp for WooCommerce / 1.1
HookMeUp for WooCommerce v1.1
4.3 4.1 trunk 1.0 1.0.1 1.1 1.1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.5.8 1.6 All 41 releases
hookmeup / hookmeup.php

hookmeup.php in HookMeUp for WooCommerce 1.1, at hookmeup.php

182 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: HookMeUp – Additional Content for WooCommerce
5 * Plugin URI: https://github.com/getbowtied/Hook-Me-Up
6 * Description: Helps you customize WooCommerce templates without altering the code.
7 * Version: 1.1
8 * Author: GetBowtied
9 * Author URI: https://getbowtied.com/
10 * License: GPL-2.0+
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 * Text Domain: hookmeup
13 * Domain Path: /languages
14 * Requires at least: 4.9
15 * Tested up to: 4.9.6
16 * WC requires at least: 3.3.4
17 * WC tested up to: 3.4.2
18 *
19 * @link getbowtied.com
20 * @since 1.0.0
21 * @package HMU
22 */
23
24 if ( ! defined( 'ABSPATH' ) ) {
25 exit;
26 } // Exit if accessed directly
27
28 if ( ! defined( 'HMU_DIR' ) ) {
29 define( 'HMU_DIR', plugin_dir_path( __FILE__ ) );
30 }
31
32 if ( ! function_exists( 'is_plugin_active' ) ) {
33 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
34 }
35
36 if ( ! class_exists( 'HMU' ) ) :
37
38 /**
39 * HookMeUp class.
40 *
41 * @class HMU
42 * @version 1.0.0
43 */
44 final class HMU {
45
46 /**
47 * Maintaining and registering all hooks that power the plugin.
48 *
49 * @access protected
50 */
51 protected $loader;
52
53 /**
54 * The unique identifier of this plugin.
55 *
56 * @var string
57 */
58 protected $plugin_name = "hookmeup";
59
60 /**
61 * The current version of the plugin.
62 *
63 * @var string
64 */
65 protected $version = '1.0.0';
66
67 /**
68 * The single instance of the class.
69 *
70 * @var HMU
71 */
72 protected static $_instance = null;
73
74 /**
75 * HMU constructor
76 */
77 public function __construct() {
78
79 /**
80 * Die if WooCommerce not installed/activated
81 */
82 if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
83 $this->includes();
84 $this->loader = new HMU_Loader();
85 $this->set_locale();
86 $this->define_public_hooks();
87 } else {
88 add_action( 'admin_notices', array( $this, 'woocommerce_not_installed_warning' ) );
89 }
90 }
91
92 /**
93 * Ensures only one instance of HMU is loaded or can be loaded.
94 */
95 public static function instance() {
96 if ( is_null( self::$_instance ) ) {
97 self::$_instance = new self();
98 }
99 return self::$_instance;
100 }
101
102 /**
103 * Include required core files used in admin and on the frontend.
104 */
105 public function includes() {
106
107 require_once( HMU_DIR . 'includes/customizer/class/class-hmu-editor.php' );
108 require_once( HMU_DIR . 'includes/customizer/class/class-hmu-collapsible.php' );
109 require_once( HMU_DIR . 'includes/customizer/class/class-hmu-toggle.php' );
110
111 require_once( HMU_DIR . 'includes/class-hmu-loader.php' );
112 require_once( HMU_DIR . 'includes/class-hmu-i18n.php' );
113 require_once( HMU_DIR . 'public/class-hmu-public.php' );
114 require_once( HMU_DIR . 'includes/class-hmu-hooks.php' );
115 require_once( HMU_DIR . 'includes/functions-hmu-customizer.php' );
116 }
117
118 /**
119 * Define the locale for this plugin for internationalization.
120 */
121 private function set_locale() {
122 $plugin_i18n = new HMU_i18n();
123 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
124 }
125
126 /**
127 * Register all of the hooks related to the public-facing functionality of the plugin.
128 */
129 private function define_public_hooks() {
130
131 $plugin_public = new HMU_Public( $this->get_plugin_name(), $this->get_version() );
132
133 add_action( 'wp_enqueue_scripts', array( $plugin_public, 'enqueue_styles' ) );
134 }
135
136 /**
137 * Display warning when WooCommerce not installed or activated
138 */
139 public function woocommerce_not_installed_warning() {
140 ?>
141 <div class="message error woocommerce-admin-notice woocommerce-st-inactive woocommerce-not-configured">
142 <p><?php echo esc_html_e( 'HookMeUp is enabled but not effective. It requires WooCommerce in order to work.', 'hookmeup' ); ?></p>
143 </div>
144 <?php
145 }
146
147 /**
148 * Run the loader to execute all of the hooks with WordPress.
149 */
150 public function run() {
151 $this->loader->run();
152 }
153
154 /**
155 * The reference to the class that orchestrates the hooks with the plugin.
156 */
157 public function get_loader() {
158 return $this->loader;
159 }
160
161 /**
162 * The name of the plugin used to uniquely identify it within the context of
163 * WordPress and to define internationalization functionality.
164 */
165 public function get_plugin_name() {
166 return $this->plugin_name;
167 }
168
169 /**
170 * Retrieve the version number of the plugin.
171 */
172 public function get_version() {
173 return $this->version;
174 }
175
176 }
177
178 endif;
179
180 $hmu = new HMU;
181
182